From 6217329d509c57a7f3b3ea526e903f4efdf385fc Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 6 Mar 2019 19:51:26 +0100 Subject: [PATCH] SD card menu enhancement --- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 7943d220..029cf0c6 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -52,6 +52,7 @@ const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 r=0 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 r=0 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////c=0 r=0 +const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////c=0 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 r=0 const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); ////c=0 r=0 diff --git a/Firmware/messages.h b/Firmware/messages.h index ce6ecdd7..5083b26d 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -53,6 +53,7 @@ extern const char MSG_LOAD_FILAMENT[]; extern const char MSG_LOADING_FILAMENT[]; extern const char MSG_M117_V2_CALIBRATION[]; extern const char MSG_MAIN[]; +extern const char MSG_BACK[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[]; extern const char MSG_MENU_CALIBRATION[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb785..5dae2090 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5292,9 +5292,9 @@ do\ EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));\ switch (sdSort)\ {\ - case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ - case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ - default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ + case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ + case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ + default: MENU_ITEM_FUNCTION_P(_i("Sort [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ }\ }\ }\ @@ -6725,10 +6725,7 @@ void lcd_sdcard_menu() MENU_BEGIN(); - if(bMain) // i.e. default menu-item - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - else // i.e. menu-item after card insertion - MENU_ITEM_FUNCTION_P(_T(MSG_WATCH),lcd_return_to_status); + MENU_ITEM_BACK_P(_T(bMain?MSG_MAIN:MSG_BACK)); // i.e. default menu-item / menu-item after card insertion card.getWorkDirName(); if (card.filename[0] == '/') { @@ -8148,6 +8145,8 @@ void menu_lcd_lcdupdate_func(void) } else { + if(menu_menu==lcd_sdcard_menu) + menu_back(); card.release(); LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED c=0 r=0 } @@ -8192,4 +8191,3 @@ void menu_lcd_lcdupdate_func(void) lcd_send_status(); if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); } -