ソースを参照

Overridable Options - Part 11 (PR#2563)

Apply `ENABLED` / `DISABLED` macros to EEPROM-related files.
Scott Lahteine 9年前
コミット
5e834352a9
2個のファイルの変更55行の追加55行の削除
  1. 53
    53
      Marlin/configuration_store.cpp
  2. 2
    2
      Marlin/configuration_store.h

+ 53
- 53
Marlin/configuration_store.cpp ファイルの表示

@@ -95,7 +95,7 @@
95 95
 #include "ultralcd.h"
96 96
 #include "configuration_store.h"
97 97
 
98
-#ifdef MESH_BED_LEVELING
98
+#if ENABLED(MESH_BED_LEVELING)
99 99
   #include "mesh_bed_leveling.h"
100 100
 #endif
101 101
 
@@ -130,7 +130,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
130 130
 
131 131
 #define EEPROM_OFFSET 100
132 132
 
133
-#ifdef EEPROM_SETTINGS
133
+#if ENABLED(EEPROM_SETTINGS)
134 134
 
135 135
 void Config_StoreSettings()  {
136 136
   float dummy = 0.0f;
@@ -153,7 +153,7 @@ void Config_StoreSettings()  {
153 153
 
154 154
   uint8_t mesh_num_x = 3;
155 155
   uint8_t mesh_num_y = 3;
156
-  #ifdef MESH_BED_LEVELING
156
+  #if ENABLED(MESH_BED_LEVELING)
157 157
     // Compile time test that sizeof(mbl.z_values) is as expected
158 158
     typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS*sizeof(dummy)) ? 1 : -1];
159 159
     mesh_num_x = MESH_NUM_X_POINTS;
@@ -171,17 +171,17 @@ void Config_StoreSettings()  {
171 171
     for (int q=0; q<mesh_num_x*mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy);
172 172
   #endif // MESH_BED_LEVELING
173 173
 
174
-  #ifndef ENABLE_AUTO_BED_LEVELING
174
+  #if DISABLED(ENABLE_AUTO_BED_LEVELING)
175 175
     float zprobe_zoffset = 0;
176 176
   #endif
177 177
   EEPROM_WRITE_VAR(i, zprobe_zoffset);
178 178
 
179
-  #ifdef DELTA
179
+  #if ENABLED(DELTA)
180 180
     EEPROM_WRITE_VAR(i, endstop_adj);               // 3 floats
181 181
     EEPROM_WRITE_VAR(i, delta_radius);              // 1 float
182 182
     EEPROM_WRITE_VAR(i, delta_diagonal_rod);        // 1 float
183 183
     EEPROM_WRITE_VAR(i, delta_segments_per_second); // 1 float
184
-  #elif defined(Z_DUAL_ENDSTOPS)
184
+  #elif ENABLED(Z_DUAL_ENDSTOPS)
185 185
     EEPROM_WRITE_VAR(i, z_endstop_adj);            // 1 floats
186 186
     dummy = 0.0f;
187 187
     for (int q=5; q--;) EEPROM_WRITE_VAR(i, dummy);
@@ -190,7 +190,7 @@ void Config_StoreSettings()  {
190 190
     for (int q=6; q--;) EEPROM_WRITE_VAR(i, dummy);
191 191
   #endif
192 192
 
193
-  #ifndef ULTIPANEL
193
+  #if DISABLED(ULTIPANEL)
194 194
     int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED,
195 195
         absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
196 196
   #endif // !ULTIPANEL
@@ -204,12 +204,12 @@ void Config_StoreSettings()  {
204 204
 
205 205
   for (int e = 0; e < 4; e++) {
206 206
 
207
-    #ifdef PIDTEMP
207
+    #if ENABLED(PIDTEMP)
208 208
       if (e < EXTRUDERS) {
209 209
         EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e));
210 210
         EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e));
211 211
         EEPROM_WRITE_VAR(i, PID_PARAM(Kd, e));
212
-        #ifdef PID_ADD_EXTRUSION_RATE
212
+        #if ENABLED(PID_ADD_EXTRUSION_RATE)
213 213
           EEPROM_WRITE_VAR(i, PID_PARAM(Kc, e));
214 214
         #else
215 215
           dummy = 1.0f; // 1.0 = default kc
@@ -227,7 +227,7 @@ void Config_StoreSettings()  {
227 227
 
228 228
   } // Extruders Loop
229 229
 
230
-  #ifndef PIDTEMPBED
230
+  #if DISABLED(PIDTEMPBED)
231 231
     float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE;
232 232
   #endif
233 233
 
@@ -235,19 +235,19 @@ void Config_StoreSettings()  {
235 235
   EEPROM_WRITE_VAR(i, bedKi);
236 236
   EEPROM_WRITE_VAR(i, bedKd);
237 237
 
238
-  #ifndef HAS_LCD_CONTRAST
239
-    int lcd_contrast = 32;
238
+  #if DISABLED(HAS_LCD_CONTRAST)
239
+    const int lcd_contrast = 32;
240 240
   #endif
241 241
   EEPROM_WRITE_VAR(i, lcd_contrast);
242 242
 
243
-  #ifdef SCARA
243
+  #if ENABLED(SCARA)
244 244
     EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
245 245
   #else
246 246
     dummy = 1.0f;
247 247
     EEPROM_WRITE_VAR(i, dummy);
248 248
   #endif
249 249
 
250
-  #ifdef FWRETRACT
250
+  #if ENABLED(FWRETRACT)
251 251
     EEPROM_WRITE_VAR(i, autoretract_enabled);
252 252
     EEPROM_WRITE_VAR(i, retract_length);
253 253
     #if EXTRUDERS > 1
@@ -327,7 +327,7 @@ void Config_RetrieveSettings() {
327 327
     EEPROM_READ_VAR(i, dummy_uint8);
328 328
     EEPROM_READ_VAR(i, mesh_num_x);
329 329
     EEPROM_READ_VAR(i, mesh_num_y);
330
-    #ifdef MESH_BED_LEVELING
330
+    #if ENABLED(MESH_BED_LEVELING)
331 331
       mbl.active = dummy_uint8;
332 332
       if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
333 333
         EEPROM_READ_VAR(i, mbl.z_values);
@@ -339,17 +339,17 @@ void Config_RetrieveSettings() {
339 339
       for (int q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ_VAR(i, dummy);
340 340
     #endif // MESH_BED_LEVELING
341 341
 
342
-    #ifndef ENABLE_AUTO_BED_LEVELING
342
+    #if DISABLED(ENABLE_AUTO_BED_LEVELING)
343 343
       float zprobe_zoffset = 0;
344 344
     #endif
345 345
     EEPROM_READ_VAR(i, zprobe_zoffset);
346 346
 
347
-    #ifdef DELTA
347
+    #if ENABLED(DELTA)
348 348
       EEPROM_READ_VAR(i, endstop_adj);                // 3 floats
349 349
       EEPROM_READ_VAR(i, delta_radius);               // 1 float
350 350
       EEPROM_READ_VAR(i, delta_diagonal_rod);         // 1 float
351 351
       EEPROM_READ_VAR(i, delta_segments_per_second);  // 1 float
352
-    #elif defined(Z_DUAL_ENDSTOPS)
352
+    #elif ENABLED(Z_DUAL_ENDSTOPS)
353 353
       EEPROM_READ_VAR(i, z_endstop_adj);
354 354
       dummy = 0.0f;
355 355
       for (int q=5; q--;) EEPROM_READ_VAR(i, dummy);
@@ -358,7 +358,7 @@ void Config_RetrieveSettings() {
358 358
       for (int q=6; q--;) EEPROM_READ_VAR(i, dummy);
359 359
     #endif
360 360
 
361
-    #ifndef ULTIPANEL
361
+    #if DISABLED(ULTIPANEL)
362 362
       int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed,
363 363
           absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
364 364
     #endif
@@ -370,7 +370,7 @@ void Config_RetrieveSettings() {
370 370
     EEPROM_READ_VAR(i, absPreheatHPBTemp);
371 371
     EEPROM_READ_VAR(i, absPreheatFanSpeed);
372 372
 
373
-    #ifdef PIDTEMP
373
+    #if ENABLED(PIDTEMP)
374 374
       for (int e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin
375 375
         EEPROM_READ_VAR(i, dummy); // Kp
376 376
         if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) {
@@ -378,7 +378,7 @@ void Config_RetrieveSettings() {
378 378
           PID_PARAM(Kp, e) = dummy;
379 379
           EEPROM_READ_VAR(i, PID_PARAM(Ki, e));
380 380
           EEPROM_READ_VAR(i, PID_PARAM(Kd, e));
381
-          #ifdef PID_ADD_EXTRUSION_RATE
381
+          #if ENABLED(PID_ADD_EXTRUSION_RATE)
382 382
             EEPROM_READ_VAR(i, PID_PARAM(Kc, e));
383 383
           #else
384 384
             EEPROM_READ_VAR(i, dummy);
@@ -393,7 +393,7 @@ void Config_RetrieveSettings() {
393 393
       for (int q=16; q--;) EEPROM_READ_VAR(i, dummy);  // 4x Kp, Ki, Kd, Kc
394 394
     #endif // !PIDTEMP
395 395
 
396
-    #ifndef PIDTEMPBED
396
+    #if DISABLED(PIDTEMPBED)
397 397
       float bedKp, bedKi, bedKd;
398 398
     #endif
399 399
 
@@ -407,18 +407,18 @@ void Config_RetrieveSettings() {
407 407
       for (int q=2; q--;) EEPROM_READ_VAR(i, dummy); // bedKi, bedKd
408 408
     }
409 409
 
410
-    #ifndef HAS_LCD_CONTRAST
410
+    #if DISABLED(HAS_LCD_CONTRAST)
411 411
       int lcd_contrast;
412 412
     #endif
413 413
     EEPROM_READ_VAR(i, lcd_contrast);
414 414
 
415
-    #ifdef SCARA
415
+    #if ENABLED(SCARA)
416 416
       EEPROM_READ_VAR(i, axis_scaling);  // 3 floats
417 417
     #else
418 418
       EEPROM_READ_VAR(i, dummy);
419 419
     #endif
420 420
 
421
-    #ifdef FWRETRACT
421
+    #if ENABLED(FWRETRACT)
422 422
       EEPROM_READ_VAR(i, autoretract_enabled);
423 423
       EEPROM_READ_VAR(i, retract_length);
424 424
       #if EXTRUDERS > 1
@@ -455,7 +455,7 @@ void Config_RetrieveSettings() {
455 455
     SERIAL_ECHOLNPGM(" bytes)");
456 456
   }
457 457
 
458
-  #ifdef EEPROM_CHITCHAT
458
+  #if ENABLED(EEPROM_CHITCHAT)
459 459
     Config_PrintSettings();
460 460
   #endif
461 461
 }
@@ -474,7 +474,7 @@ void Config_ResetDefault() {
474 474
     axis_steps_per_unit[i] = tmp1[i];
475 475
     max_feedrate[i] = tmp2[i];
476 476
     max_acceleration_units_per_sq_second[i] = tmp3[i];
477
-    #ifdef SCARA
477
+    #if ENABLED(SCARA)
478 478
       if (i < COUNT(axis_scaling))
479 479
         axis_scaling[i] = 1;
480 480
     #endif
@@ -494,25 +494,25 @@ void Config_ResetDefault() {
494 494
   max_e_jerk = DEFAULT_EJERK;
495 495
   home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
496 496
 
497
-  #ifdef MESH_BED_LEVELING
497
+  #if ENABLED(MESH_BED_LEVELING)
498 498
     mbl.active = 0;
499 499
   #endif
500 500
 
501
-  #ifdef ENABLE_AUTO_BED_LEVELING
501
+  #if ENABLED(ENABLE_AUTO_BED_LEVELING)
502 502
     zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
503 503
   #endif
504 504
 
505
-  #ifdef DELTA
505
+  #if ENABLED(DELTA)
506 506
     endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
507 507
     delta_radius =  DELTA_RADIUS;
508 508
     delta_diagonal_rod =  DELTA_DIAGONAL_ROD;
509 509
     delta_segments_per_second =  DELTA_SEGMENTS_PER_SECOND;
510 510
     recalc_delta_settings(delta_radius, delta_diagonal_rod);
511
-  #elif defined(Z_DUAL_ENDSTOPS)
511
+  #elif ENABLED(Z_DUAL_ENDSTOPS)
512 512
     z_endstop_adj = 0;
513 513
   #endif
514 514
 
515
-  #ifdef ULTIPANEL
515
+  #if ENABLED(ULTIPANEL)
516 516
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
517 517
     plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
518 518
     plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
@@ -521,12 +521,12 @@ void Config_ResetDefault() {
521 521
     absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
522 522
   #endif
523 523
 
524
-  #ifdef HAS_LCD_CONTRAST
524
+  #if ENABLED(HAS_LCD_CONTRAST)
525 525
     lcd_contrast = DEFAULT_LCD_CONTRAST;
526 526
   #endif
527 527
 
528
-  #ifdef PIDTEMP
529
-    #ifdef PID_PARAMS_PER_EXTRUDER
528
+  #if ENABLED(PIDTEMP)
529
+    #if ENABLED(PID_PARAMS_PER_EXTRUDER)
530 530
       for (int e = 0; e < EXTRUDERS; e++)
531 531
     #else
532 532
       int e = 0; // only need to write once
@@ -535,7 +535,7 @@ void Config_ResetDefault() {
535 535
       PID_PARAM(Kp, e) = DEFAULT_Kp;
536 536
       PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
537 537
       PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
538
-      #ifdef PID_ADD_EXTRUSION_RATE
538
+      #if ENABLED(PID_ADD_EXTRUSION_RATE)
539 539
         PID_PARAM(Kc, e) = DEFAULT_Kc;
540 540
       #endif
541 541
     }
@@ -543,13 +543,13 @@ void Config_ResetDefault() {
543 543
     updatePID();
544 544
   #endif // PIDTEMP
545 545
 
546
-  #ifdef PIDTEMPBED
546
+  #if ENABLED(PIDTEMPBED)
547 547
     bedKp = DEFAULT_bedKp;
548 548
     bedKi = scalePID_i(DEFAULT_bedKi);
549 549
     bedKd = scalePID_d(DEFAULT_bedKd);
550 550
   #endif
551 551
 
552
-  #ifdef FWRETRACT
552
+  #if ENABLED(FWRETRACT)
553 553
     autoretract_enabled = false;
554 554
     retract_length = RETRACT_LENGTH;
555 555
     #if EXTRUDERS > 1
@@ -573,7 +573,7 @@ void Config_ResetDefault() {
573 573
   SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
574 574
 }
575 575
 
576
-#ifndef DISABLE_M503
576
+#if DISABLED(DISABLE_M503)
577 577
 
578 578
 /**
579 579
  * Print Configuration Settings - M503
@@ -598,7 +598,7 @@ void Config_PrintSettings(bool forReplay) {
598 598
 
599 599
   CONFIG_ECHO_START;
600 600
 
601
-  #ifdef SCARA
601
+  #if ENABLED(SCARA)
602 602
     if (!forReplay) {
603 603
       SERIAL_ECHOLNPGM("Scaling factors:");
604 604
       CONFIG_ECHO_START;
@@ -663,7 +663,7 @@ void Config_PrintSettings(bool forReplay) {
663 663
   SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
664 664
   SERIAL_EOL;
665 665
 
666
-  #ifdef MESH_BED_LEVELING
666
+  #if ENABLED(MESH_BED_LEVELING)
667 667
     if (!forReplay) {
668 668
       SERIAL_ECHOLNPGM("Mesh bed leveling:");
669 669
       CONFIG_ECHO_START;
@@ -683,7 +683,7 @@ void Config_PrintSettings(bool forReplay) {
683 683
     }
684 684
   #endif
685 685
 
686
-  #ifdef DELTA
686
+  #if ENABLED(DELTA)
687 687
     CONFIG_ECHO_START;
688 688
     if (!forReplay) {
689 689
       SERIAL_ECHOLNPGM("Endstop adjustment (mm):");
@@ -700,7 +700,7 @@ void Config_PrintSettings(bool forReplay) {
700 700
     SERIAL_ECHOPAIR(" R", delta_radius);
701 701
     SERIAL_ECHOPAIR(" S", delta_segments_per_second);
702 702
     SERIAL_EOL;
703
-  #elif defined(Z_DUAL_ENDSTOPS)
703
+  #elif ENABLED(Z_DUAL_ENDSTOPS)
704 704
     CONFIG_ECHO_START;
705 705
     if (!forReplay) {
706 706
       SERIAL_ECHOLNPGM("Z2 Endstop adjustment (mm):");
@@ -710,7 +710,7 @@ void Config_PrintSettings(bool forReplay) {
710 710
     SERIAL_EOL;  
711 711
   #endif // DELTA
712 712
 
713
-  #ifdef ULTIPANEL
713
+  #if ENABLED(ULTIPANEL)
714 714
     CONFIG_ECHO_START;
715 715
     if (!forReplay) {
716 716
       SERIAL_ECHOLNPGM("Material heatup parameters:");
@@ -727,13 +727,13 @@ void Config_PrintSettings(bool forReplay) {
727 727
     SERIAL_EOL;
728 728
   #endif // ULTIPANEL
729 729
 
730
-  #if defined(PIDTEMP) || defined(PIDTEMPBED)
730
+  #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
731 731
 
732 732
     CONFIG_ECHO_START;
733 733
     if (!forReplay) {
734 734
       SERIAL_ECHOLNPGM("PID settings:");
735 735
     }
736
-    #ifdef PIDTEMP
736
+    #if ENABLED(PIDTEMP)
737 737
       #if EXTRUDERS > 1
738 738
         if (forReplay) {
739 739
           for (uint8_t i = 0; i < EXTRUDERS; i++) {
@@ -742,7 +742,7 @@ void Config_PrintSettings(bool forReplay) {
742 742
             SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
743 743
             SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i)));
744 744
             SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i)));
745
-            #ifdef PID_ADD_EXTRUSION_RATE
745
+            #if ENABLED(PID_ADD_EXTRUSION_RATE)
746 746
               SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, i));
747 747
             #endif      
748 748
             SERIAL_EOL;
@@ -756,14 +756,14 @@ void Config_PrintSettings(bool forReplay) {
756 756
         SERIAL_ECHOPAIR("  M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
757 757
         SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
758 758
         SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
759
-        #ifdef PID_ADD_EXTRUSION_RATE
759
+        #if ENABLED(PID_ADD_EXTRUSION_RATE)
760 760
           SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0));
761 761
         #endif      
762 762
         SERIAL_EOL;
763 763
       }
764 764
     #endif // PIDTEMP
765 765
 
766
-    #ifdef PIDTEMPBED
766
+    #if ENABLED(PIDTEMPBED)
767 767
       CONFIG_ECHO_START;
768 768
       SERIAL_ECHOPAIR("  M304 P", bedKp);
769 769
       SERIAL_ECHOPAIR(" I", unscalePID_i(bedKi));
@@ -773,7 +773,7 @@ void Config_PrintSettings(bool forReplay) {
773 773
 
774 774
   #endif // PIDTEMP || PIDTEMPBED
775 775
 
776
-  #ifdef HAS_LCD_CONTRAST
776
+  #if ENABLED(HAS_LCD_CONTRAST)
777 777
     CONFIG_ECHO_START;
778 778
     if (!forReplay) {
779 779
       SERIAL_ECHOLNPGM("LCD Contrast:");
@@ -783,7 +783,7 @@ void Config_PrintSettings(bool forReplay) {
783 783
     SERIAL_EOL;
784 784
   #endif
785 785
 
786
-  #ifdef FWRETRACT
786
+  #if ENABLED(FWRETRACT)
787 787
 
788 788
     CONFIG_ECHO_START;
789 789
     if (!forReplay) {
@@ -857,8 +857,8 @@ void Config_PrintSettings(bool forReplay) {
857 857
   /**
858 858
    * Auto Bed Leveling
859 859
    */
860
-  #ifdef ENABLE_AUTO_BED_LEVELING
861
-    #ifdef CUSTOM_M_CODES
860
+  #if ENABLED(ENABLE_AUTO_BED_LEVELING)
861
+    #if ENABLED(CUSTOM_M_CODES)
862 862
       if (!forReplay) {
863 863
         CONFIG_ECHO_START;
864 864
         SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");

+ 2
- 2
Marlin/configuration_store.h ファイルの表示

@@ -5,13 +5,13 @@
5 5
 
6 6
 void Config_ResetDefault();
7 7
 
8
-#ifndef DISABLE_M503
8
+#if DISABLED(DISABLE_M503)
9 9
   void Config_PrintSettings(bool forReplay=false);
10 10
 #else
11 11
   FORCE_INLINE void Config_PrintSettings(bool forReplay=false) {}
12 12
 #endif
13 13
 
14
-#ifdef EEPROM_SETTINGS
14
+#if ENABLED(EEPROM_SETTINGS)
15 15
   void Config_StoreSettings();
16 16
   void Config_RetrieveSettings();
17 17
 #else

読み込み中…
キャンセル
保存