Endstop for extramotor does not work
Hello,
I have an extra motor with an mechanical endstop to change the tools. I use an Arduino Due with the radds board. The extra motor works well without problems. But with the G203 command to home the extra motor, the endstop triggers, but does not stop the motor. Then I have to reset the printer.
I already tested the endstop for the x-axis with the same settings and there the endstop worked. I also tested it with the X-Max pin, but also the endstop does not trigger.
I hope somebody can help me. I have absolutely no idea what the problem can be.
#define NUM_MOTOR_DRIVERS 1
//#define MOTOR_DRIVER_x StepperDriverWithEndstop<int stepPin, int dirPin, int enablePin,bool invertDir, bool invertEnable,int endstop_pin,
// bool invertEndstop,bool minEndstop, bool endstopPullup> var(float steps per mm,float speed, float max.distance)
#define MOTOR_DRIVER_1(var) StepperDriverWithEndstop<35,33,37,0,1,ORIG_Z_MAX_PIN,0,1,1> var(20,10,110)
Thanks in advance
Comments
For clarity, you defined motor range to be 0 - 110 and at 0 you have the min end stop.
Looking into the code in drivers.h line 125++ I think there is a bug
is how it should look like. You see I changed the 2 lines with up = to the opposite. Please try that and report if it then works.
Thank you for your response.
I changed the settings in drivers.h, but without success. I have still the same problem
I changed this settings, but also without success. Does somebody has another idea?
Thank you for your fast response.
But I do not understand it.
Do you mean, that I have two G203 functions in my code? I can only find one function, where should the second function be?
Can you explain it more in detail?
Thank you very much.
I added the "virtual bool endstopHit() = 0;" line so it finds the function.
Hope it then compiles completely.
Alternatively remove the line. We only added it so you can see the status of the endstop for testing, so it is no functional requirement.
Now it compiles completely. But still the same problem. The motor does not stop, when the endstop is triggered.
I am sure that my settings in configuration.h are right for the additional motor.
Can you help me?
// bool invertEndstop,bool minEndstop, bool endstopPullup> var(float steps per mm,float speed, float max.distance)
#define MOTOR_DRIVER_1(var) StepperDriverWithEndstop<35,33,37,0,1,ORIG_Z_MAX_PIN,0,1,1> var(20,10,110)
you have said it is min endstop and homing should happen in that direction.
Also note that end stop is only tested during homing, so only
will check for end stop. All other commands will ignore it anyway.
We are sure that our endstop is working because we tested it on the x-axis, where it was working. We use a mechanical endstop (https://youprintin3d.de/hardware/endstops/444/endstop-microswitches-omron-d2f-01fl.html).
For the endstop of the extra motor, we use the same settings as for the endstops of the working axis.
By homing with the G205 command, the motor is moving into the right direction towards the min-endstop. But the endstop does not trigger.
We do not know why the state of our endstop always is off.
G203 P0
should report motor position and end stop status with your modification from above.
When we send M119 we have no z-max endstop. We only defined the endstop for the additional motor in the motor configuration.
With the G203-command, we receive the current motor position, but no endstop status.
We assume, that the error is somewhere in a sub-programm.
Do you have an idea why?
You see no condition if endstop hit should appear. But I see that it will not work on 8 bit. Should be
Com::printFLN(PSTR(" Endstop Hit:"), motorDrivers[id]->endstopHit());
Will fix that when I'm back. So if you have 8 bit board modify it.
The endstop hit always returns 0, also when it is triggered. And the motor also does not stop when the endstop is triggered. Why?
In initialize I see it getting initialized
HAL::pinMode(endstopPin, endstopPullup ? INPUT_PULLUP : INPUT);
and reading looks also correct:
So double check that the pin number is correct which is most likely the reason. Also test with multimeter if voltage on the pin changes.
HAL::pinMode(endstopPin, endstopPullup ? INPUT_PULLUP : INPUT);
for testing. That way pin is always set as input for every test. Not good for final version as setting mode is slow. But to be sure it is set correctly before reading.
Also what is your definition for it in configuration.h? If pin number is at wrong position it will also not work.
we checked the mechanical endstop for addtional motor on the x- and y-axis axis and it works. We used a working endstop from an axis and changed it for the extra motor driver part, but the endstop is still not triggering. When we use G203 We get an answer like this Motor0 Pos5.00 EndstopHit:0.
Is it possible that this special configuration is not compatibel with a mechanical endstop?
We assume that the error is somewhere in a subprogram.
Didi you do the test with modified endstopHit function as suggested? That is the most basic test to ensure it is correct regarding pin number and invert. It will even overwrite any othe rfunction accidentially using same pin for different functions.
pinMode(Z_MAX_PIN, INPUT_PULLUP);
return READ(Z_MAX_PIN);
use !READ(Z_MAX_PIN); if signal is wrong polarized.
That way you explicitly use z max pin. Eventually switch to y max pin for testing.