Przeglądaj źródła

Merge pull request #6283 from thinkyhead/rc_eeprom_z_fade

Save / restore z_fade_height in EEPROM
Scott Lahteine 8 lat temu
rodzic
commit
67fb7f82ac

+ 4
- 0
Marlin/Marlin.h Wyświetl plik

307
   void reset_bed_level();
307
   void reset_bed_level();
308
 #endif
308
 #endif
309
 
309
 
310
+#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
311
+  void set_z_fade_height(const float zfh);
312
+#endif
313
+
310
 #if ENABLED(Z_DUAL_ENDSTOPS)
314
 #if ENABLED(Z_DUAL_ENDSTOPS)
311
   extern float z_endstop_adj;
315
   extern float z_endstop_adj;
312
 #endif
316
 #endif

+ 6
- 6
Marlin/Marlin_main.cpp Wyświetl plik

573
         endstop_adj[ABC] = { 0 };
573
         endstop_adj[ABC] = { 0 };
574
 
574
 
575
   // These values are loaded or reset at boot time when setup() calls
575
   // These values are loaded or reset at boot time when setup() calls
576
-  // Config_RetrieveSettings(), which calls recalc_delta_settings().
576
+  // settings.load(), which calls recalc_delta_settings().
577
   float delta_radius,
577
   float delta_radius,
578
         delta_tower_angle_trim[ABC],
578
         delta_tower_angle_trim[ABC],
579
         delta_tower[ABC][2],
579
         delta_tower[ABC][2],
7898
  * M500: Store settings in EEPROM
7898
  * M500: Store settings in EEPROM
7899
  */
7899
  */
7900
 inline void gcode_M500() {
7900
 inline void gcode_M500() {
7901
-  (void)Config_StoreSettings();
7901
+  (void)settings.save();
7902
 }
7902
 }
7903
 
7903
 
7904
 /**
7904
 /**
7905
  * M501: Read settings from EEPROM
7905
  * M501: Read settings from EEPROM
7906
  */
7906
  */
7907
 inline void gcode_M501() {
7907
 inline void gcode_M501() {
7908
-  (void)Config_RetrieveSettings();
7908
+  (void)settings.load();
7909
 }
7909
 }
7910
 
7910
 
7911
 /**
7911
 /**
7912
  * M502: Revert to default settings
7912
  * M502: Revert to default settings
7913
  */
7913
  */
7914
 inline void gcode_M502() {
7914
 inline void gcode_M502() {
7915
-  (void)Config_ResetDefault();
7915
+  (void)settings.reset();
7916
 }
7916
 }
7917
 
7917
 
7918
 /**
7918
 /**
7919
  * M503: print settings currently in memory
7919
  * M503: print settings currently in memory
7920
  */
7920
  */
7921
 inline void gcode_M503() {
7921
 inline void gcode_M503() {
7922
-  (void)Config_PrintSettings(code_seen('S') && !code_value_bool());
7922
+  (void)settings.report(code_seen('S') && !code_value_bool());
7923
 }
7923
 }
7924
 
7924
 
7925
 #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
7925
 #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
11343
 
11343
 
11344
   // Load data from EEPROM if available (or use defaults)
11344
   // Load data from EEPROM if available (or use defaults)
11345
   // This also updates variables in the planner, elsewhere
11345
   // This also updates variables in the planner, elsewhere
11346
-  (void)Config_RetrieveSettings();
11346
+  (void)settings.load();
11347
 
11347
 
11348
   #if DISABLED(NO_WORKSPACE_OFFSETS)
11348
   #if DISABLED(NO_WORKSPACE_OFFSETS)
11349
     // Initialize current position based on home_offset
11349
     // Initialize current position based on home_offset

+ 117
- 55
Marlin/configuration_store.cpp Wyświetl plik

23
 /**
23
 /**
24
  * configuration_store.cpp
24
  * configuration_store.cpp
25
  *
25
  *
26
- * Configuration and EEPROM storage
26
+ * Settings and EEPROM storage
27
  *
27
  *
28
  * IMPORTANT:  Whenever there are changes made to the variables stored in EEPROM
28
  * IMPORTANT:  Whenever there are changes made to the variables stored in EEPROM
29
  * in the functions below, also increment the version number. This makes sure that
29
  * in the functions below, also increment the version number. This makes sure that
36
  *
36
  *
37
  */
37
  */
38
 
38
 
39
-#define EEPROM_VERSION "V32"
39
+#define EEPROM_VERSION "V33"
40
 
40
 
41
 // Change EEPROM version if these are changed:
41
 // Change EEPROM version if these are changed:
42
 #define EEPROM_OFFSET 100
42
 #define EEPROM_OFFSET 100
43
 
43
 
44
 /**
44
 /**
45
- * V32 EEPROM Layout:
45
+ * V33 EEPROM Layout:
46
  *
46
  *
47
  *  100  Version                                    (char x4)
47
  *  100  Version                                    (char x4)
48
  *  104  EEPROM Checksum                            (uint16_t)
48
  *  104  EEPROM Checksum                            (uint16_t)
64
  *  195  M206 XYZ  home_offset                      (float x3)
64
  *  195  M206 XYZ  home_offset                      (float x3)
65
  *  207  M218 XYZ  hotend_offset                    (float x3 per additional hotend)
65
  *  207  M218 XYZ  hotend_offset                    (float x3 per additional hotend)
66
  *
66
  *
67
+ * Global Leveling:
68
+ *  219            z_fade_height                    (float)
69
+ *
67
  * Mesh bed leveling:                               43 bytes
70
  * Mesh bed leveling:                               43 bytes
68
- *  219  M420 S    from mbl.status                  (bool)
69
- *  220            mbl.z_offset                     (float)
70
- *  224            GRID_MAX_POINTS_X                (uint8_t)
71
- *  225            GRID_MAX_POINTS_Y                (uint8_t)
72
- *  226 G29 S3 XYZ z_values[][]                     (float x9, up to float x 81) +288
71
+ *  223  M420 S    from mbl.status                  (bool)
72
+ *  224            mbl.z_offset                     (float)
73
+ *  228            GRID_MAX_POINTS_X                (uint8_t)
74
+ *  229            GRID_MAX_POINTS_Y                (uint8_t)
75
+ *  230 G29 S3 XYZ z_values[][]                     (float x9, up to float x 81) +288
73
  *
76
  *
74
  * AUTO BED LEVELING                                4 bytes
77
  * AUTO BED LEVELING                                4 bytes
75
- *  262  M851      zprobe_zoffset                   (float)
78
+ *  266  M851      zprobe_zoffset                   (float)
76
  *
79
  *
77
  * ABL_PLANAR (or placeholder):                     36 bytes
80
  * ABL_PLANAR (or placeholder):                     36 bytes
78
- *  266            planner.bed_level_matrix         (matrix_3x3 = float x9)
81
+ *  270            planner.bed_level_matrix         (matrix_3x3 = float x9)
79
  *
82
  *
80
  * AUTO_BED_LEVELING_BILINEAR (or placeholder):     47 bytes
83
  * AUTO_BED_LEVELING_BILINEAR (or placeholder):     47 bytes
81
- *  302            GRID_MAX_POINTS_X                (uint8_t)
82
- *  303            GRID_MAX_POINTS_Y                (uint8_t)
83
- *  304            bilinear_grid_spacing            (int x2)
84
- *  308  G29 L F   bilinear_start                   (int x2)
85
- *  312            bed_level_grid[][]               (float x9, up to float x256) +988
84
+ *  306            GRID_MAX_POINTS_X                (uint8_t)
85
+ *  307            GRID_MAX_POINTS_Y                (uint8_t)
86
+ *  308            bilinear_grid_spacing            (int x2)
87
+ *  312  G29 L F   bilinear_start                   (int x2)
88
+ *  316            bed_level_grid[][]               (float x9, up to float x256) +988
86
  *
89
  *
87
  * DELTA (if deltabot):                             48 bytes
90
  * DELTA (if deltabot):                             48 bytes
88
  *  348  M666 XYZ  endstop_adj                      (float x3)
91
  *  348  M666 XYZ  endstop_adj                      (float x3)
144
  *  568  M906 E1   stepperE1 current                (uint16_t)
147
  *  568  M906 E1   stepperE1 current                (uint16_t)
145
  *  570  M906 E2   stepperE2 current                (uint16_t)
148
  *  570  M906 E2   stepperE2 current                (uint16_t)
146
  *  572  M906 E3   stepperE3 current                (uint16_t)
149
  *  572  M906 E3   stepperE3 current                (uint16_t)
147
- *  572  M906 E4   stepperE4 current                (uint16_t)
150
+ *  576  M906 E4   stepperE4 current                (uint16_t)
148
  *
151
  *
149
- *  576                                Minimum end-point
150
- * 1897 (576 + 36 + 9 + 288 + 988)     Maximum end-point
152
+ *  580                                Minimum end-point
153
+ * 1901 (580 + 36 + 9 + 288 + 988)     Maximum end-point
151
  */
154
  */
155
+#include "configuration_store.h"
156
+
157
+MarlinSettings settings;
158
+
152
 #include "Marlin.h"
159
 #include "Marlin.h"
153
 #include "language.h"
160
 #include "language.h"
154
 #include "endstops.h"
161
 #include "endstops.h"
155
 #include "planner.h"
162
 #include "planner.h"
156
 #include "temperature.h"
163
 #include "temperature.h"
157
 #include "ultralcd.h"
164
 #include "ultralcd.h"
158
-#include "configuration_store.h"
159
 
165
 
160
 #if ENABLED(MESH_BED_LEVELING)
166
 #if ENABLED(MESH_BED_LEVELING)
161
   #include "mesh_bed_leveling.h"
167
   #include "mesh_bed_leveling.h"
176
 /**
182
 /**
177
  * Post-process after Retrieve or Reset
183
  * Post-process after Retrieve or Reset
178
  */
184
  */
179
-void Config_Postprocess() {
185
+void MarlinSettings::postprocess() {
180
   // steps per s2 needs to be updated to agree with units per s2
186
   // steps per s2 needs to be updated to agree with units per s2
181
   planner.reset_acceleration_rates();
187
   planner.reset_acceleration_rates();
182
 
188
 
200
     // Software endstops depend on home_offset
206
     // Software endstops depend on home_offset
201
     LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
207
     LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
202
   #endif
208
   #endif
209
+
210
+  #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
211
+    set_z_fade_height(
212
+      //#if ENABLED(AUTO_BED_LEVELING_UBL)
213
+      //  ubl.state.g29_correction_fade_height
214
+      //#else
215
+        planner.z_fade_height
216
+      //#endif
217
+    );
218
+  #endif
203
 }
219
 }
204
 
220
 
205
 #if ENABLED(EEPROM_SETTINGS)
221
 #if ENABLED(EEPROM_SETTINGS)
206
 
222
 
207
-  uint16_t eeprom_checksum;
208
   const char version[4] = EEPROM_VERSION;
223
   const char version[4] = EEPROM_VERSION;
209
 
224
 
210
-  bool eeprom_write_error;
225
+  uint16_t MarlinSettings::eeprom_checksum;
211
 
226
 
212
-  void _EEPROM_writeData(int &pos, const uint8_t* value, uint16_t size) {
227
+  bool MarlinSettings::eeprom_write_error,
228
+       MarlinSettings::eeprom_read_error;
229
+
230
+  void MarlinSettings::write_data(int &pos, const uint8_t* value, uint16_t size) {
213
     if (eeprom_write_error) return;
231
     if (eeprom_write_error) return;
214
     while (size--) {
232
     while (size--) {
215
       uint8_t * const p = (uint8_t * const)pos;
233
       uint8_t * const p = (uint8_t * const)pos;
230
       value++;
248
       value++;
231
     };
249
     };
232
   }
250
   }
233
-  bool eeprom_read_error;
234
-  void _EEPROM_readData(int &pos, uint8_t* value, uint16_t size) {
251
+  void MarlinSettings::read_data(int &pos, uint8_t* value, uint16_t size) {
235
     do {
252
     do {
236
       uint8_t c = eeprom_read_byte((unsigned char*)pos);
253
       uint8_t c = eeprom_read_byte((unsigned char*)pos);
237
       if (!eeprom_read_error) *value = c;
254
       if (!eeprom_read_error) *value = c;
244
   #define DUMMY_PID_VALUE 3000.0f
261
   #define DUMMY_PID_VALUE 3000.0f
245
   #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
262
   #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
246
   #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
263
   #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
247
-  #define EEPROM_WRITE(VAR) _EEPROM_writeData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
248
-  #define EEPROM_READ(VAR) _EEPROM_readData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
249
-  #define EEPROM_ASSERT(TST,ERR) if () do{ SERIAL_ERROR_START; SERIAL_ERRORLNPGM(ERR); eeprom_read_error |= true; }while(0)
264
+  #define EEPROM_WRITE(VAR) write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
265
+  #define EEPROM_READ(VAR) read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
266
+  #define EEPROM_ASSERT(TST,ERR) if (!(TST)) do{ SERIAL_ERROR_START; SERIAL_ERRORLNPGM(ERR); eeprom_read_error = true; }while(0)
250
 
267
 
251
   /**
268
   /**
252
    * M500 - Store Configuration
269
    * M500 - Store Configuration
253
    */
270
    */
254
-  bool Config_StoreSettings() {
271
+  bool MarlinSettings::save() {
255
     float dummy = 0.0f;
272
     float dummy = 0.0f;
256
     char ver[4] = "000";
273
     char ver[4] = "000";
257
 
274
 
290
     #endif
307
     #endif
291
 
308
 
292
     //
309
     //
310
+    // General Leveling
311
+    //
312
+
313
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
314
+      EEPROM_WRITE(planner.z_fade_height);
315
+    #else
316
+      dummy = 10.0;
317
+      EEPROM_WRITE(dummy);
318
+    #endif
319
+
320
+    //
293
     // Mesh Bed Leveling
321
     // Mesh Bed Leveling
294
     //
322
     //
295
 
323
 
552
   /**
580
   /**
553
    * M501 - Retrieve Configuration
581
    * M501 - Retrieve Configuration
554
    */
582
    */
555
-  bool Config_RetrieveSettings() {
583
+  bool MarlinSettings::load() {
556
 
584
 
557
     EEPROM_START();
585
     EEPROM_START();
558
     eeprom_read_error = false; // If set EEPROM_READ won't write into RAM
586
     eeprom_read_error = false; // If set EEPROM_READ won't write into RAM
573
       SERIAL_ECHOPGM("EEPROM version mismatch ");
601
       SERIAL_ECHOPGM("EEPROM version mismatch ");
574
       SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
602
       SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
575
       SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
603
       SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
576
-      Config_ResetDefault();
604
+      reset();
577
     }
605
     }
578
     else {
606
     else {
579
       float dummy = 0;
607
       float dummy = 0;
619
       #endif
647
       #endif
620
 
648
 
621
       //
649
       //
650
+      // General Leveling
651
+      //
652
+
653
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
654
+        EEPROM_READ(planner.z_fade_height);
655
+      #else
656
+        EEPROM_READ(dummy);
657
+      #endif
658
+
659
+      //
622
       // Mesh (Manual) Bed Leveling
660
       // Mesh (Manual) Bed Leveling
623
       //
661
       //
624
 
662
 
713
       EEPROM_READ(lcd_preheat_bed_temp);
751
       EEPROM_READ(lcd_preheat_bed_temp);
714
       EEPROM_READ(lcd_preheat_fan_speed);
752
       EEPROM_READ(lcd_preheat_fan_speed);
715
 
753
 
754
+      //EEPROM_ASSERT(
755
+      //  WITHIN(lcd_preheat_fan_speed, 0, 255),
756
+      //  "lcd_preheat_fan_speed out of range"
757
+      //);
758
+
716
       #if ENABLED(PIDTEMP)
759
       #if ENABLED(PIDTEMP)
717
         for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
760
         for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
718
           EEPROM_READ(dummy); // Kp
761
           EEPROM_READ(dummy); // Kp
835
 
878
 
836
       if (eeprom_checksum == stored_checksum) {
879
       if (eeprom_checksum == stored_checksum) {
837
         if (eeprom_read_error)
880
         if (eeprom_read_error)
838
-          Config_ResetDefault();
881
+          reset();
839
         else {
882
         else {
840
-          Config_Postprocess();
883
+          postprocess();
841
           SERIAL_ECHO_START;
884
           SERIAL_ECHO_START;
842
           SERIAL_ECHO(version);
885
           SERIAL_ECHO(version);
843
           SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
886
           SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
847
       else {
890
       else {
848
         SERIAL_ERROR_START;
891
         SERIAL_ERROR_START;
849
         SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
892
         SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
850
-        Config_ResetDefault();
893
+        reset();
851
       }
894
       }
852
 
895
 
853
       #if ENABLED(AUTO_BED_LEVELING_UBL)
896
       #if ENABLED(AUTO_BED_LEVELING_UBL)
889
       #endif
932
       #endif
890
     }
933
     }
891
     #if ENABLED(EEPROM_CHITCHAT)
934
     #if ENABLED(EEPROM_CHITCHAT)
892
-      Config_PrintSettings();
935
+      report();
893
     #endif
936
     #endif
894
 
937
 
895
     return !eeprom_read_error;
938
     return !eeprom_read_error;
897
 
940
 
898
 #else // !EEPROM_SETTINGS
941
 #else // !EEPROM_SETTINGS
899
 
942
 
900
-  bool Config_StoreSettings() {
943
+  bool MarlinSettings::save() {
901
     SERIAL_ERROR_START;
944
     SERIAL_ERROR_START;
902
     SERIAL_ERRORLNPGM("EEPROM disabled");
945
     SERIAL_ERRORLNPGM("EEPROM disabled");
903
     return false;
946
     return false;
908
 /**
951
 /**
909
  * M502 - Reset Configuration
952
  * M502 - Reset Configuration
910
  */
953
  */
911
-void Config_ResetDefault() {
954
+void MarlinSettings::reset() {
912
   const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE;
955
   const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE;
913
   const uint32_t tmp3[] = DEFAULT_MAX_ACCELERATION;
956
   const uint32_t tmp3[] = DEFAULT_MAX_ACCELERATION;
914
   LOOP_XYZE_N(i) {
957
   LOOP_XYZE_N(i) {
927
   planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
970
   planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
928
   planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
971
   planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
929
   planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
972
   planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
973
+
974
+  #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
975
+    planner.z_fade_height = 0.0;
976
+  #endif
977
+
930
   #if DISABLED(NO_WORKSPACE_OFFSETS)
978
   #if DISABLED(NO_WORKSPACE_OFFSETS)
931
     ZERO(home_offset);
979
     ZERO(home_offset);
932
   #endif
980
   #endif
968
     COPY(delta_diagonal_rod_trim, drt);
1016
     COPY(delta_diagonal_rod_trim, drt);
969
     COPY(delta_tower_angle_trim, dta);
1017
     COPY(delta_tower_angle_trim, dta);
970
   #elif ENABLED(Z_DUAL_ENDSTOPS)
1018
   #elif ENABLED(Z_DUAL_ENDSTOPS)
971
-    #if defined(Z_DUAL_ENDSTOPS_ADJUSTMENT)
972
-      float z_endstop_adj = Z_DUAL_ENDSTOPS_ADJUSTMENT;
973
-    #else
974
-      float z_endstop_adj = 0;
975
-    #endif
1019
+    float z_endstop_adj =
1020
+      #ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
1021
+        Z_DUAL_ENDSTOPS_ADJUSTMENT
1022
+      #else
1023
+        0
1024
+      #endif
1025
+    ;
976
   #endif
1026
   #endif
977
 
1027
 
978
   #if ENABLED(ULTIPANEL)
1028
   #if ENABLED(ULTIPANEL)
1027
   #endif
1077
   #endif
1028
 
1078
 
1029
   volumetric_enabled =
1079
   volumetric_enabled =
1030
-  #if ENABLED(VOLUMETRIC_DEFAULT_ON)
1031
-    true
1032
-  #else
1033
-    false
1034
-  #endif
1080
+    #if ENABLED(VOLUMETRIC_DEFAULT_ON)
1081
+      true
1082
+    #else
1083
+      false
1084
+    #endif
1035
   ;
1085
   ;
1036
   for (uint8_t q = 0; q < COUNT(filament_size); q++)
1086
   for (uint8_t q = 0; q < COUNT(filament_size); q++)
1037
     filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
1087
     filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
1077
     #endif
1127
     #endif
1078
   #endif
1128
   #endif
1079
 
1129
 
1080
-  Config_Postprocess();
1130
+  postprocess();
1081
 
1131
 
1082
   SERIAL_ECHO_START;
1132
   SERIAL_ECHO_START;
1083
   SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
1133
   SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
1088
   #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START; }while(0)
1138
   #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START; }while(0)
1089
 
1139
 
1090
   /**
1140
   /**
1091
-   * M503 - Print Configuration
1141
+   * M503 - Report current settings in RAM
1142
+   *   
1143
+   * Unless specifically disabled, M503 is available even without EEPROM
1092
    */
1144
    */
1093
-  void Config_PrintSettings(bool forReplay) {
1094
-    // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
1145
+  void MarlinSettings::report(bool forReplay) {
1095
 
1146
 
1096
     CONFIG_ECHO_START;
1147
     CONFIG_ECHO_START;
1097
 
1148
 
1211
         SERIAL_ECHOLNPGM("Mesh Bed Leveling:");
1262
         SERIAL_ECHOLNPGM("Mesh Bed Leveling:");
1212
         CONFIG_ECHO_START;
1263
         CONFIG_ECHO_START;
1213
       }
1264
       }
1214
-      SERIAL_ECHOLNPAIR("  M420 S", mbl.has_mesh() ? 1 : 0);
1265
+      SERIAL_ECHOPAIR("  M420 S", mbl.has_mesh() ? 1 : 0);
1266
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1267
+        SERIAL_ECHOLNPAIR(" Z", planner.z_fade_height);
1268
+      #endif
1269
+      SERIAL_EOL;
1215
       for (uint8_t py = 1; py <= GRID_MAX_POINTS_Y; py++) {
1270
       for (uint8_t py = 1; py <= GRID_MAX_POINTS_Y; py++) {
1216
         for (uint8_t px = 1; px <= GRID_MAX_POINTS_X; px++) {
1271
         for (uint8_t px = 1; px <= GRID_MAX_POINTS_X; px++) {
1217
           CONFIG_ECHO_START;
1272
           CONFIG_ECHO_START;
1229
         SERIAL_ECHOLNPGM("Unified Bed Leveling:");
1284
         SERIAL_ECHOLNPGM("Unified Bed Leveling:");
1230
         CONFIG_ECHO_START;
1285
         CONFIG_ECHO_START;
1231
       }
1286
       }
1232
-
1233
-      SERIAL_ECHOLNPAIR("  M420 S", ubl.state.active ? 1 : 0);
1287
+      SERIAL_ECHOPAIR("  M420 S", ubl.state.active ? 1 : 0);
1288
+      //#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1289
+      //  SERIAL_ECHOLNPAIR(" Z", ubl.state.g29_correction_fade_height);
1290
+      //#endif
1291
+      SERIAL_EOL;
1234
 
1292
 
1235
       if (!forReplay) {
1293
       if (!forReplay) {
1236
         SERIAL_ECHOPGM("\nUBL is ");
1294
         SERIAL_ECHOPGM("\nUBL is ");
1264
         SERIAL_ECHOLNPGM("Auto Bed Leveling:");
1322
         SERIAL_ECHOLNPGM("Auto Bed Leveling:");
1265
         CONFIG_ECHO_START;
1323
         CONFIG_ECHO_START;
1266
       }
1324
       }
1267
-      SERIAL_ECHOLNPAIR("  M420 S", planner.abl_enabled ? 1 : 0);
1325
+      SERIAL_ECHOPAIR("  M420 S", planner.abl_enabled ? 1 : 0);
1326
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1327
+        SERIAL_ECHOLNPAIR(" Z", planner.z_fade_height);
1328
+      #endif
1329
+      SERIAL_EOL;
1268
 
1330
 
1269
     #endif
1331
     #endif
1270
 
1332
 

+ 35
- 16
Marlin/configuration_store.h Wyświetl plik

25
 
25
 
26
 #include "MarlinConfig.h"
26
 #include "MarlinConfig.h"
27
 
27
 
28
-void Config_ResetDefault();
29
-bool Config_StoreSettings();
30
-
31
-#if DISABLED(DISABLE_M503)
32
-  void Config_PrintSettings(bool forReplay=false);
33
-#else
34
-  FORCE_INLINE void Config_PrintSettings(bool forReplay=false) {}
35
-#endif
36
-
37
-#if ENABLED(EEPROM_SETTINGS)
38
-  bool Config_RetrieveSettings();
39
-#else
40
-  FORCE_INLINE bool Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); return true; }
41
-#endif
42
-
43
-#endif //CONFIGURATION_STORE_H
28
+class MarlinSettings {
29
+  public:
30
+    MarlinSettings() { }
31
+
32
+    static void reset();
33
+    static bool save();
34
+
35
+    #if ENABLED(EEPROM_SETTINGS)
36
+      static bool load();
37
+    #else
38
+      FORCE_INLINE
39
+      static bool load() { reset(); report(); return true; }
40
+    #endif
41
+
42
+    #if DISABLED(DISABLE_M503)
43
+      static void report(bool forReplay=false);
44
+    #else
45
+      FORCE_INLINE
46
+      static void report(bool forReplay=false) { }
47
+    #endif
48
+
49
+  private:
50
+    static void postprocess();
51
+
52
+    #if ENABLED(EEPROM_SETTINGS)
53
+      static uint16_t eeprom_checksum;
54
+      static bool eeprom_read_error, eeprom_write_error;
55
+      static void write_data(int &pos, const uint8_t* value, uint16_t size);
56
+      static void read_data(int &pos, uint8_t* value, uint16_t size);
57
+    #endif
58
+};
59
+
60
+extern MarlinSettings settings;
61
+
62
+#endif // CONFIGURATION_STORE_H

+ 1
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h Wyświetl plik

816
  */
816
  */
817
 #define Z_CLEARANCE_DEPLOY_PROBE   100 // Z Clearance for Deploy/Stow
817
 #define Z_CLEARANCE_DEPLOY_PROBE   100 // Z Clearance for Deploy/Stow
818
 #define Z_CLEARANCE_BETWEEN_PROBES   5 // Z Clearance between probe points
818
 #define Z_CLEARANCE_BETWEEN_PROBES   5 // Z Clearance between probe points
819
- 
819
+
820
 // For M851 give a range for adjusting the Z probe offset
820
 // For M851 give a range for adjusting the Z probe offset
821
 
821
 
822
 #define Z_PROBE_OFFSET_RANGE_MIN -15
822
 #define Z_PROBE_OFFSET_RANGE_MIN -15

+ 2
- 2
Marlin/planner.cpp Wyświetl plik

109
 #endif
109
 #endif
110
 
110
 
111
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
111
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
112
-  float Planner::z_fade_height = 0.0,
113
-        Planner::inverse_z_fade_height = 0.0;
112
+  float Planner::z_fade_height,
113
+        Planner::inverse_z_fade_height;
114
 #endif
114
 #endif
115
 
115
 
116
 #if ENABLED(AUTOTEMP)
116
 #if ENABLED(AUTOTEMP)

+ 3
- 3
Marlin/ultralcd.cpp Wyświetl plik

2046
    */
2046
    */
2047
 
2047
 
2048
   #if ENABLED(EEPROM_SETTINGS)
2048
   #if ENABLED(EEPROM_SETTINGS)
2049
-    static void lcd_store_settings()   { lcd_completion_feedback(Config_StoreSettings()); }
2050
-    static void lcd_load_settings()    { lcd_completion_feedback(Config_RetrieveSettings()); }
2049
+    static void lcd_store_settings()   { lcd_completion_feedback(settings.save()); }
2050
+    static void lcd_load_settings()    { lcd_completion_feedback(settings.load()); }
2051
   #endif
2051
   #endif
2052
 
2052
 
2053
   static void lcd_factory_settings() {
2053
   static void lcd_factory_settings() {
2054
-    Config_ResetDefault();
2054
+    settings.reset();
2055
     lcd_completion_feedback();
2055
     lcd_completion_feedback();
2056
   }
2056
   }
2057
 
2057
 

Ładowanie…
Anuluj
Zapisz