Browse Source

Read from backup TMC StealthChop state (#19364)

ManuelMcLure 3 years ago
parent
commit
c04d5624da
No account linked to committer's email address
2 changed files with 35 additions and 32 deletions
  1. 3
    0
      Marlin/src/feature/tmc_util.h
  2. 32
    32
      Marlin/src/module/settings.cpp

+ 3
- 0
Marlin/src/feature/tmc_util.h View File

@@ -105,6 +105,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
105 105
     #if HAS_STEALTHCHOP
106 106
       inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
107 107
       inline bool get_stealthChop_status() { return this->en_pwm_mode(); }
108
+      inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; }
108 109
     #endif
109 110
 
110 111
     #if ENABLED(HYBRID_THRESHOLD)
@@ -171,6 +172,7 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
171 172
     #if HAS_STEALTHCHOP
172 173
       inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
173 174
       inline bool get_stealthChop_status() { return !this->en_spreadCycle(); }
175
+      inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; }
174 176
     #endif
175 177
 
176 178
     #if ENABLED(HYBRID_THRESHOLD)
@@ -216,6 +218,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
216 218
     #if HAS_STEALTHCHOP
217 219
       inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
218 220
       inline bool get_stealthChop_status() { return !this->en_spreadCycle(); }
221
+      inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; }
219 222
     #endif
220 223
 
221 224
     #if ENABLED(HYBRID_THRESHOLD)

+ 32
- 32
Marlin/src/module/settings.cpp View File

@@ -1191,60 +1191,60 @@ void MarlinSettings::postprocess() {
1191 1191
 
1192 1192
       #if HAS_STEALTHCHOP
1193 1193
         #if AXIS_HAS_STEALTHCHOP(X)
1194
-          tmc_stealth_enabled.X = stepperX.get_stealthChop_status();
1194
+          tmc_stealth_enabled.X = stepperX.get_stored_stealthChop_status();
1195 1195
         #endif
1196 1196
         #if AXIS_HAS_STEALTHCHOP(Y)
1197
-          tmc_stealth_enabled.Y = stepperY.get_stealthChop_status();
1197
+          tmc_stealth_enabled.Y = stepperY.get_stored_stealthChop_status();
1198 1198
         #endif
1199 1199
         #if AXIS_HAS_STEALTHCHOP(Z)
1200
-          tmc_stealth_enabled.Z = stepperZ.get_stealthChop_status();
1200
+          tmc_stealth_enabled.Z = stepperZ.get_stored_stealthChop_status();
1201 1201
         #endif
1202 1202
         #if AXIS_HAS_STEALTHCHOP(X2)
1203
-          tmc_stealth_enabled.X2 = stepperX2.get_stealthChop_status();
1203
+          tmc_stealth_enabled.X2 = stepperX2.get_stored_stealthChop_status();
1204 1204
         #endif
1205 1205
         #if AXIS_HAS_STEALTHCHOP(Y2)
1206
-          tmc_stealth_enabled.Y2 = stepperY2.get_stealthChop_status();
1206
+          tmc_stealth_enabled.Y2 = stepperY2.get_stored_stealthChop_status();
1207 1207
         #endif
1208 1208
         #if AXIS_HAS_STEALTHCHOP(Z2)
1209
-          tmc_stealth_enabled.Z2 = stepperZ2.get_stealthChop_status();
1209
+          tmc_stealth_enabled.Z2 = stepperZ2.get_stored_stealthChop_status();
1210 1210
         #endif
1211 1211
         #if AXIS_HAS_STEALTHCHOP(Z3)
1212
-          tmc_stealth_enabled.Z3 = stepperZ3.get_stealthChop_status();
1212
+          tmc_stealth_enabled.Z3 = stepperZ3.get_stored_stealthChop_status();
1213 1213
         #endif
1214 1214
         #if AXIS_HAS_STEALTHCHOP(Z4)
1215
-          tmc_stealth_enabled.Z4 = stepperZ4.get_stealthChop_status();
1215
+          tmc_stealth_enabled.Z4 = stepperZ4.get_stored_stealthChop_status();
1216 1216
         #endif
1217 1217
         #if MAX_EXTRUDERS
1218 1218
           #if AXIS_HAS_STEALTHCHOP(E0)
1219
-            tmc_stealth_enabled.E0 = stepperE0.get_stealthChop_status();
1219
+            tmc_stealth_enabled.E0 = stepperE0.get_stored_stealthChop_status();
1220 1220
           #endif
1221 1221
           #if MAX_EXTRUDERS > 1
1222 1222
             #if AXIS_HAS_STEALTHCHOP(E1)
1223
-              tmc_stealth_enabled.E1 = stepperE1.get_stealthChop_status();
1223
+              tmc_stealth_enabled.E1 = stepperE1.get_stored_stealthChop_status();
1224 1224
             #endif
1225 1225
             #if MAX_EXTRUDERS > 2
1226 1226
               #if AXIS_HAS_STEALTHCHOP(E2)
1227
-                tmc_stealth_enabled.E2 = stepperE2.get_stealthChop_status();
1227
+                tmc_stealth_enabled.E2 = stepperE2.get_stored_stealthChop_status();
1228 1228
               #endif
1229 1229
               #if MAX_EXTRUDERS > 3
1230 1230
                 #if AXIS_HAS_STEALTHCHOP(E3)
1231
-                  tmc_stealth_enabled.E3 = stepperE3.get_stealthChop_status();
1231
+                  tmc_stealth_enabled.E3 = stepperE3.get_stored_stealthChop_status();
1232 1232
                 #endif
1233 1233
                 #if MAX_EXTRUDERS > 4
1234 1234
                   #if AXIS_HAS_STEALTHCHOP(E4)
1235
-                    tmc_stealth_enabled.E4 = stepperE4.get_stealthChop_status();
1235
+                    tmc_stealth_enabled.E4 = stepperE4.get_stored_stealthChop_status();
1236 1236
                   #endif
1237 1237
                   #if MAX_EXTRUDERS > 5
1238 1238
                     #if AXIS_HAS_STEALTHCHOP(E5)
1239
-                      tmc_stealth_enabled.E5 = stepperE5.get_stealthChop_status();
1239
+                      tmc_stealth_enabled.E5 = stepperE5.get_stored_stealthChop_status();
1240 1240
                     #endif
1241 1241
                     #if MAX_EXTRUDERS > 6
1242 1242
                       #if AXIS_HAS_STEALTHCHOP(E6)
1243
-                        tmc_stealth_enabled.E6 = stepperE6.get_stealthChop_status();
1243
+                        tmc_stealth_enabled.E6 = stepperE6.get_stored_stealthChop_status();
1244 1244
                       #endif
1245 1245
                       #if MAX_EXTRUDERS > 7
1246 1246
                         #if AXIS_HAS_STEALTHCHOP(E7)
1247
-                          tmc_stealth_enabled.E7 = stepperE7.get_stealthChop_status();
1247
+                          tmc_stealth_enabled.E7 = stepperE7.get_stored_stealthChop_status();
1248 1248
                         #endif
1249 1249
                       #endif // MAX_EXTRUDERS > 7
1250 1250
                     #endif // MAX_EXTRUDERS > 6
@@ -3595,17 +3595,17 @@ void MarlinSettings::reset() {
3595 3595
       #if HAS_STEALTHCHOP
3596 3596
         CONFIG_ECHO_HEADING("Driver stepping mode:");
3597 3597
         #if AXIS_HAS_STEALTHCHOP(X)
3598
-          const bool chop_x = stepperX.get_stealthChop_status();
3598
+          const bool chop_x = stepperX.get_stored_stealthChop_status();
3599 3599
         #else
3600 3600
           constexpr bool chop_x = false;
3601 3601
         #endif
3602 3602
         #if AXIS_HAS_STEALTHCHOP(Y)
3603
-          const bool chop_y = stepperY.get_stealthChop_status();
3603
+          const bool chop_y = stepperY.get_stored_stealthChop_status();
3604 3604
         #else
3605 3605
           constexpr bool chop_y = false;
3606 3606
         #endif
3607 3607
         #if AXIS_HAS_STEALTHCHOP(Z)
3608
-          const bool chop_z = stepperZ.get_stealthChop_status();
3608
+          const bool chop_z = stepperZ.get_stored_stealthChop_status();
3609 3609
         #else
3610 3610
           constexpr bool chop_z = false;
3611 3611
         #endif
@@ -3619,17 +3619,17 @@ void MarlinSettings::reset() {
3619 3619
         }
3620 3620
 
3621 3621
         #if AXIS_HAS_STEALTHCHOP(X2)
3622
-          const bool chop_x2 = stepperX2.get_stealthChop_status();
3622
+          const bool chop_x2 = stepperX2.get_stored_stealthChop_status();
3623 3623
         #else
3624 3624
           constexpr bool chop_x2 = false;
3625 3625
         #endif
3626 3626
         #if AXIS_HAS_STEALTHCHOP(Y2)
3627
-          const bool chop_y2 = stepperY2.get_stealthChop_status();
3627
+          const bool chop_y2 = stepperY2.get_stored_stealthChop_status();
3628 3628
         #else
3629 3629
           constexpr bool chop_y2 = false;
3630 3630
         #endif
3631 3631
         #if AXIS_HAS_STEALTHCHOP(Z2)
3632
-          const bool chop_z2 = stepperZ2.get_stealthChop_status();
3632
+          const bool chop_z2 = stepperZ2.get_stored_stealthChop_status();
3633 3633
         #else
3634 3634
           constexpr bool chop_z2 = false;
3635 3635
         #endif
@@ -3643,36 +3643,36 @@ void MarlinSettings::reset() {
3643 3643
         }
3644 3644
 
3645 3645
         #if AXIS_HAS_STEALTHCHOP(Z3)
3646
-          if (stepperZ3.get_stealthChop_status()) { say_M569(forReplay, PSTR("I2 Z"), true); }
3646
+          if (stepperZ3.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("I2 Z"), true); }
3647 3647
         #endif
3648 3648
 
3649 3649
         #if AXIS_HAS_STEALTHCHOP(Z4)
3650
-          if (stepperZ4.get_stealthChop_status()) { say_M569(forReplay, PSTR("I3 Z"), true); }
3650
+          if (stepperZ4.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("I3 Z"), true); }
3651 3651
         #endif
3652 3652
 
3653 3653
         #if AXIS_HAS_STEALTHCHOP(E0)
3654
-          if (stepperE0.get_stealthChop_status()) { say_M569(forReplay, PSTR("T0 E"), true); }
3654
+          if (stepperE0.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T0 E"), true); }
3655 3655
         #endif
3656 3656
         #if AXIS_HAS_STEALTHCHOP(E1)
3657
-          if (stepperE1.get_stealthChop_status()) { say_M569(forReplay, PSTR("T1 E"), true); }
3657
+          if (stepperE1.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T1 E"), true); }
3658 3658
         #endif
3659 3659
         #if AXIS_HAS_STEALTHCHOP(E2)
3660
-          if (stepperE2.get_stealthChop_status()) { say_M569(forReplay, PSTR("T2 E"), true); }
3660
+          if (stepperE2.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T2 E"), true); }
3661 3661
         #endif
3662 3662
         #if AXIS_HAS_STEALTHCHOP(E3)
3663
-          if (stepperE3.get_stealthChop_status()) { say_M569(forReplay, PSTR("T3 E"), true); }
3663
+          if (stepperE3.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T3 E"), true); }
3664 3664
         #endif
3665 3665
         #if AXIS_HAS_STEALTHCHOP(E4)
3666
-          if (stepperE4.get_stealthChop_status()) { say_M569(forReplay, PSTR("T4 E"), true); }
3666
+          if (stepperE4.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T4 E"), true); }
3667 3667
         #endif
3668 3668
         #if AXIS_HAS_STEALTHCHOP(E5)
3669
-          if (stepperE5.get_stealthChop_status()) { say_M569(forReplay, PSTR("T5 E"), true); }
3669
+          if (stepperE5.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T5 E"), true); }
3670 3670
         #endif
3671 3671
         #if AXIS_HAS_STEALTHCHOP(E6)
3672
-          if (stepperE6.get_stealthChop_status()) { say_M569(forReplay, PSTR("T6 E"), true); }
3672
+          if (stepperE6.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T6 E"), true); }
3673 3673
         #endif
3674 3674
         #if AXIS_HAS_STEALTHCHOP(E7)
3675
-          if (stepperE7.get_stealthChop_status()) { say_M569(forReplay, PSTR("T7 E"), true); }
3675
+          if (stepperE7.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T7 E"), true); }
3676 3676
         #endif
3677 3677
 
3678 3678
       #endif // HAS_STEALTHCHOP

Loading…
Cancel
Save