Apply SEC_TO_MS and other fixes

This commit is contained in:
Scott Lahteine
2021-01-25 08:32:58 -06:00
parent fb67b9bdad
commit b8186b5081
10 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

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

View File

@ -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
}