diff --git a/Marlin/Conditionals_LulzBot.h b/Marlin/Conditionals_LulzBot.h index 69c42f862..3146b7201 100644 --- a/Marlin/Conditionals_LulzBot.h +++ b/Marlin/Conditionals_LulzBot.h @@ -39,7 +39,7 @@ #error Must specify model and toolhead. Please see "Configuration_LulzBot.h" for directions. #endif -#define LULZBOT_FW_VERSION ".5" +#define LULZBOT_FW_VERSION ".6" // Select options based on printer model @@ -162,6 +162,12 @@ // so long as UBL is disabled. #define LULZBOT_G26_BACKWARDS_COMPATIBILITY +// Fix for auto0.g, which is broken +#define LULZBOT_AUTOSTART_BUGFIX + +// Q&A wants to be able to use M226 on endstops switches +#define LULZBOT_NO_PIN_PROTECTION_ON_M226 + // The following should be kept more or less like M999 #define LULZBOT_G26_RESET_ACTION \ Running = true; \ diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1fcd8a661..216395735 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8802,13 +8802,22 @@ inline void gcode_M226() { const int pin_number = parser.value_int(), pin_state = parser.intval('S', -1); // required pin state - default is inverted +#if defined(LULZBOT_NO_PIN_PROTECTION_ON_M226) + if (WITHIN(pin_state, -1, 1) && pin_number > -1) { +#else if (WITHIN(pin_state, -1, 1) && pin_number > -1 && !pin_is_protected(pin_number)) { +#endif int target = LOW; stepper.synchronize(); +#if !defined(LULZBOT_NO_PIN_PROTECTION_ON_M226) pinMode(pin_number, INPUT); +#else + // Don't switch pin mode. Since we are disabling protection, + // we should only poll pins that already are inputs. +#endif switch (pin_state) { case 1: target = HIGH; diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 0f4020291..858798cbe 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -27,6 +27,7 @@ #include "language.h" #include "Marlin.h" +#include "Configuration.h" #if ENABLED(SDSUPPORT) @@ -532,8 +533,13 @@ void CardReader::write_command(char *buf) { } void CardReader::checkautostart(bool force) { +#if defined(LULZBOT_AUTOSTART_BUGFIX) + if (!force && (!autostart_stilltocheck || ! ELAPSED(millis(), next_autostart_ms))) + return; +#else if (!force && (!autostart_stilltocheck || ELAPSED(millis(), next_autostart_ms))) return; +#endif autostart_stilltocheck = false;