Abort if a switch is not activated within a certain time ?
-
Hello.
First post so please be gentle as I'm not that technically minded.
would anyone be able to help me with either writing the required conditional gcode.
Or be able to point me in the direction of any useful easy(ish) to follow reading that explains in detail what every action being taken means/does?
I look and look trying to understand and it just seems like a foreign language.
What I would like to do if possible (as the title says) is prevent an axis from moving further than is required by having a macro which aborts that axis's movement if a switch is not triggered within a certain time frame (sec or m/sec)
would such a thing even be possible ?
thank you in advance if anyone has helpful input.
(edited to make it clear, that it is not relevant in the context of homing) only that a movement abort is required after a certain time period if a switch has not been activated.
This is for a work project and i am not allowed to elaborate further than what is being asked.
-
Sure you can write a macro which contains a timeout, but in your case, it is not useful: before homing, an axis doesn’t „know“ where it is, so you can’t calculate the travel time up to the endstop. Better you have reliable endstops in the first place.
-
@infiniteloop said in Abort if a switch is not activated within a certain time ?:
Sure you can write a macro which contains a timeout, but in your case, it is not useful: before homing, an axis doesn’t „know“ where it is, so you can’t calculate the travel time up to the endstop. Better you have reliable endstops in the first place.
Please accept my apologies maybe i was not clear enough in my original post, I didnt say i wanted (or needed ) to know where the axis was, only that the goal is to abort a movement within a certain time frame if a switch is not activated.
So Can you assist with the original question ?
-
@Bertie-Basset After you've edited your post, you no longer mention endstops. Thanks for the clarification. Further, you added:
i am not allowed to elaborate further than what is being asked
On my turn, I want to clarify that I deeply dislike to code "into the blue".
-
@infiniteloop said in Abort if a switch is not activated within a certain time ?:
@Bertie-Basset After you've edited your post, you no longer mention endstops. Thanks for the clarification. Further, you added:
i am not allowed to elaborate further than what is being asked
On my turn, I want to clarify that I deeply dislike to code "into the blue".
No one is asking you to, the parameters of the the request are clear to understand.
-
Normal homing aborts if the distance traveled is larger than defined axis length x 1.5 or so. If you worry about breaking something during such a move, temporarily reducing the motor current during homing so your axis head moves but stalls rather than breaking stuff could be sufficient for your use case without any additional change in code.
-
@oliof said in Abort if a switch is not activated within a certain time ?:
Normal homing aborts if the distance traveled is larger than defined axis length x 1.5 or so. If you worry about breaking something during such a move, temporarily reducing the motor current during homing so your axis head moves but stalls rather than breaking stuff could be sufficient for your use case without any additional change in code.
Thank you but that is not sufficient, the requirement is to have the axis STOP movement after a defined amount of time NOT Distance unless a switch has been activated.
-
@bertie-basset Use the object model.
gpOut.upTime returns the uptime of the printer
One way (NOT tested):
var StartTime = gpOut.upTime var TimeToWait=50 ; in seconds var TooLong=false while !axes[0].homed ; for x axis if(gpOut.upTime > StartTime+TimeToWait) TooLong=true break ; Do what's needed here if(TooLong) ; do your error code here
Ignore the {1} the forum puts in there
-
Thank you very much, i will test tomorrow and report back, thank you again.