Browse Source

Save ABL Planar Matrix to EEPROM

Scott Lahteine 8 years ago
parent
commit
8f0f225d10
2 changed files with 61 additions and 36 deletions
  1. 1
    1
      Marlin/Marlin_main.cpp
  2. 60
    35
      Marlin/configuration_store.cpp

+ 1
- 1
Marlin/Marlin_main.cpp View File

2229
    * Disable: Current position = physical position
2229
    * Disable: Current position = physical position
2230
    *  Enable: Current position = "unleveled" physical position
2230
    *  Enable: Current position = "unleveled" physical position
2231
    */
2231
    */
2232
-  void set_bed_leveling_enabled(bool enable=true) {
2232
+  void set_bed_leveling_enabled(bool enable/*=true*/) {
2233
     #if ENABLED(MESH_BED_LEVELING)
2233
     #if ENABLED(MESH_BED_LEVELING)
2234
 
2234
 
2235
       if (enable != mbl.active()) {
2235
       if (enable != mbl.active()) {

+ 60
- 35
Marlin/configuration_store.cpp View File

74
  * AUTO BED LEVELING
74
  * AUTO BED LEVELING
75
  *  262  M851      zprobe_zoffset (float)
75
  *  262  M851      zprobe_zoffset (float)
76
  *
76
  *
77
+ * ABL_PLANAR (or placeholder):                    36 bytes
78
+ *  266            planner.bed_level_matrix        (matrix_3x3 = float x9)
79
+ *
77
  * AUTO_BED_LEVELING_BILINEAR (or placeholder):    47 bytes
80
  * AUTO_BED_LEVELING_BILINEAR (or placeholder):    47 bytes
78
- *  266            ABL_GRID_MAX_POINTS_X           (uint8_t)
79
- *  267            ABL_GRID_MAX_POINTS_Y           (uint8_t)
80
- *  268            bilinear_grid_spacing           (int x2)   from G29: (B-F)/X, (R-L)/Y
81
- *  272  G29 L F   bilinear_start                  (int x2)
82
- *  276            bed_level_grid[][]              (float x9, up to float x256) +988
81
+ *  302            ABL_GRID_MAX_POINTS_X           (uint8_t)
82
+ *  303            ABL_GRID_MAX_POINTS_Y           (uint8_t)
83
+ *  304            bilinear_grid_spacing           (int x2)   from G29: (B-F)/X, (R-L)/Y
84
+ *  308  G29 L F   bilinear_start                  (int x2)
85
+ *  312            bed_level_grid[][]              (float x9, up to float x256) +988
83
  *
86
  *
84
  * DELTA (if deltabot):                            36 bytes
87
  * DELTA (if deltabot):                            36 bytes
85
- *  312  M666 XYZ  endstop_adj                     (float x3)
86
- *  324  M665 R    delta_radius                    (float)
87
- *  328  M665 L    delta_diagonal_rod              (float)
88
- *  332  M665 S    delta_segments_per_second       (float)
89
- *  336  M665 A    delta_diagonal_rod_trim_tower_1 (float)
90
- *  340  M665 B    delta_diagonal_rod_trim_tower_2 (float)
91
- *  344  M665 C    delta_diagonal_rod_trim_tower_3 (float)
88
+ *  348  M666 XYZ  endstop_adj                     (float x3)
89
+ *  360  M665 R    delta_radius                    (float)
90
+ *  364  M665 L    delta_diagonal_rod              (float)
91
+ *  368  M665 S    delta_segments_per_second       (float)
92
+ *  372  M665 A    delta_diagonal_rod_trim_tower_1 (float)
93
+ *  376  M665 B    delta_diagonal_rod_trim_tower_2 (float)
94
+ *  380  M665 C    delta_diagonal_rod_trim_tower_3 (float)
92
  *
95
  *
93
  * Z_DUAL_ENDSTOPS:                                4 bytes
96
  * Z_DUAL_ENDSTOPS:                                4 bytes
94
- *  348  M666 Z    z_endstop_adj                   (float)
97
+ *  384  M666 Z    z_endstop_adj                   (float)
95
  *
98
  *
96
  * ULTIPANEL:                                      6 bytes
99
  * ULTIPANEL:                                      6 bytes
97
- *  352  M145 S0 H lcd_preheat_hotend_temp         (int x2)
98
- *  356  M145 S0 B lcd_preheat_bed_temp            (int x2)
99
- *  360  M145 S0 F lcd_preheat_fan_speed           (int x2)
100
+ *  388  M145 S0 H lcd_preheat_hotend_temp         (int x2)
101
+ *  392  M145 S0 B lcd_preheat_bed_temp            (int x2)
102
+ *  396  M145 S0 F lcd_preheat_fan_speed           (int x2)
100
  *
103
  *
101
  * PIDTEMP:                                        66 bytes
104
  * PIDTEMP:                                        66 bytes
102
- *  364  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0]  (float x4)
103
- *  380  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1]  (float x4)
104
- *  396  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2]  (float x4)
105
- *  412  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3]  (float x4)
106
- *  428  M301 L        lpq_len                     (int)
105
+ *  400  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0]  (float x4)
106
+ *  416  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1]  (float x4)
107
+ *  432  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2]  (float x4)
108
+ *  448  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3]  (float x4)
109
+ *  464  M301 L        lpq_len                     (int)
107
  *
110
  *
108
  * PIDTEMPBED:
111
  * PIDTEMPBED:
109
- *  430  M304 PID  thermalManager.bedKp, thermalManager.bedKi, thermalManager.bedKd (float x3)
112
+ *  466  M304 PID  thermalManager.bedKp, thermalManager.bedKi, thermalManager.bedKd (float x3)
110
  *
113
  *
111
  * DOGLCD:                                          2 bytes
114
  * DOGLCD:                                          2 bytes
112
- *  442  M250 C    lcd_contrast                     (int)
115
+ *  478  M250 C    lcd_contrast                     (int)
113
  *
116
  *
114
  * FWRETRACT:                                       29 bytes
117
  * FWRETRACT:                                       29 bytes
115
- *  444  M209 S    autoretract_enabled              (bool)
116
- *  445  M207 S    retract_length                   (float)
117
- *  449  M207 W    retract_length_swap              (float)
118
- *  453  M207 F    retract_feedrate_mm_s            (float)
119
- *  457  M207 Z    retract_zlift                    (float)
120
- *  461  M208 S    retract_recover_length           (float)
121
- *  465  M208 W    retract_recover_length_swap      (float)
122
- *  469  M208 F    retract_recover_feedrate_mm_s    (float)
118
+ *  480  M209 S    autoretract_enabled              (bool)
119
+ *  481  M207 S    retract_length                   (float)
120
+ *  485  M207 W    retract_length_swap              (float)
121
+ *  489  M207 F    retract_feedrate_mm_s            (float)
122
+ *  493  M207 Z    retract_zlift                    (float)
123
+ *  497  M208 S    retract_recover_length           (float)
124
+ *  501  M208 W    retract_recover_length_swap      (float)
125
+ *  505  M208 F    retract_recover_feedrate_mm_s    (float)
123
  *
126
  *
124
  * Volumetric Extrusion:                            17 bytes
127
  * Volumetric Extrusion:                            17 bytes
125
- *  473  M200 D    volumetric_enabled               (bool)
126
- *  474  M200 T D  filament_size                    (float x4) (T0..3)
128
+ *  509  M200 D    volumetric_enabled               (bool)
129
+ *  510  M200 T D  filament_size                    (float x4) (T0..3)
127
  *
130
  *
128
- *  490                                Minimum end-point
129
- * 1811 (490 + 36 + 9 + 288 + 988)     Maximum end-point
131
+ *  526                                Minimum end-point
132
+ * 1847 (526 + 36 + 9 + 288 + 988)     Maximum end-point
130
  *
133
  *
131
  */
134
  */
132
 #include "Marlin.h"
135
 #include "Marlin.h"
288
     EEPROM_WRITE(zprobe_zoffset);
291
     EEPROM_WRITE(zprobe_zoffset);
289
 
292
 
290
     //
293
     //
294
+    // Planar Bed Leveling matrix
295
+    //
296
+
297
+    #if ABL_PLANAR
298
+      EEPROM_WRITE(planner.bed_level_matrix);
299
+    #else
300
+      dummy = 0.0;
301
+      for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
302
+    #endif
303
+
304
+    //
291
     // Bilinear Auto Bed Leveling
305
     // Bilinear Auto Bed Leveling
292
     //
306
     //
293
 
307
 
526
       EEPROM_READ(zprobe_zoffset);
540
       EEPROM_READ(zprobe_zoffset);
527
 
541
 
528
       //
542
       //
543
+      // Planar Bed Leveling matrix
544
+      //
545
+
546
+      #if ABL_PLANAR
547
+        EEPROM_READ(planner.bed_level_matrix);
548
+      #else
549
+        for (uint8_t q = 9; q--;) EEPROM_READ(dummy);
550
+      #endif
551
+
552
+      //
529
       // Bilinear Auto Bed Leveling
553
       // Bilinear Auto Bed Leveling
530
       //
554
       //
531
 
555
 
542
             bed_level_virt_prepare();
566
             bed_level_virt_prepare();
543
             bed_level_virt_interpolate();
567
             bed_level_virt_interpolate();
544
           #endif
568
           #endif
569
+          //set_bed_leveling_enabled(leveling_is_on);
545
         }
570
         }
546
         else // EEPROM data is stale
571
         else // EEPROM data is stale
547
       #endif // AUTO_BED_LEVELING_BILINEAR
572
       #endif // AUTO_BED_LEVELING_BILINEAR

Loading…
Cancel
Save