Ver código fonte

UBL G29 works without settings.load()

Scott Lahteine 7 anos atrás
pai
commit
e89f1453ab

+ 3
- 9
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Ver arquivo

@@ -309,12 +309,6 @@
309 309
 
310 310
   void unified_bed_leveling::G29() {
311 311
 
312
-    if (!settings.calc_num_meshes()) {
313
-      SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with");
314
-      SERIAL_PROTOCOLLNPGM("M502, M500, M501 in that order.\n");
315
-      return;
316
-    }
317
-
318 312
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
319 313
 
320 314
     // Check for commands that require the printer to be homed
@@ -1272,8 +1266,8 @@
1272 1266
       SERIAL_EOL();
1273 1267
       safe_delay(50);
1274 1268
 
1275
-      SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.get_start_of_meshes()));
1276
-      SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.get_end_of_meshes()));
1269
+      SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
1270
+      SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
1277 1271
       safe_delay(50);
1278 1272
 
1279 1273
       SERIAL_PROTOCOLLNPAIR("sizeof(ubl) :  ", (int)sizeof(ubl));
@@ -1282,7 +1276,7 @@
1282 1276
       SERIAL_EOL();
1283 1277
       safe_delay(25);
1284 1278
 
1285
-      SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.get_end_of_meshes() - settings.get_start_of_meshes())));
1279
+      SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
1286 1280
       safe_delay(50);
1287 1281
 
1288 1282
       SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());

+ 0
- 1
Marlin/src/lcd/ultralcd.cpp Ver arquivo

@@ -2309,7 +2309,6 @@ void kill_screen(const char* lcd_msg) {
2309 2309
       MENU_BACK(MSG_UBL_LEVEL_BED);
2310 2310
       if (!WITHIN(ubl_storage_slot, 0, a - 1)) {
2311 2311
         STATIC_ITEM(MSG_NO_STORAGE);
2312
-        STATIC_ITEM(MSG_INIT_EEPROM);
2313 2312
       }
2314 2313
       else {
2315 2314
         MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1);

+ 6
- 12
Marlin/src/module/configuration_store.cpp Ver arquivo

@@ -343,10 +343,6 @@ void MarlinSettings::postprocess() {
343 343
 
344 344
   bool MarlinSettings::eeprom_error, MarlinSettings::validating;
345 345
 
346
-  #if ENABLED(AUTO_BED_LEVELING_UBL)
347
-    int16_t MarlinSettings::meshes_begin;
348
-  #endif
349
-
350 346
   bool MarlinSettings::size_error(const uint16_t size) {
351 347
     if (size != datasize()) {
352 348
       SERIAL_ERROR_START();
@@ -1337,9 +1333,6 @@ void MarlinSettings::postprocess() {
1337 1333
       }
1338 1334
 
1339 1335
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1340
-        meshes_begin = (eeprom_index + 32) & 0xFFF8;  // Pad the end of configuration data so it
1341
-                                                      // can float up or down a little bit without
1342
-                                                      // disrupting the mesh data
1343 1336
         ubl.report_state();
1344 1337
 
1345 1338
         if (!validating) {
@@ -1408,12 +1401,13 @@ void MarlinSettings::postprocess() {
1408 1401
       }
1409 1402
     #endif
1410 1403
 
1411
-    uint16_t MarlinSettings::calc_num_meshes() {
1412
-      //obviously this will get more sophisticated once we've added an actual MAT
1413
-
1414
-      if (meshes_begin <= 0) return 0;
1404
+    int16_t MarlinSettings::meshes_start_index() {
1405
+      return (datasize() + EEPROM_OFFSET + 32) & 0xFFF8;  // Pad the end of configuration data so it can float up
1406
+                                                          // or down a little bit without disrupting the mesh data
1407
+    }
1415 1408
 
1416
-      return (meshes_end - meshes_begin) / sizeof(ubl.z_values);
1409
+    uint16_t MarlinSettings::calc_num_meshes() {
1410
+      return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
1417 1411
     }
1418 1412
 
1419 1413
     void MarlinSettings::store_mesh(const int8_t slot) {

+ 6
- 10
Marlin/src/module/configuration_store.h Ver arquivo

@@ -38,13 +38,10 @@ class MarlinSettings {
38 38
       bool success = true;
39 39
       reset();
40 40
       #if ENABLED(EEPROM_SETTINGS)
41
-        if ((success = save())) {
42
-          #if ENABLED(AUTO_BED_LEVELING_UBL)
43
-            success = load(); // UBL uses load() to know the end of EEPROM
44
-          #elif ENABLED(EEPROM_CHITCHAT)
45
-            report();
46
-          #endif
47
-        }
41
+        success = save();
42
+        #if ENABLED(EEPROM_CHITCHAT)
43
+          if (success) report();
44
+        #endif
48 45
       #endif
49 46
       return success;
50 47
     }
@@ -55,8 +52,8 @@ class MarlinSettings {
55 52
 
56 53
       #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
57 54
                                          // That can store is enabled
58
-        FORCE_INLINE static int16_t get_start_of_meshes() { return meshes_begin; }
59
-        FORCE_INLINE static int16_t get_end_of_meshes() { return meshes_end; }
55
+        static int16_t meshes_start_index();
56
+        FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
60 57
         static uint16_t calc_num_meshes();
61 58
         static void store_mesh(const int8_t slot);
62 59
         static void load_mesh(const int8_t slot, void * const into=NULL);
@@ -85,7 +82,6 @@ class MarlinSettings {
85 82
 
86 83
       #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
87 84
                                          // That can store is enabled
88
-        static int16_t meshes_begin;
89 85
         const static int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
90 86
                                                        // live at the very end of the eeprom
91 87
 

Carregando…
Cancelar
Salvar