🚸 SD card wake on insert, status screen on remove (#27197)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
4af5229cee
commit
571783fc04
@ -392,7 +392,7 @@ void MarlinUI::clear_for_drawing() {
|
|||||||
#if HAS_DISPLAY_SLEEP
|
#if HAS_DISPLAY_SLEEP
|
||||||
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
|
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
|
||||||
static bool asleep = false;
|
static bool asleep = false;
|
||||||
if (asleep != sleep){
|
if (asleep != sleep) {
|
||||||
sleep ? u8g.sleepOn() : u8g.sleepOff();
|
sleep ? u8g.sleepOn() : u8g.sleepOff();
|
||||||
asleep = sleep;
|
asleep = sleep;
|
||||||
}
|
}
|
||||||
|
@ -1824,13 +1824,14 @@ void MarlinUI::host_notify(const char * const cstr) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MarlinUI::media_changed(const uint8_t old_status, const uint8_t status) {
|
void MarlinUI::media_changed(const uint8_t old_status, const uint8_t status) {
|
||||||
|
TERN_(HAS_DISPLAY_SLEEP, refresh_screen_timeout());
|
||||||
if (old_status == status) {
|
if (old_status == status) {
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMediaError()); // Failed to mount/unmount
|
TERN_(EXTENSIBLE_UI, ExtUI::onMediaError()); // Failed to mount/unmount
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status) {
|
if (old_status < 2) { // Skip this section on first boot check
|
||||||
if (old_status < 2) {
|
if (status) { // Media Mounted
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
ExtUI::onMediaMounted();
|
ExtUI::onMediaMounted();
|
||||||
#elif ENABLED(BROWSE_MEDIA_ON_INSERT)
|
#elif ENABLED(BROWSE_MEDIA_ON_INSERT)
|
||||||
@ -1841,16 +1842,16 @@ void MarlinUI::host_notify(const char * const cstr) {
|
|||||||
LCD_MESSAGE(MSG_MEDIA_INSERTED);
|
LCD_MESSAGE(MSG_MEDIA_INSERTED);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
else { // Media Removed
|
||||||
else {
|
|
||||||
if (old_status < 2) {
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
ExtUI::onMediaRemoved();
|
ExtUI::onMediaRemoved();
|
||||||
#elif HAS_SD_DETECT
|
#elif HAS_SD_DETECT // Q: Does "Media Removed" need to be shown for manual release too?
|
||||||
LCD_MESSAGE(MSG_MEDIA_REMOVED);
|
LCD_MESSAGE(MSG_MEDIA_REMOVED);
|
||||||
#if HAS_MARLINUI_MENU
|
#if HAS_MARLINUI_MENU
|
||||||
if (!defer_return_to_status) return_to_status();
|
if (ENABLED(HAS_WIRED_LCD) || !defer_return_to_status) return_to_status();
|
||||||
#endif
|
#endif
|
||||||
|
#elif HAS_WIRED_LCD
|
||||||
|
return_to_status();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,6 +304,7 @@ public:
|
|||||||
static void refresh_screen_timeout();
|
static void refresh_screen_timeout();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Sleep or wake the display (e.g., by turning the backlight off/on).
|
||||||
static void sleep_display(const bool=true) IF_DISABLED(HAS_DISPLAY_SLEEP, {});
|
static void sleep_display(const bool=true) IF_DISABLED(HAS_DISPLAY_SLEEP, {});
|
||||||
static void wake_display() { sleep_display(false); }
|
static void wake_display() { sleep_display(false); }
|
||||||
|
|
||||||
@ -743,7 +744,7 @@ public:
|
|||||||
|
|
||||||
static void draw_select_screen_prompt(FSTR_P const fpre, const char * const string=nullptr, FSTR_P const fsuf=nullptr);
|
static void draw_select_screen_prompt(FSTR_P const fpre, const char * const string=nullptr, FSTR_P const fsuf=nullptr);
|
||||||
|
|
||||||
#else
|
#else // !HAS_MARLINUI_MENU
|
||||||
|
|
||||||
static void return_to_status() {}
|
static void return_to_status() {}
|
||||||
|
|
||||||
@ -753,7 +754,7 @@ public:
|
|||||||
FORCE_INLINE static void run_current_screen() { status_screen(); }
|
FORCE_INLINE static void run_current_screen() { status_screen(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif // !HAS_MARLINUI_MENU
|
||||||
|
|
||||||
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
|
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
|
||||||
static bool lcd_clicked;
|
static bool lcd_clicked;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user