瀏覽代碼

Cleaner failure of UBL without EEPROM

Scott Lahteine 8 年之前
父節點
當前提交
dac29e0f75
共有 1 個檔案被更改,包括 29 行新增20 行删除
  1. 29
    20
      Marlin/Marlin_main.cpp

+ 29
- 20
Marlin/Marlin_main.cpp 查看文件

8866
   inline void gcode_M420() {
8866
   inline void gcode_M420() {
8867
 
8867
 
8868
     #if ENABLED(AUTO_BED_LEVELING_UBL)
8868
     #if ENABLED(AUTO_BED_LEVELING_UBL)
8869
+
8869
       // L to load a mesh from the EEPROM
8870
       // L to load a mesh from the EEPROM
8870
       if (parser.seen('L')) {
8871
       if (parser.seen('L')) {
8871
-        const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.state.storage_slot;
8872
-        const int16_t a = settings.calc_num_meshes();
8873
 
8872
 
8874
-        if (!a) {
8873
+        #if ENABLED(EEPROM_SETTINGS)
8874
+          const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.state.storage_slot;
8875
+          const int16_t a = settings.calc_num_meshes();
8876
+
8877
+          if (!a) {
8878
+            SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
8879
+            return;
8880
+          }
8881
+
8882
+          if (!WITHIN(storage_slot, 0, a - 1)) {
8883
+            SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
8884
+            SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
8885
+            return;
8886
+          }
8887
+
8888
+          settings.load_mesh(storage_slot);
8889
+          ubl.state.storage_slot = storage_slot;
8890
+
8891
+        #else
8892
+
8875
           SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
8893
           SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
8876
           return;
8894
           return;
8877
-        }
8878
 
8895
 
8879
-        if (!WITHIN(storage_slot, 0, a - 1)) {
8880
-          SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
8881
-          SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
8882
-          return;
8883
-        }
8896
+        #endif
8897
+      }
8884
 
8898
 
8885
-        settings.load_mesh(storage_slot);
8886
-        ubl.state.storage_slot = storage_slot;
8899
+      // L to load a mesh from the EEPROM
8900
+      if (parser.seen('L') || parser.seen('V')) {
8901
+        ubl.display_map(0);  // Currently only supports one map type
8902
+        SERIAL_ECHOLNPAIR("UBL_MESH_VALID = ", UBL_MESH_VALID);
8903
+        SERIAL_ECHOLNPAIR("ubl.state.storage_slot = ", ubl.state.storage_slot);
8887
       }
8904
       }
8905
+
8888
     #endif // AUTO_BED_LEVELING_UBL
8906
     #endif // AUTO_BED_LEVELING_UBL
8889
 
8907
 
8890
     // V to print the matrix or mesh
8908
     // V to print the matrix or mesh
8906
       #endif
8924
       #endif
8907
     }
8925
     }
8908
 
8926
 
8909
-    #if ENABLED(AUTO_BED_LEVELING_UBL)
8910
-      // L to load a mesh from the EEPROM
8911
-      if (parser.seen('L') || parser.seen('V')) {
8912
-        ubl.display_map(0);  // Currently only supports one map type
8913
-        SERIAL_ECHOLNPAIR("UBL_MESH_VALID = ", UBL_MESH_VALID);
8914
-        SERIAL_ECHOLNPAIR("ubl.state.storage_slot = ", ubl.state.storage_slot);
8915
-      }
8916
-    #endif
8917
-
8918
     bool to_enable = false;
8927
     bool to_enable = false;
8919
     if (parser.seen('S')) {
8928
     if (parser.seen('S')) {
8920
       to_enable = parser.value_bool();
8929
       to_enable = parser.value_bool();

Loading…
取消
儲存