Browse Source

Apply SEC_TO_MS and other fixes

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
efaff24145
  1. 1
      Marlin/src/MarlinCore.cpp
  2. 1
      Marlin/src/core/macros.h
  3. 3
      Marlin/src/gcode/control/M80_M81.cpp
  4. 2
      Marlin/src/gcode/feature/L6470/M916-918.cpp
  5. 2
      Marlin/src/gcode/parser.h
  6. 7
      Marlin/src/module/printcounter.cpp
  7. 5
      Marlin/src/module/printcounter.h
  8. 1
      Marlin/src/module/temperature.cpp
  9. 4
      Marlin/src/module/tool_change.cpp
  10. 2
      Marlin/src/pins/lpc1768/pins_MKS_SBASE.h

1
Marlin/src/MarlinCore.cpp

@ -783,6 +783,7 @@ void minkill(const bool steppers_off/*=false*/) {
*/ */
void stop() { void stop() {
thermalManager.disable_all_heaters(); // 'unpause' taken care of in here thermalManager.disable_all_heaters(); // 'unpause' taken care of in here
print_job_timer.stop(); print_job_timer.stop();
#if ENABLED(PROBING_FANS_OFF) #if ENABLED(PROBING_FANS_OFF)

1
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_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_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_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,V)
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,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)) #define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V))

3
Marlin/src/gcode/control/M80_M81.cpp

@ -89,9 +89,10 @@
*/ */
void GcodeSuite::M81() { void GcodeSuite::M81() {
thermalManager.disable_all_heaters(); thermalManager.disable_all_heaters();
print_job_timer.stop();
planner.finish_and_disable(); planner.finish_and_disable();
print_job_timer.stop();
#if HAS_FAN #if HAS_FAN
thermalManager.zero_fan_speeds(); thermalManager.zero_fan_speeds();
#if ENABLED(PROBING_FANS_OFF) #if ENABLED(PROBING_FANS_OFF)

2
Marlin/src/gcode/feature/L6470/M916-918.cpp

@ -119,7 +119,7 @@ void GcodeSuite::M916() {
M91x_counter_max = 256; // KVAL_HOLD is 8 bits M91x_counter_max = 256; // KVAL_HOLD is 8 bits
uint8_t M91x_delay_s = parser.byteval('D'); // get delay in seconds 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; millis_t M91x_delay_end;
DEBUG_ECHOLNPGM(".\n."); DEBUG_ECHOLNPGM(".\n.");

2
Marlin/src/gcode/parser.h

@ -282,7 +282,7 @@ public:
// Code value for use as time // Code value for use as time
static inline millis_t value_millis() { return value_ulong(); } 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 // Reduce to fewer bits
static inline int16_t value_int() { return (int16_t)value_long(); } static inline int16_t value_int() { return (int16_t)value_long(); }

7
Marlin/src/module/printcounter.cpp

@ -224,9 +224,12 @@ void PrintCounter::tick() {
millis_t now = millis(); millis_t now = millis();
static uint32_t update_next; // = 0 static millis_t update_next; // = 0
if (ELAPSED(now, update_next)) { if (ELAPSED(now, update_next)) {
update_next = now + updateInterval;
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("tick"))); TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("tick")));
millis_t delta = deltaDuration(); millis_t delta = deltaDuration();
data.printTime += delta; data.printTime += delta;
@ -239,8 +242,6 @@ void PrintCounter::tick() {
#if SERVICE_INTERVAL_3 > 0 #if SERVICE_INTERVAL_3 > 0
data.nextService3 -= _MIN(delta, data.nextService3); data.nextService3 -= _MIN(delta, data.nextService3);
#endif #endif
update_next = now + updateInterval * 1000;
} }
static uint32_t eeprom_next; // = 0 static uint32_t eeprom_next; // = 0

5
Marlin/src/module/printcounter.h

@ -71,11 +71,8 @@ class PrintCounter: public Stopwatch {
* @brief Interval in seconds between counter updates * @brief Interval in seconds between counter updates
* @details This const value defines what will be the time between each * @details This const value defines what will be the time between each
* accumulator update. This is different from the EEPROM save interval. * 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 * @brief Interval in seconds between EEPROM saves

1
Marlin/src/module/temperature.cpp

@ -2186,7 +2186,6 @@ void Temperature::disable_all_heaters() {
#endif #endif
#if ENABLED(PROBING_HEATERS_OFF) #if ENABLED(PROBING_HEATERS_OFF)
void Temperature::pause(const bool p) { void Temperature::pause(const bool p) {

4
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 // Cool down with fan
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0 #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; 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; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
#endif #endif
@ -1102,7 +1102,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
// Cool down with fan // Cool down with fan
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0 #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; 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; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
#endif #endif
} }

2
Marlin/src/pins/lpc1768/pins_MKS_SBASE.h

@ -27,7 +27,7 @@
#if defined(MKS_HAS_LPC1769) && NOT_TARGET(MCU_LPC1769) #if defined(MKS_HAS_LPC1769) && NOT_TARGET(MCU_LPC1769)
#error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #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." #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
#endif #endif

Loading…
Cancel
Save