This commit is contained in:
Bob-the-Kuhn
2018-01-01 16:11:56 -06:00
parent d80c4f1a6e
commit adb9ecf3cc
9 changed files with 224 additions and 16 deletions

View File

@ -260,8 +260,8 @@ void GcodeSuite::M43() {
}
// Get the range of pins to test or watch
const uint8_t first_pin = PARSED_PIN_INDEX('P', 0),
last_pin = parser.seenval('P') ? first_pin : NUM_DIGITAL_PINS - 1;
uint8_t first_pin = PARSED_PIN_INDEX('P', 0),
last_pin = parser.seenval('P') ? first_pin : NUMBER_PINS_TOTAL - 1;
if (first_pin > last_pin) return;
@ -270,6 +270,10 @@ void GcodeSuite::M43() {
// Watch until click, M108, or reset
if (parser.boolval('W')) {
SERIAL_PROTOCOLLNPGM("Watching pins");
#ifdef ARDUINO_ARCH_SAM
NOLESS(first_pin, 2); // don't hijack the UART pins
#endif
uint8_t pin_state[last_pin - first_pin + 1];
for (uint8_t i = first_pin; i <= last_pin; i++) {
pin_t pin = GET_PIN_MAP_PIN(i);