Zeonia did you find solution for the problem? I can confirm this issue, the gcode button stays in pressed condition if released while executing macro or gcode. If released after execution or moves, or button is pressed again(pressing gets ignored, of course), the release works again.
QUERY_BUTTON button=OFFSET_CAL_SENSE
command confirms this, the reply says “PRESSED” even the pin is high for sure. I have fysically measured and made sure that the pin is pulled back up by the MCU (Pull down/to ground switch is used)
So, pin is pulled up, inverted, and it works as expected when testing the switch manually when its not executing anything.
[gcode_button OFFSET_CAL_SENSE]
pin: ^!PE4
press_gcode:MEASURE_STOP
#release_gcode:
I´m trying to use the gcode button for measuring offsets for multiple extruder nozzles (with tool change) but at the moment its impossible to get it working, because so much code is executing and the release of the “button” is ignored and it stays “PRESSED” condition, ones it’s pressed. (it’s really a touch sensing of the nozzle to a metal calibration cube… but basically functions as a switch).
That MEASURE_STOP
is a macro that stops a movement (moves with delayed cgode → value to 0), records position, and starts next iteration of measurements.
Edit. Before anyone suggests that the delayd gcode is the problem, I say, I don’t thing so, the release is done later, when the dalayed gcode is no longer active.
I have tried G4 dwell and even keep the “BUTTON” pressed over the macro, and move the nozzle off in next macro.
It seems like if the macro, or other gcode executed, it self is making the pin change state, the rising edge is lost. I mean the actions are so close each other, the problem gets worse. I could imagine the problem may exist in other applications too, but only by coincidence.
In my case, macro commands G1 to move off the caribration cube, → contact is lost allmost at the same time → rising edge in the pin lost = “button” stays pressed and next measurement is not qoing to work.
I’m using ramps 1.4 as a MCU
Any help is appreciated.