Add endstop monitor & make pins report pretty

This commit is contained in:
Bob-the-Kuhn
2016-10-29 13:42:43 -05:00
committed by Scott Lahteine
parent 3c3fe1a1ba
commit c7f1f0dae6
3 changed files with 1012 additions and 249 deletions

View File

@@ -148,6 +148,7 @@
* The '#' is necessary when calling from within sd files, as it stops buffer prereading
* M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT)
* M42 - Change pin status via gcode: M42 P<pin> S<value>. LED pin assumed if P is omitted.
* M43 - Monitor pins & report changes - report active pins
* M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
* M75 - Start the print job timer.
* M76 - Pause the print job timer.
@@ -4675,8 +4676,14 @@ inline void gcode_M42() {
/**
* M43: Pin report and debug
*
* pin report if just M43 with no codes
* P<pin> Will read/watch a single pin
* W Watch pins for changes until reboot
* E toggles endstop monitor
* reports changes to endstops
* toggles LED when endstop changes
* background function (machine continues to operate as normal)
*
*/
inline void gcode_M43() {
int first_pin = 0, last_pin = DIO_COUNT - 1;
@@ -4721,9 +4728,16 @@ inline void gcode_M42() {
safe_delay(500);
}
}
else // single pins report
for (int8_t pin = first_pin; pin <= last_pin; pin++)
report_pin_state(pin);
if ( !(code_seen('P') || code_seen('W') || code_seen('E'))) // single pins report
for (uint8_t pin = first_pin; pin <= last_pin; pin++)
report_pin_state_extended(pin, code_seen('I') ); // "hidden" option to ignore protected list
if (code_seen('E')) {
endstop_monitor_flag ^= true;
SERIAL_PROTOCOLPGM("endstop monitor ");
SERIAL_PROTOCOL(endstop_monitor_flag ? "en" : "dis");
SERIAL_PROTOCOLLNPGM("abled");
}
}
#endif // PINS_DEBUGGING