Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wake up on sd card and go to main screen on remove #27197

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/marlinui_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ void MarlinUI::clear_for_drawing() {
#if HAS_DISPLAY_SLEEP
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
static bool asleep = false;
if (asleep != sleep){
if (asleep != sleep) {
sleep ? u8g.sleepOn() : u8g.sleepOff();
asleep = sleep;
}
Expand Down
15 changes: 8 additions & 7 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1824,13 +1824,14 @@ void MarlinUI::host_notify(const char * const cstr) {
#endif

void MarlinUI::media_changed(const uint8_t old_status, const uint8_t status) {
TERN_(HAS_DISPLAY_SLEEP, refresh_screen_timeout());
if (old_status == status) {
TERN_(EXTENSIBLE_UI, ExtUI::onMediaError()); // Failed to mount/unmount
return;
}

if (status) {
if (old_status < 2) {
if (old_status < 2) { // Skip this section on first boot check
if (status) { // Media Mounted
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMediaMounted();
#elif ENABLED(BROWSE_MEDIA_ON_INSERT)
Expand All @@ -1841,16 +1842,16 @@ void MarlinUI::host_notify(const char * const cstr) {
LCD_MESSAGE(MSG_MEDIA_INSERTED);
#endif
}
}
else {
if (old_status < 2) {
else { // Media Removed
#if ENABLED(EXTENSIBLE_UI)
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);
#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
#elif HAS_WIRED_LCD
return_to_status();
#endif
}
}
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ class MarlinUI {
static void refresh_screen_timeout();
#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 wake_display() { sleep_display(false); }

Expand Down Expand Up @@ -743,7 +744,7 @@ class MarlinUI {

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() {}

Expand All @@ -753,7 +754,7 @@ class MarlinUI {
FORCE_INLINE static void run_current_screen() { status_screen(); }
#endif

#endif
#endif // !HAS_MARLINUI_MENU

#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
static bool lcd_clicked;
Expand Down
Loading