Browse Source

UBL_LCD_storage_corrections (#7517)

Correcting the storage selection.
Also EEPROM error handling on the LCD.
Tannoo 7 years ago
parent
commit
ab2ac1af71
1 changed files with 16 additions and 5 deletions
  1. 16
    5
      Marlin/ultralcd.cpp

+ 16
- 5
Marlin/ultralcd.cpp View File

@@ -2118,18 +2118,22 @@ void kill_screen(const char* lcd_msg) {
2118 2118
      * UBL Load Mesh Command
2119 2119
      */
2120 2120
     void _lcd_ubl_load_mesh_cmd() {
2121
-      char UBL_LCD_GCODE[8];
2121
+      char UBL_LCD_GCODE[25];
2122 2122
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
2123 2123
       enqueue_and_echo_command(UBL_LCD_GCODE);
2124
+      sprintf_P(UBL_LCD_GCODE, PSTR("M117 Map %i loaded."), ubl_storage_slot);
2125
+      enqueue_and_echo_command(UBL_LCD_GCODE);
2124 2126
     }
2125 2127
 
2126 2128
     /**
2127 2129
      * UBL Save Mesh Command
2128 2130
      */
2129 2131
     void _lcd_ubl_save_mesh_cmd() {
2130
-      char UBL_LCD_GCODE[8];
2132
+      char UBL_LCD_GCODE[25];
2131 2133
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
2132 2134
       enqueue_and_echo_command(UBL_LCD_GCODE);
2135
+      sprintf_P(UBL_LCD_GCODE, PSTR("M117 Map %i saved."), ubl_storage_slot);
2136
+      enqueue_and_echo_command(UBL_LCD_GCODE);
2133 2137
     }
2134 2138
 
2135 2139
     /**
@@ -2141,11 +2145,18 @@ void kill_screen(const char* lcd_msg) {
2141 2145
      *    Save Bed Mesh
2142 2146
      */
2143 2147
     void _lcd_ubl_storage_mesh() {
2148
+      int16_t a = settings.calc_num_meshes();
2144 2149
       START_MENU();
2145 2150
       MENU_BACK(MSG_UBL_LEVEL_BED);
2146
-      MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, 9);
2147
-      MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd);
2148
-      MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
2151
+      if (!WITHIN(ubl_storage_slot, 0, a - 1)) {
2152
+        STATIC_ITEM("No storage");
2153
+        STATIC_ITEM("Initialize EEPROM");
2154
+      }
2155
+      else {
2156
+        MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1);
2157
+        MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd);
2158
+        MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
2159
+      }
2149 2160
       END_MENU();
2150 2161
     }
2151 2162
 

Loading…
Cancel
Save