Selaa lähdekoodia

Prettify some EEPROM code

Scott Lahteine 6 vuotta sitten
vanhempi
commit
e642a64b68
1 muutettua tiedostoa jossa 61 lisäystä ja 7 poistoa
  1. 61
    7
      Marlin/configuration_store.cpp

+ 61
- 7
Marlin/configuration_store.cpp Näytä tiedosto

@@ -723,12 +723,16 @@ void MarlinSettings::postprocess() {
723 723
       float dummy = 0;
724 724
       bool dummyb;
725 725
 
726
-      working_crc = 0; //clear before reading first "real data"
726
+      working_crc = 0;  // Init to 0. Accumulated by EEPROM_READ
727 727
 
728 728
       // Number of esteppers may change
729 729
       uint8_t esteppers;
730 730
       EEPROM_READ(esteppers);
731 731
 
732
+      //
733
+      // Planner Motion
734
+      //
735
+
732 736
       // Get only the number of E stepper parameters previously stored
733 737
       // Any steppers added later are set to their defaults
734 738
       const float def1[] = DEFAULT_AXIS_STEPS_PER_UNIT, def2[] = DEFAULT_MAX_FEEDRATE;
@@ -752,6 +756,10 @@ void MarlinSettings::postprocess() {
752 756
       EEPROM_READ(planner.min_segment_time_us);
753 757
       EEPROM_READ(planner.max_jerk);
754 758
 
759
+      //
760
+      // Home Offset (M206)
761
+      //
762
+
755 763
       #if !HAS_HOME_OFFSET
756 764
         float home_offset[XYZ];
757 765
       #endif
@@ -763,6 +771,10 @@ void MarlinSettings::postprocess() {
763 771
         home_offset[Z_AXIS] -= DELTA_HEIGHT;
764 772
       #endif
765 773
 
774
+      //
775
+      // Hotend Offsets, if any
776
+      //
777
+
766 778
       #if HOTENDS > 1
767 779
         // Skip hotend 0 which must be 0
768 780
         for (uint8_t e = 1; e < HOTENDS; e++)
@@ -846,6 +858,10 @@ void MarlinSettings::postprocess() {
846 858
           for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);
847 859
         }
848 860
 
861
+      //
862
+      // Unified Bed Leveling active state
863
+      //
864
+
849 865
       #if ENABLED(AUTO_BED_LEVELING_UBL)
850 866
         EEPROM_READ(planner.leveling_active);
851 867
         EEPROM_READ(ubl.storage_slot);
@@ -855,6 +871,10 @@ void MarlinSettings::postprocess() {
855 871
         EEPROM_READ(dummyui8);
856 872
       #endif // AUTO_BED_LEVELING_UBL
857 873
 
874
+      //
875
+      // DELTA Geometry or Dual Endstops offsets
876
+      //
877
+
858 878
       #if ENABLED(DELTA)
859 879
         EEPROM_READ(delta_endstop_adj);         // 3 floats
860 880
         EEPROM_READ(delta_radius);              // 1 float
@@ -891,19 +911,26 @@ void MarlinSettings::postprocess() {
891 911
 
892 912
       #endif
893 913
 
914
+      //
915
+      // LCD Preheat settings
916
+      //
917
+
894 918
       #if DISABLED(ULTIPANEL)
895 919
         int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
896 920
       #endif
897
-
898
-      EEPROM_READ(lcd_preheat_hotend_temp);
899
-      EEPROM_READ(lcd_preheat_bed_temp);
900
-      EEPROM_READ(lcd_preheat_fan_speed);
921
+      EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
922
+      EEPROM_READ(lcd_preheat_bed_temp);    // 2 floats
923
+      EEPROM_READ(lcd_preheat_fan_speed);   // 2 floats
901 924
 
902 925
       //EEPROM_ASSERT(
903 926
       //  WITHIN(lcd_preheat_fan_speed, 0, 255),
904 927
       //  "lcd_preheat_fan_speed out of range"
905 928
       //);
906 929
 
930
+      //
931
+      // Hotend PID
932
+      //
933
+
907 934
       #if ENABLED(PIDTEMP)
908 935
         for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
909 936
           EEPROM_READ(dummy); // Kp
@@ -927,11 +954,19 @@ void MarlinSettings::postprocess() {
927 954
         for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy);  // Kp, Ki, Kd, Kc
928 955
       #endif // !PIDTEMP
929 956
 
957
+      //
958
+      // PID Extrusion Scaling
959
+      //
960
+
930 961
       #if DISABLED(PID_EXTRUSION_SCALING)
931 962
         int lpq_len;
932 963
       #endif
933 964
       EEPROM_READ(lpq_len);
934 965
 
966
+      //
967
+      // Heated Bed PID
968
+      //
969
+
935 970
       #if ENABLED(PIDTEMPBED)
936 971
         EEPROM_READ(dummy); // bedKp
937 972
         if (dummy != DUMMY_PID_VALUE) {
@@ -943,11 +978,19 @@ void MarlinSettings::postprocess() {
943 978
         for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
944 979
       #endif
945 980
 
981
+      //
982
+      // LCD Contrast
983
+      //
984
+
946 985
       #if !HAS_LCD_CONTRAST
947 986
         uint16_t lcd_contrast;
948 987
       #endif
949 988
       EEPROM_READ(lcd_contrast);
950 989
 
990
+      //
991
+      // Firmware Retraction
992
+      //
993
+
951 994
       #if ENABLED(FWRETRACT)
952 995
         EEPROM_READ(autoretract_enabled);
953 996
         EEPROM_READ(retract_length);
@@ -963,13 +1006,20 @@ void MarlinSettings::postprocess() {
963 1006
         for (uint8_t q=8; q--;) EEPROM_READ(dummy);
964 1007
       #endif
965 1008
 
966
-      EEPROM_READ(volumetric_enabled);
1009
+      //
1010
+      // Volumetric & Filament Size
1011
+      //
967 1012
 
1013
+      EEPROM_READ(volumetric_enabled);
968 1014
       for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
969 1015
         EEPROM_READ(dummy);
970 1016
         if (q < COUNT(filament_size)) filament_size[q] = dummy;
971 1017
       }
972 1018
 
1019
+      //
1020
+      // TMC2130 Stepper Current
1021
+      //
1022
+
973 1023
       uint16_t val;
974 1024
       #if ENABLED(HAVE_TMC2130)
975 1025
         EEPROM_READ(val);
@@ -1017,7 +1067,7 @@ void MarlinSettings::postprocess() {
1017 1067
           stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1018 1068
         #endif
1019 1069
       #else
1020
-        for (uint8_t q = 0; q < 11; q++) EEPROM_READ(val);
1070
+        for (uint8_t q = 11; --q;) EEPROM_READ(val);
1021 1071
       #endif
1022 1072
 
1023 1073
       //
@@ -1032,6 +1082,10 @@ void MarlinSettings::postprocess() {
1032 1082
         EEPROM_READ(dummy);
1033 1083
       #endif
1034 1084
 
1085
+      //
1086
+      // Motor Current PWM
1087
+      //
1088
+
1035 1089
       #if HAS_MOTOR_CURRENT_PWM
1036 1090
         for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
1037 1091
       #else

Loading…
Peruuta
Tallenna