diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 31959dbda3..4732afbb87 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -783,6 +783,7 @@ void minkill(const bool steppers_off/*=false*/) { */ void stop() { thermalManager.disable_all_heaters(); // 'unpause' taken care of in here + print_job_timer.stop(); #if ENABLED(PROBING_FANS_OFF) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index d5b3342437..63ef597034 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -162,6 +162,7 @@ #define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V)) #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) +#define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V)) diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index ea0f9c2b13..394b06d8ac 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -89,9 +89,10 @@ */ void GcodeSuite::M81() { thermalManager.disable_all_heaters(); - print_job_timer.stop(); planner.finish_and_disable(); + print_job_timer.stop(); + #if HAS_FAN thermalManager.zero_fan_speeds(); #if ENABLED(PROBING_FANS_OFF) diff --git a/Marlin/src/gcode/feature/L6470/M916-918.cpp b/Marlin/src/gcode/feature/L6470/M916-918.cpp index 2672f91239..8a1ea48306 100644 --- a/Marlin/src/gcode/feature/L6470/M916-918.cpp +++ b/Marlin/src/gcode/feature/L6470/M916-918.cpp @@ -119,7 +119,7 @@ void GcodeSuite::M916() { M91x_counter_max = 256; // KVAL_HOLD is 8 bits uint8_t M91x_delay_s = parser.byteval('D'); // get delay in seconds - millis_t M91x_delay_ms = M91x_delay_s * 60 * 1000; + millis_t M91x_delay_ms = SEC_TO_MS(M91x_delay_s * 60); millis_t M91x_delay_end; DEBUG_ECHOLNPGM(".\n."); diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 8633d2b1e9..cf531c4e47 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -282,7 +282,7 @@ public: // Code value for use as time static inline millis_t value_millis() { return value_ulong(); } - static inline millis_t value_millis_from_seconds() { return (millis_t)(value_float() * 1000); } + static inline millis_t value_millis_from_seconds() { return (millis_t)SEC_TO_MS(value_float()); } // Reduce to fewer bits static inline int16_t value_int() { return (int16_t)value_long(); } diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index ab87717f01..5da1d09c75 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -224,9 +224,12 @@ void PrintCounter::tick() { millis_t now = millis(); - static uint32_t update_next; // = 0 + static millis_t update_next; // = 0 if (ELAPSED(now, update_next)) { + update_next = now + updateInterval; + TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("tick"))); + millis_t delta = deltaDuration(); data.printTime += delta; @@ -239,8 +242,6 @@ void PrintCounter::tick() { #if SERVICE_INTERVAL_3 > 0 data.nextService3 -= _MIN(delta, data.nextService3); #endif - - update_next = now + updateInterval * 1000; } static uint32_t eeprom_next; // = 0 diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index 66d8cbb7b3..f7fc96c579 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -71,11 +71,8 @@ class PrintCounter: public Stopwatch { * @brief Interval in seconds between counter updates * @details This const value defines what will be the time between each * accumulator update. This is different from the EEPROM save interval. - * - * @note The max value for this option is 60(s), otherwise integer - * overflow will happen. */ - static constexpr uint16_t updateInterval = 10; + static constexpr millis_t updateInterval = SEC_TO_MS(10); /** * @brief Interval in seconds between EEPROM saves diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 00a048736a..589baf7796 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2186,7 +2186,6 @@ void Temperature::disable_all_heaters() { #endif - #if ENABLED(PROBING_HEATERS_OFF) void Temperature::pause(const bool p) { diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 052b8cd34a..867ae5d927 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -828,7 +828,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a // Cool down with fan #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0 thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; - gcode.dwell(toolchange_settings.fan_time * 1000); + gcode.dwell(SEC_TO_MS(toolchange_settings.fan_time)); thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0; #endif @@ -1102,7 +1102,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { // Cool down with fan #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0 thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; - gcode.dwell(toolchange_settings.fan_time * 1000); + gcode.dwell(SEC_TO_MS(toolchange_settings.fan_time)); thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0; #endif } diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index ea9748ca54..fbddc66e7c 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -27,7 +27,7 @@ #if defined(MKS_HAS_LPC1769) && NOT_TARGET(MCU_LPC1769) #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." -#elif NOT_TARGET(MKS_HAS_LPC1769, MCU_LPC1768) +#elif !defined(MKS_HAS_LPC1769) && NOT_TARGET(MCU_LPC1768) #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif