Merge pull request #3403 from jbrazio/feature/stopwatch
Print job timer rework
This commit is contained in:
commit
d7cbb2eec9
7 changed files with 257 additions and 78 deletions
|
@ -65,6 +65,8 @@ typedef unsigned long millis_t;
|
||||||
|
|
||||||
#include "WString.h"
|
#include "WString.h"
|
||||||
|
|
||||||
|
#include "stopwatch.h"
|
||||||
|
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
#if ENABLED(BLUETOOTH)
|
#if ENABLED(BLUETOOTH)
|
||||||
#define MYSERIAL bluetoothSerial
|
#define MYSERIAL bluetoothSerial
|
||||||
|
@ -356,8 +358,8 @@ extern bool axis_homed[3]; // axis[n].is_homed
|
||||||
extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
|
extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern millis_t print_job_start_ms;
|
// Print job timer
|
||||||
extern millis_t print_job_stop_ms;
|
extern Stopwatch print_job_timer;
|
||||||
|
|
||||||
// Handling multiple extruders pins
|
// Handling multiple extruders pins
|
||||||
extern uint8_t active_extruder;
|
extern uint8_t active_extruder;
|
||||||
|
@ -373,9 +375,4 @@ extern uint8_t active_extruder;
|
||||||
|
|
||||||
extern void calculate_volumetric_multipliers();
|
extern void calculate_volumetric_multipliers();
|
||||||
|
|
||||||
// Print job timer related functions
|
|
||||||
millis_t print_job_timer();
|
|
||||||
bool print_job_start(millis_t t = 0);
|
|
||||||
bool print_job_stop(bool force = false);
|
|
||||||
|
|
||||||
#endif //MARLIN_H
|
#endif //MARLIN_H
|
||||||
|
|
|
@ -298,8 +298,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
|
||||||
millis_t previous_cmd_ms = 0;
|
millis_t previous_cmd_ms = 0;
|
||||||
static millis_t max_inactive_time = 0;
|
static millis_t max_inactive_time = 0;
|
||||||
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L;
|
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L;
|
||||||
millis_t print_job_start_ms = 0; ///< Print job start time
|
Stopwatch print_job_timer = Stopwatch();
|
||||||
millis_t print_job_stop_ms = 0; ///< Print job stop time
|
|
||||||
static uint8_t target_extruder;
|
static uint8_t target_extruder;
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
||||||
|
@ -1011,9 +1010,9 @@ inline void get_serial_commands() {
|
||||||
) {
|
) {
|
||||||
if (card_eof) {
|
if (card_eof) {
|
||||||
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
|
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
|
||||||
print_job_stop(true);
|
print_job_timer.stop();
|
||||||
char time[30];
|
char time[30];
|
||||||
millis_t t = print_job_timer();
|
millis_t t = print_job_timer.duration();
|
||||||
int hours = t / 60 / 60, minutes = (t / 60) % 60;
|
int hours = t / 60 / 60, minutes = (t / 60) % 60;
|
||||||
sprintf_P(time, PSTR("%i " MSG_END_HOUR " %i " MSG_END_MINUTE), hours, minutes);
|
sprintf_P(time, PSTR("%i " MSG_END_HOUR " %i " MSG_END_MINUTE), hours, minutes);
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
|
@ -3571,7 +3570,7 @@ inline void gcode_M17() {
|
||||||
*/
|
*/
|
||||||
inline void gcode_M24() {
|
inline void gcode_M24() {
|
||||||
card.startFileprint();
|
card.startFileprint();
|
||||||
print_job_start();
|
print_job_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3627,7 +3626,7 @@ inline void gcode_M17() {
|
||||||
* M31: Get the time since the start of SD Print (or last M109)
|
* M31: Get the time since the start of SD Print (or last M109)
|
||||||
*/
|
*/
|
||||||
inline void gcode_M31() {
|
inline void gcode_M31() {
|
||||||
millis_t t = print_job_timer();
|
millis_t t = print_job_timer.duration();
|
||||||
int min = t / 60, sec = t % 60;
|
int min = t / 60, sec = t % 60;
|
||||||
char time[30];
|
char time[30];
|
||||||
sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
|
sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
|
||||||
|
@ -3663,7 +3662,7 @@ inline void gcode_M31() {
|
||||||
card.startFileprint();
|
card.startFileprint();
|
||||||
|
|
||||||
// Procedure calls count as normal print time.
|
// Procedure calls count as normal print time.
|
||||||
if (!call_procedure) print_job_start();
|
if (!call_procedure) print_job_timer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4030,6 +4029,27 @@ inline void gcode_M42() {
|
||||||
|
|
||||||
#endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
|
#endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M75: Start print timer
|
||||||
|
*/
|
||||||
|
inline void gcode_M75() {
|
||||||
|
print_job_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M76: Pause print timer
|
||||||
|
*/
|
||||||
|
inline void gcode_M76() {
|
||||||
|
print_job_timer.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M77: Stop print timer
|
||||||
|
*/
|
||||||
|
inline void gcode_M77() {
|
||||||
|
print_job_timer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M104: Set hot end temperature
|
* M104: Set hot end temperature
|
||||||
*/
|
*/
|
||||||
|
@ -4037,9 +4057,6 @@ inline void gcode_M104() {
|
||||||
if (setTargetedHotend(104)) return;
|
if (setTargetedHotend(104)) return;
|
||||||
if (DEBUGGING(DRYRUN)) return;
|
if (DEBUGGING(DRYRUN)) return;
|
||||||
|
|
||||||
// Start hook must happen before setTargetHotend()
|
|
||||||
print_job_start();
|
|
||||||
|
|
||||||
if (code_seen('S')) {
|
if (code_seen('S')) {
|
||||||
float temp = code_value();
|
float temp = code_value();
|
||||||
setTargetHotend(temp, target_extruder);
|
setTargetHotend(temp, target_extruder);
|
||||||
|
@ -4048,10 +4065,24 @@ inline void gcode_M104() {
|
||||||
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
|
||||||
|
* stand by mode, for instance in a dual extruder setup, without affecting
|
||||||
|
* the running print timer.
|
||||||
|
*/
|
||||||
|
if (temp <= (EXTRUDE_MINTEMP)/2) {
|
||||||
|
print_job_timer.stop();
|
||||||
|
LCD_MESSAGEPGM(WELCOME_MSG);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* We do not check if the timer is already running because this check will
|
||||||
|
* be done for us inside the Stopwatch::start() method thus a running timer
|
||||||
|
* will not restart.
|
||||||
|
*/
|
||||||
|
else print_job_timer.start();
|
||||||
|
|
||||||
if (temp > degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
|
if (temp > degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
|
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
|
||||||
|
@ -4179,9 +4210,6 @@ inline void gcode_M109() {
|
||||||
if (setTargetedHotend(109)) return;
|
if (setTargetedHotend(109)) return;
|
||||||
if (DEBUGGING(DRYRUN)) return;
|
if (DEBUGGING(DRYRUN)) return;
|
||||||
|
|
||||||
// Start hook must happen before setTargetHotend()
|
|
||||||
print_job_start();
|
|
||||||
|
|
||||||
no_wait_for_cooling = code_seen('S');
|
no_wait_for_cooling = code_seen('S');
|
||||||
if (no_wait_for_cooling || code_seen('R')) {
|
if (no_wait_for_cooling || code_seen('R')) {
|
||||||
float temp = code_value();
|
float temp = code_value();
|
||||||
|
@ -4191,11 +4219,25 @@ inline void gcode_M109() {
|
||||||
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
|
||||||
|
* stand by mode, for instance in a dual extruder setup, without affecting
|
||||||
|
* the running print timer.
|
||||||
|
*/
|
||||||
|
if (temp <= (EXTRUDE_MINTEMP)/2) {
|
||||||
|
print_job_timer.stop();
|
||||||
|
LCD_MESSAGEPGM(WELCOME_MSG);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* We do not check if the timer is already running because this check will
|
||||||
|
* be done for us inside the Stopwatch::start() method thus a running timer
|
||||||
|
* will not restart.
|
||||||
|
*/
|
||||||
|
else print_job_timer.start();
|
||||||
|
|
||||||
if (temp > degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
|
if (temp > degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG);
|
|
||||||
|
|
||||||
#if ENABLED(AUTOTEMP)
|
#if ENABLED(AUTOTEMP)
|
||||||
autotemp_enabled = code_seen('F');
|
autotemp_enabled = code_seen('F');
|
||||||
if (autotemp_enabled) autotemp_factor = code_value();
|
if (autotemp_enabled) autotemp_factor = code_value();
|
||||||
|
@ -6223,6 +6265,18 @@ void process_next_command() {
|
||||||
break;
|
break;
|
||||||
#endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
|
#endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
|
||||||
|
|
||||||
|
case 75: // Start print timer
|
||||||
|
gcode_M75();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 76: // Pause print timer
|
||||||
|
gcode_M76();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 77: // Stop print timer
|
||||||
|
gcode_M77();
|
||||||
|
break;
|
||||||
|
|
||||||
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
||||||
case 100:
|
case 100:
|
||||||
gcode_M100();
|
gcode_M100();
|
||||||
|
@ -7639,50 +7693,3 @@ void calculate_volumetric_multipliers() {
|
||||||
for (int i = 0; i < EXTRUDERS; i++)
|
for (int i = 0; i < EXTRUDERS; i++)
|
||||||
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
|
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Start the print job timer
|
|
||||||
*
|
|
||||||
* The print job is only started if all extruders have their target temp at zero
|
|
||||||
* otherwise the print job timew would be reset everytime a M109 is received.
|
|
||||||
*
|
|
||||||
* @param t start timer timestamp
|
|
||||||
*
|
|
||||||
* @return true if the timer was started at function call
|
|
||||||
*/
|
|
||||||
bool print_job_start(millis_t t /* = 0 */) {
|
|
||||||
for (int i = 0; i < EXTRUDERS; i++) if (degTargetHotend(i) > 0) return false;
|
|
||||||
print_job_start_ms = (t) ? t : millis();
|
|
||||||
print_job_stop_ms = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the running print job has finished and stop the timer
|
|
||||||
*
|
|
||||||
* When the target temperature for all extruders is zero then we assume that the
|
|
||||||
* print job has finished printing. There are some special conditions under which
|
|
||||||
* this assumption may not be valid: If during a print job for some reason the
|
|
||||||
* user decides to bring a nozzle temp down and only then heat the other afterwards.
|
|
||||||
*
|
|
||||||
* @param force stops the timer ignoring all pre-checks
|
|
||||||
*
|
|
||||||
* @return boolean true if the print job has finished printing
|
|
||||||
*/
|
|
||||||
bool print_job_stop(bool force /* = false */) {
|
|
||||||
if (!print_job_start_ms) return false;
|
|
||||||
if (!force) for (int i = 0; i < EXTRUDERS; i++) if (degTargetHotend(i) > 0) return false;
|
|
||||||
print_job_stop_ms = millis();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output the print job timer in seconds
|
|
||||||
*
|
|
||||||
* @return the number of seconds
|
|
||||||
*/
|
|
||||||
millis_t print_job_timer() {
|
|
||||||
if (!print_job_start_ms) return 0;
|
|
||||||
return (((print_job_stop_ms > print_job_start_ms)
|
|
||||||
? print_job_stop_ms : millis()) - print_job_start_ms) / 1000;
|
|
||||||
}
|
|
||||||
|
|
|
@ -334,9 +334,8 @@ static void lcd_implementation_status_screen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
u8g.setPrintPos(80,48);
|
u8g.setPrintPos(80,48);
|
||||||
if (print_job_start_ms != 0) {
|
uint16_t time = print_job_timer.duration() / 60;
|
||||||
uint16_t time = (((print_job_stop_ms > print_job_start_ms)
|
if (time != 0) {
|
||||||
? print_job_stop_ms : millis()) - print_job_start_ms) / 60000;
|
|
||||||
lcd_print(itostr2(time/60));
|
lcd_print(itostr2(time/60));
|
||||||
lcd_print(':');
|
lcd_print(':');
|
||||||
lcd_print(itostr2(time%60));
|
lcd_print(itostr2(time%60));
|
||||||
|
|
77
Marlin/stopwatch.cpp
Normal file
77
Marlin/stopwatch.cpp
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Marlin.h"
|
||||||
|
#include "stopwatch.h"
|
||||||
|
|
||||||
|
Stopwatch::Stopwatch() {
|
||||||
|
this->reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stopwatch::stop() {
|
||||||
|
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::stop()");
|
||||||
|
if (!this->isRunning()) return;
|
||||||
|
|
||||||
|
this->status = STPWTCH_STOPPED;
|
||||||
|
this->stopTimestamp = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stopwatch::pause() {
|
||||||
|
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::pause()");
|
||||||
|
if (!this->isRunning()) return;
|
||||||
|
|
||||||
|
this->status = STPWTCH_PAUSED;
|
||||||
|
this->stopTimestamp = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stopwatch::start() {
|
||||||
|
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::start()");
|
||||||
|
if (this->isRunning()) return;
|
||||||
|
|
||||||
|
if (this->isPaused()) this->accumulator = this->duration();
|
||||||
|
else this->reset();
|
||||||
|
|
||||||
|
this->status = STPWTCH_RUNNING;
|
||||||
|
this->startTimestamp = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stopwatch::reset() {
|
||||||
|
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::reset()");
|
||||||
|
|
||||||
|
this->status = STPWTCH_STOPPED;
|
||||||
|
this->startTimestamp = 0;
|
||||||
|
this->stopTimestamp = 0;
|
||||||
|
this->accumulator = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Stopwatch::isRunning() {
|
||||||
|
return (this->status == STPWTCH_RUNNING) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Stopwatch::isPaused() {
|
||||||
|
return (this->status == STPWTCH_PAUSED) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t Stopwatch::duration() {
|
||||||
|
return (((this->isRunning()) ? millis() : this->stopTimestamp)
|
||||||
|
- this->startTimestamp) / 1000 + this->accumulator;
|
||||||
|
}
|
99
Marlin/stopwatch.h
Normal file
99
Marlin/stopwatch.h
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STOPWATCH_H
|
||||||
|
#define STOPWATCH_H
|
||||||
|
|
||||||
|
enum StopwatchStatus {
|
||||||
|
STPWTCH_STOPPED = 0x0,
|
||||||
|
STPWTCH_RUNNING = 0x1,
|
||||||
|
STPWTCH_PAUSED = 0x2
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stopwatch class
|
||||||
|
* @details This class acts as a timer proving stopwatch functionality including
|
||||||
|
* the ability to pause the running time counter.
|
||||||
|
*/
|
||||||
|
class Stopwatch {
|
||||||
|
private:
|
||||||
|
StopwatchStatus status;
|
||||||
|
uint16_t accumulator;
|
||||||
|
uint32_t startTimestamp;
|
||||||
|
uint32_t stopTimestamp;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Class constructor
|
||||||
|
*/
|
||||||
|
Stopwatch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stops the stopwatch
|
||||||
|
* @details Stops the running timer, it will silently ignore the request if
|
||||||
|
* no timer is currently running.
|
||||||
|
*/
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Pauses the stopwatch
|
||||||
|
* @details Pauses the running timer, it will silently ignore the request if
|
||||||
|
* no timer is currently running.
|
||||||
|
*/
|
||||||
|
void pause();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the stopwatch
|
||||||
|
* @details Starts the timer, it will silently ignore the request if the
|
||||||
|
* timer is already running.
|
||||||
|
*/
|
||||||
|
void start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Resets the stopwatch
|
||||||
|
* @details Resets all settings to their default values.
|
||||||
|
*/
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the timer is running
|
||||||
|
* @details Returns true if the timer is currently running, false otherwise.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool isRunning();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the timer is paused
|
||||||
|
* @details Returns true if the timer is currently paused, false otherwise.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool isPaused();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the running time
|
||||||
|
* @details Returns the total number of seconds the timer has been running.
|
||||||
|
* @return uint16_t
|
||||||
|
*/
|
||||||
|
uint16_t duration();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //STOPWATCH_H
|
|
@ -1175,7 +1175,7 @@ void disable_all_heaters() {
|
||||||
setTargetBed(0);
|
setTargetBed(0);
|
||||||
|
|
||||||
// If all heaters go down then for sure our print job has stopped
|
// If all heaters go down then for sure our print job has stopped
|
||||||
print_job_stop(true);
|
print_job_timer.stop();
|
||||||
|
|
||||||
#define DISABLE_HEATER(NR) { \
|
#define DISABLE_HEATER(NR) { \
|
||||||
setTargetHotend(NR, 0); \
|
setTargetHotend(NR, 0); \
|
||||||
|
|
|
@ -716,9 +716,9 @@ static void lcd_implementation_status_screen() {
|
||||||
|
|
||||||
lcd.setCursor(LCD_WIDTH - 6, 2);
|
lcd.setCursor(LCD_WIDTH - 6, 2);
|
||||||
lcd.print(LCD_STR_CLOCK[0]);
|
lcd.print(LCD_STR_CLOCK[0]);
|
||||||
if (print_job_start_ms != 0) {
|
|
||||||
uint16_t time = (((print_job_stop_ms > print_job_start_ms)
|
uint16_t time = print_job_timer.duration() / 60;
|
||||||
? print_job_stop_ms : millis()) - print_job_start_ms) / 60000;
|
if (time != 0) {
|
||||||
lcd.print(itostr2(time / 60));
|
lcd.print(itostr2(time / 60));
|
||||||
lcd.print(':');
|
lcd.print(':');
|
||||||
lcd.print(itostr2(time % 60));
|
lcd.print(itostr2(time % 60));
|
||||||
|
|
Reference in a new issue