Clean up UI declarations, apply TERN_

2.0.x
Scott Lahteine 5 years ago
parent f263782f1b
commit 9f86dde195

@ -218,13 +218,8 @@ bool wait_for_heatup = true;
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; wait_for_user = true;
if (ms) ms += millis(); // expire time if (ms) ms += millis(); // expire time
while (wait_for_user && !(ms && ELAPSED(millis(), ms))) { while (wait_for_user && !(ms && ELAPSED(millis(), ms)))
idle( idle(TERN_(ADVANCED_PAUSE_FEATURE, no_sleep));
#if ENABLED(ADVANCED_PAUSE_FEATURE)
no_sleep
#endif
);
}
wait_for_user = false; 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 * Standard idle routine keeps the machine alive
*/ */
void idle( void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
#if ENABLED(ADVANCED_PAUSE_FEATURE) // Handle Power-Loss Recovery
bool no_stepper_sleep/*=false*/
#endif
) {
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS) #if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
recovery.outage(); recovery.outage();
#endif #endif
// Run StallGuard endstop checks
#if ENABLED(SPI_ENDSTOPS) #if ENABLED(SPI_ENDSTOPS)
if (endstops.tmc_spi_homing.any if (endstops.tmc_spi_homing.any
#if ENABLED(IMPROVE_HOMING_RELIABILITY) && TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period))
&& ELAPSED(millis(), sg_guard_period) ) LOOP_L_N(i, 4) // Read SGT 4 times per idle loop
#endif
) {
for (uint8_t i = 4; i--;) // Read SGT 4 times per idle loop
if (endstops.tmc_spi_homing_check()) break; if (endstops.tmc_spi_homing_check()) break;
}
#endif #endif
// Max7219 heartbeat, animation, etc.
#if ENABLED(MAX7219_DEBUG) #if ENABLED(MAX7219_DEBUG)
max7219.idle_tasks(); max7219.idle_tasks();
#endif #endif
// Read Buttons and Update the LCD
ui.update(); ui.update();
// Announce Host Keepalive state (if any)
#if ENABLED(HOST_KEEPALIVE_FEATURE) #if ENABLED(HOST_KEEPALIVE_FEATURE)
gcode.host_keepalive(); gcode.host_keepalive();
#endif #endif
// Core Marlin activities
manage_inactivity( manage_inactivity(
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
no_stepper_sleep no_stepper_sleep
#endif #endif
); );
// Manage heaters (and Watchdog)
thermalManager.manage_heater(); thermalManager.manage_heater();
// Update the Print Job Timer state
#if ENABLED(PRINTCOUNTER) #if ENABLED(PRINTCOUNTER)
print_job_timer.tick(); print_job_timer.tick();
#endif #endif
// Update the Beeper queue
#if USE_BEEPER #if USE_BEEPER
buzzer.tick(); buzzer.tick();
#endif #endif
// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS) #if ENABLED(I2C_POSITION_ENCODERS)
static millis_t i2cpem_next_update_ms; static millis_t i2cpem_next_update_ms;
if (planner.has_blocks_queued()) { if (planner.has_blocks_queued()) {
@ -704,10 +701,12 @@ void idle(
} }
#endif #endif
// Run HAL idle tasks
#ifdef HAL_IDLETASK #ifdef HAL_IDLETASK
HAL_idletask(); HAL_idletask();
#endif #endif
// Auto-report Temperatures / SD Status
#if HAS_AUTO_REPORTING #if HAS_AUTO_REPORTING
if (!gcode.autoreport_paused) { if (!gcode.autoreport_paused) {
#if ENABLED(AUTO_REPORT_TEMPERATURES) #if ENABLED(AUTO_REPORT_TEMPERATURES)
@ -719,14 +718,17 @@ void idle(
} }
#endif #endif
// Handle USB Flash Drive insert / remove
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
Sd2Card::idle(); Sd2Card::idle();
#endif #endif
// Update the Prusa MMU2
#if ENABLED(PRUSA_MMU2) #if ENABLED(PRUSA_MMU2)
mmu2.mmu_loop(); mmu2.mmu_loop();
#endif #endif
// Handle Joystick jogging
#if ENABLED(POLL_JOG) #if ENABLED(POLL_JOG)
joystick.inject_jog_moves(); joystick.inject_jog_moves();
#endif #endif

@ -38,19 +38,9 @@
void stop(); void stop();
void idle( // Pass true to keep steppers from timing out
#if ENABLED(ADVANCED_PAUSE_FEATURE) void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false));
bool no_stepper_sleep=false // Pass true to keep steppers from timing out inline void idle_no_sleep() { idle(TERN_(ADVANCED_PAUSE_FEATURE, true)); }
#endif
);
inline void idle_no_sleep() {
idle(
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
}
#if ENABLED(EXPERIMENTAL_I2CBUS) #if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h" #include "feature/twibus.h"

@ -273,7 +273,16 @@ public:
// LCD implementations // LCD implementations
static void clear_lcd(); static void clear_lcd();
#if HAS_SPI_LCD
static bool detected();
static void init_lcd(); 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 #if HAS_DISPLAY
@ -332,12 +341,9 @@ public:
static millis_t next_button_update_ms; static millis_t next_button_update_ms;
static bool detected();
static LCDViewAction lcdDrawUpdate; static LCDViewAction lcdDrawUpdate;
FORCE_INLINE static bool should_draw() { return bool(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(const LCDViewAction type) { lcdDrawUpdate = type; }
FORCE_INLINE static void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); }
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
static void draw_custom_bootscreen(const uint8_t frame=0); static void draw_custom_bootscreen(const uint8_t frame=0);
@ -403,8 +409,6 @@ public:
static void status_screen(); static void status_screen();
#else
static void refresh() {}
#endif #endif
static bool get_blink(); static bool get_blink();
@ -418,13 +422,12 @@ public:
#else // No LCD #else // No LCD
// Send status to host as a notification // Send status to host as a notification
void set_status(const char* message, const bool=false); static void set_status(const char* message, const bool=false);
void set_status_P(PGM_P message, const int8_t=0); static void set_status_P(PGM_P message, const int8_t=0);
void status_printf_P(const uint8_t, PGM_P message, ...); static void status_printf_P(const uint8_t, PGM_P message, ...);
static inline void init() {} static inline void init() {}
static inline void update() {} static inline void update() {}
static inline void refresh() {}
static inline void return_to_status() {} static inline void return_to_status() {}
static inline void set_alert_status_P(PGM_P const) {} static inline void set_alert_status_P(PGM_P const) {}
static inline void reset_status(const bool=false) {} static inline void reset_status(const bool=false) {}

Loading…
Cancel
Save