Printing hangs when toggling pin April 27, 2020 03:01AM |
Registered: 8 years ago Posts: 8 |
#include "../../inc/MarlinConfig.h" #include "../gcode.h" #include "../../MarlinCore.h" /** * M777: Switch printer lighting on/off * * P(pin) - Pin number * T(bool) - Toggl lighting on/off * S(state) - Switch lighting on if 1 and off if 0 */ void GcodeSuite::M777() { const int pin_index = PARSED_PIN_INDEX ('P', GET_PIN_MAP_INDEX (LED_PIN)); //SERIAL_ECHO_MSG("pin_index: ", pin_index); if (pin_index < 0) return; const pin_t pin = GET_PIN_MAP_PIN(pin_index); if(parser.seenval('S')) { const byte status = parser.value_byte(); if(status == 1) { pinMode(pin, OUTPUT); extDigitalWrite(pin, 1); }else if(status == 0) { pinMode(pin, OUTPUT); extDigitalWrite(pin, 0); }else { return; } } if(parser.seenval('T')) { pinMode(pin, OUTPUT); extDigitalWrite(pin, !extDigitalRead(pin)); } }
Re: Printing hangs when toggling pin April 27, 2020 08:13AM |
Admin Registered: 13 years ago Posts: 7,008 |
Re: Printing hangs when toggling pin April 27, 2020 08:56AM |
Registered: 8 years ago Posts: 8 |
Re: Printing hangs when toggling pin April 27, 2020 04:38PM |
Registered: 8 years ago Posts: 8 |