Browse Source

Extra comments to clarify EEPROM code

Scott Lahteine 8 years ago
parent
commit
6b2a7b30af
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      Marlin/configuration_store.cpp

+ 7
- 1
Marlin/configuration_store.cpp View File

@@ -226,6 +226,7 @@ void Config_StoreSettings()  {
226 226
     EEPROM_WRITE_VAR(i, mesh_num_y);
227 227
     EEPROM_WRITE_VAR(i, mbl.z_values);
228 228
   #else
229
+    // For disabled MBL write a default mesh
229 230
     uint8_t mesh_num_x = 3,
230 231
             mesh_num_y = 3,
231 232
             dummy_uint8 = 0;
@@ -242,6 +243,7 @@ void Config_StoreSettings()  {
242 243
   #endif
243 244
   EEPROM_WRITE_VAR(i, zprobe_zoffset);
244 245
 
246
+  // 9 floats for DELTA / Z_DUAL_ENDSTOPS
245 247
   #if ENABLED(DELTA)
246 248
     EEPROM_WRITE_VAR(i, endstop_adj);               // 3 floats
247 249
     EEPROM_WRITE_VAR(i, delta_radius);              // 1 float
@@ -409,12 +411,16 @@ void Config_RetrieveSettings() {
409 411
       mbl.status = dummy_uint8;
410 412
       mbl.z_offset = dummy;
411 413
       if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
414
+        // EEPROM data fits the current mesh
412 415
         EEPROM_READ_VAR(i, mbl.z_values);
413
-      } else {
416
+      }
417
+      else {
418
+        // EEPROM data is stale
414 419
         mbl.reset();
415 420
         for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ_VAR(i, dummy);
416 421
       }
417 422
     #else
423
+      // MBL is disabled - skip the stored data
418 424
       for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ_VAR(i, dummy);
419 425
     #endif // MESH_BED_LEVELING
420 426
 

Loading…
Cancel
Save