Clean up UI declarations, apply TERN_
This commit is contained in:
parent
f263782f1b
commit
9f86dde195
@ -218,13 +218,8 @@ bool wait_for_heatup = true;
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true;
|
||||
if (ms) ms += millis(); // expire time
|
||||
while (wait_for_user && !(ms && ELAPSED(millis(), ms))) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
no_sleep
|
||||
#endif
|
||||
);
|
||||
}
|
||||
while (wait_for_user && !(ms && ELAPSED(millis(), ms)))
|
||||
idle(TERN_(ADVANCED_PAUSE_FEATURE, no_sleep));
|
||||
wait_for_user = false;
|
||||
}
|
||||
|
||||
@ -647,52 +642,54 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
||||
/**
|
||||
* Standard idle routine keeps the machine alive
|
||||
*/
|
||||
void idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
bool no_stepper_sleep/*=false*/
|
||||
#endif
|
||||
) {
|
||||
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
// Handle Power-Loss Recovery
|
||||
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
|
||||
recovery.outage();
|
||||
#endif
|
||||
|
||||
// Run StallGuard endstop checks
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
if (endstops.tmc_spi_homing.any
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
&& ELAPSED(millis(), sg_guard_period)
|
||||
#endif
|
||||
) {
|
||||
for (uint8_t i = 4; i--;) // Read SGT 4 times per idle loop
|
||||
&& TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period))
|
||||
) LOOP_L_N(i, 4) // Read SGT 4 times per idle loop
|
||||
if (endstops.tmc_spi_homing_check()) break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Max7219 heartbeat, animation, etc.
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
max7219.idle_tasks();
|
||||
#endif
|
||||
|
||||
// Read Buttons and Update the LCD
|
||||
ui.update();
|
||||
|
||||
// Announce Host Keepalive state (if any)
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
gcode.host_keepalive();
|
||||
#endif
|
||||
|
||||
// Core Marlin activities
|
||||
manage_inactivity(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
no_stepper_sleep
|
||||
#endif
|
||||
);
|
||||
|
||||
// Manage heaters (and Watchdog)
|
||||
thermalManager.manage_heater();
|
||||
|
||||
// Update the Print Job Timer state
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
print_job_timer.tick();
|
||||
#endif
|
||||
|
||||
// Update the Beeper queue
|
||||
#if USE_BEEPER
|
||||
buzzer.tick();
|
||||
#endif
|
||||
|
||||
// Run i2c Position Encoders
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
static millis_t i2cpem_next_update_ms;
|
||||
if (planner.has_blocks_queued()) {
|
||||
@ -704,10 +701,12 @@ void idle(
|
||||
}
|
||||
#endif
|
||||
|
||||
// Run HAL idle tasks
|
||||
#ifdef HAL_IDLETASK
|
||||
HAL_idletask();
|
||||
#endif
|
||||
|
||||
// Auto-report Temperatures / SD Status
|
||||
#if HAS_AUTO_REPORTING
|
||||
if (!gcode.autoreport_paused) {
|
||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||
@ -719,14 +718,17 @@ void idle(
|
||||
}
|
||||
#endif
|
||||
|
||||
// Handle USB Flash Drive insert / remove
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||
Sd2Card::idle();
|
||||
#endif
|
||||
|
||||
// Update the Prusa MMU2
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
mmu2.mmu_loop();
|
||||
#endif
|
||||
|
||||
// Handle Joystick jogging
|
||||
#if ENABLED(POLL_JOG)
|
||||
joystick.inject_jog_moves();
|
||||
#endif
|
||||
|
@ -38,19 +38,9 @@
|
||||
|
||||
void stop();
|
||||
|
||||
void idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
bool no_stepper_sleep=false // Pass true to keep steppers from timing out
|
||||
#endif
|
||||
);
|
||||
|
||||
inline void idle_no_sleep() {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
}
|
||||
// Pass true to keep steppers from timing out
|
||||
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false));
|
||||
inline void idle_no_sleep() { idle(TERN_(ADVANCED_PAUSE_FEATURE, true)); }
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#include "feature/twibus.h"
|
||||
|
@ -273,7 +273,16 @@ public:
|
||||
|
||||
// LCD implementations
|
||||
static void clear_lcd();
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
static bool detected();
|
||||
static void init_lcd();
|
||||
FORCE_INLINE static void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); }
|
||||
#else
|
||||
static inline bool detected() { return true; }
|
||||
static inline void init_lcd() {}
|
||||
static inline void refresh() {}
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
|
||||
@ -332,12 +341,9 @@ public:
|
||||
|
||||
static millis_t next_button_update_ms;
|
||||
|
||||
static bool detected();
|
||||
|
||||
static LCDViewAction lcdDrawUpdate;
|
||||
FORCE_INLINE static bool should_draw() { return bool(lcdDrawUpdate); }
|
||||
FORCE_INLINE static void refresh(const LCDViewAction type) { lcdDrawUpdate = type; }
|
||||
FORCE_INLINE static void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); }
|
||||
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
||||
static void draw_custom_bootscreen(const uint8_t frame=0);
|
||||
@ -403,8 +409,6 @@ public:
|
||||
|
||||
static void status_screen();
|
||||
|
||||
#else
|
||||
static void refresh() {}
|
||||
#endif
|
||||
|
||||
static bool get_blink();
|
||||
@ -418,13 +422,12 @@ public:
|
||||
#else // No LCD
|
||||
|
||||
// Send status to host as a notification
|
||||
void set_status(const char* message, const bool=false);
|
||||
void set_status_P(PGM_P message, const int8_t=0);
|
||||
void status_printf_P(const uint8_t, PGM_P message, ...);
|
||||
static void set_status(const char* message, const bool=false);
|
||||
static void set_status_P(PGM_P message, const int8_t=0);
|
||||
static void status_printf_P(const uint8_t, PGM_P message, ...);
|
||||
|
||||
static inline void init() {}
|
||||
static inline void update() {}
|
||||
static inline void refresh() {}
|
||||
static inline void return_to_status() {}
|
||||
static inline void set_alert_status_P(PGM_P const) {}
|
||||
static inline void reset_status(const bool=false) {}
|
||||
|
Loading…
Reference in New Issue
Block a user