Standardize active/paused functions
This commit is contained in:
parent
719615a6b6
commit
72d791a736
|
@ -426,6 +426,20 @@ void disable_all_steppers() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Printing is active when the print job timer is running
|
||||||
|
*/
|
||||||
|
bool printingIsActive() {
|
||||||
|
return print_job_timer.isRunning() || IS_SD_PRINTING();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Printing is paused according to SD or host indicators
|
||||||
|
*/
|
||||||
|
bool printingIsPaused() {
|
||||||
|
return print_job_timer.isPaused() || IS_SD_PAUSED();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage several activities:
|
* Manage several activities:
|
||||||
* - Check for Filament Runout
|
* - Check for Filament Runout
|
||||||
|
|
|
@ -331,6 +331,9 @@ extern bool Running;
|
||||||
inline bool IsRunning() { return Running; }
|
inline bool IsRunning() { return Running; }
|
||||||
inline bool IsStopped() { return !Running; }
|
inline bool IsStopped() { return !Running; }
|
||||||
|
|
||||||
|
bool printingIsActive();
|
||||||
|
bool printingIsPaused();
|
||||||
|
|
||||||
extern bool wait_for_heatup;
|
extern bool wait_for_heatup;
|
||||||
|
|
||||||
#if HAS_RESUME_CONTINUE
|
#if HAS_RESUME_CONTINUE
|
||||||
|
|
|
@ -381,7 +381,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||||
* - Park the nozzle at the given position
|
* - Park the nozzle at the given position
|
||||||
* - Call unload_filament (if a length was specified)
|
* - Call unload_filament (if a length was specified)
|
||||||
*
|
*
|
||||||
* Returns 'true' if pause was completed, 'false' for abort
|
* Return 'true' if pause was completed, 'false' for abort
|
||||||
*/
|
*/
|
||||||
uint8_t did_pause_print = 0;
|
uint8_t did_pause_print = 0;
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
||||||
/**
|
/**
|
||||||
* Resume or Start print procedure
|
* Resume or Start print procedure
|
||||||
*
|
*
|
||||||
* - Abort if not paused
|
* - If not paused, do nothing and return
|
||||||
* - Reset heater idle timers
|
* - Reset heater idle timers
|
||||||
* - Load filament if specified, but only if:
|
* - Load filament if specified, but only if:
|
||||||
* - a nozzle timed out, or
|
* - a nozzle timed out, or
|
||||||
|
|
|
@ -98,7 +98,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||||
|
|
||||||
// Give the response a chance to update its counter.
|
// Give the response a chance to update its counter.
|
||||||
static inline void run() {
|
static inline void run() {
|
||||||
if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning()
|
if (enabled && !filament_ran_out && (printingIsActive()
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|| did_pause_print
|
|| did_pause_print
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../../module/motion.h"
|
#include "../../module/motion.h"
|
||||||
#include "../../module/printcounter.h"
|
#include "../../module/printcounter.h"
|
||||||
#include "../../gcode/queue.h"
|
#include "../../gcode/queue.h"
|
||||||
#include "../../sd/cardreader.h"
|
|
||||||
#if HAS_BUZZER
|
#if HAS_BUZZER
|
||||||
#include "../../libs/buzzer.h"
|
#include "../../libs/buzzer.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,8 +206,10 @@ void MenuItem_bool::action(PGM_P pstr, bool *ptr, screenFunc_t callback) {
|
||||||
void _lcd_set_z_fade_height() { set_z_fade_height(lcd_z_fade_height); }
|
void _lcd_set_z_fade_height() { set_z_fade_height(lcd_z_fade_height); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../../Marlin.h"
|
||||||
|
|
||||||
bool printer_busy() {
|
bool printer_busy() {
|
||||||
return planner.movesplanned() || IS_SD_PRINTING() || print_job_timer.isRunning();
|
return planner.movesplanned() || printingIsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -99,7 +99,7 @@ void menu_main() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_WATCH);
|
BACK_ITEM(MSG_WATCH);
|
||||||
|
|
||||||
const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning()
|
const bool busy = printingIsActive()
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
, card_detected = card.isMounted()
|
, card_detected = card.isMounted()
|
||||||
, card_open = card_detected && card.isFileOpen()
|
, card_open = card_detected && card.isFileOpen()
|
||||||
|
@ -147,12 +147,7 @@ void menu_main() {
|
||||||
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
||||||
|
|
||||||
#if MACHINE_CAN_PAUSE
|
#if MACHINE_CAN_PAUSE
|
||||||
const bool paused = (print_job_timer.isPaused()
|
if (printingIsPaused()) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
|| card.isPaused()
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (paused) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SUBMENU(MSG_MOTION, menu_motion);
|
SUBMENU(MSG_MOTION, menu_motion);
|
||||||
|
|
|
@ -1427,11 +1427,12 @@ void MarlinUI::update() {
|
||||||
|
|
||||||
#include "../module/printcounter.h"
|
#include "../module/printcounter.h"
|
||||||
|
|
||||||
|
static const char print_paused[] PROGMEM = MSG_PRINT_PAUSED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the status message
|
* Reset the status message
|
||||||
*/
|
*/
|
||||||
void MarlinUI::reset_status() {
|
void MarlinUI::reset_status() {
|
||||||
static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
|
|
||||||
static const char printing[] PROGMEM = MSG_PRINTING;
|
static const char printing[] PROGMEM = MSG_PRINTING;
|
||||||
static const char welcome[] PROGMEM = WELCOME_MSG;
|
static const char welcome[] PROGMEM = WELCOME_MSG;
|
||||||
#if SERVICE_INTERVAL_1 > 0
|
#if SERVICE_INTERVAL_1 > 0
|
||||||
|
@ -1444,8 +1445,8 @@ void MarlinUI::update() {
|
||||||
static const char service3[] PROGMEM = { "> " SERVICE_NAME_3 "!" };
|
static const char service3[] PROGMEM = { "> " SERVICE_NAME_3 "!" };
|
||||||
#endif
|
#endif
|
||||||
PGM_P msg;
|
PGM_P msg;
|
||||||
if (!IS_SD_PRINTING() && print_job_timer.isPaused())
|
if (printingIsPaused())
|
||||||
msg = paused;
|
msg = print_paused;
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
else if (IS_SD_PRINTING())
|
else if (IS_SD_PRINTING())
|
||||||
return set_status(card.longest_filename(), true);
|
return set_status(card.longest_filename(), true);
|
||||||
|
@ -1508,7 +1509,7 @@ void MarlinUI::update() {
|
||||||
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"));
|
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
set_status_P(PSTR(MSG_PRINT_PAUSED));
|
set_status_P(print_paused); // MSG_PRINT_PAUSED
|
||||||
|
|
||||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||||
#if HAS_SPI_LCD
|
#if HAS_SPI_LCD
|
||||||
|
@ -1527,9 +1528,7 @@ void MarlinUI::update() {
|
||||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||||
wait_for_heatup = wait_for_user = false;
|
wait_for_heatup = wait_for_user = false;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(SDSUPPORT)
|
if (IS_SD_PAUSED()) queue.inject_P(PSTR("M24"));
|
||||||
if (card.isPaused()) queue.inject_P(PSTR("M24"));
|
|
||||||
#endif
|
|
||||||
#ifdef ACTION_ON_RESUME
|
#ifdef ACTION_ON_RESUME
|
||||||
host_action_resume();
|
host_action_resume();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -282,6 +282,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_SD_PRINTING() card.flag.sdprinting
|
#define IS_SD_PRINTING() card.flag.sdprinting
|
||||||
|
#define IS_SD_PAUSED() card.isPaused()
|
||||||
#define IS_SD_FILE_OPEN() card.isFileOpen()
|
#define IS_SD_FILE_OPEN() card.isFileOpen()
|
||||||
|
|
||||||
extern CardReader card;
|
extern CardReader card;
|
||||||
|
@ -289,6 +290,7 @@ extern CardReader card;
|
||||||
#else // !SDSUPPORT
|
#else // !SDSUPPORT
|
||||||
|
|
||||||
#define IS_SD_PRINTING() false
|
#define IS_SD_PRINTING() false
|
||||||
|
#define IS_SD_PAUSED() false
|
||||||
#define IS_SD_FILE_OPEN() false
|
#define IS_SD_FILE_OPEN() false
|
||||||
|
|
||||||
#endif // !SDSUPPORT
|
#endif // !SDSUPPORT
|
||||||
|
|
Loading…
Reference in a new issue