Kaynağa Gözat

Show E0-E4 in monitor_tmc_driver output (#9969)

Fix #9966
Scott Lahteine 7 yıl önce
ebeveyn
işleme
b08ec22fe1
No account linked to committer's email address
1 değiştirilmiş dosya ile 19 ekleme ve 22 silme
  1. 19
    22
      Marlin/src/feature/tmc_util.cpp

+ 19
- 22
Marlin/src/feature/tmc_util.cpp Dosyayı Görüntüle

@@ -39,7 +39,7 @@
39 39
 bool report_tmc_status = false;
40 40
 char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1", "E2", "E3", "E4" };
41 41
 
42
-/*
42
+/**
43 43
  * Check for over temperature or short to ground error flags.
44 44
  * Report and log warning of overtemperature condition.
45 45
  * Reduce driver current in a persistent otpw condition.
@@ -96,13 +96,13 @@ char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1",
96 96
   #endif
97 97
 
98 98
   template<typename TMC>
99
-  void monitor_tmc_driver(TMC &st, const char axisID, uint8_t &otpw_cnt) {
99
+  void monitor_tmc_driver(TMC &st, const char * const axisName, uint8_t &otpw_cnt) {
100 100
     TMC_driver_data data = get_driver_data(st);
101 101
 
102 102
     #if ENABLED(STOP_ON_ERROR)
103 103
       if (data.is_error) {
104 104
         SERIAL_EOL();
105
-        SERIAL_ECHO(axisID);
105
+        SERIAL_ECHO(axisName);
106 106
         SERIAL_ECHOPGM(" driver error detected:");
107 107
         if (data.is_ot) SERIAL_ECHOPGM("\novertemperature");
108 108
         if (st.s2ga()) SERIAL_ECHOPGM("\nshort to ground (coil A)");
@@ -124,7 +124,7 @@ char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1",
124 124
       SERIAL_EOL();
125 125
       SERIAL_ECHO(timestamp);
126 126
       SERIAL_ECHOPGM(": ");
127
-      SERIAL_ECHO(axisID);
127
+      SERIAL_ECHO(axisName);
128 128
       SERIAL_ECHOPGM(" driver overtemperature warning! (");
129 129
       SERIAL_ECHO(st.getCurrent());
130 130
       SERIAL_ECHOLNPGM("mA)");
@@ -134,7 +134,7 @@ char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1",
134 134
       if (data.is_otpw && !st.isEnabled() && otpw_cnt > 4) {
135 135
         st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER);
136 136
         #if ENABLED(REPORT_CURRENT_CHANGE)
137
-          SERIAL_ECHO(axisID);
137
+          SERIAL_ECHO(axisName);
138 138
           SERIAL_ECHOLNPAIR(" current decreased to ", st.getCurrent());
139 139
         #endif
140 140
       }
@@ -148,7 +148,7 @@ char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1",
148 148
 
149 149
     if (report_tmc_status) {
150 150
       const uint32_t pwm_scale = get_pwm_scale(st);
151
-      SERIAL_ECHO(axisID);
151
+      SERIAL_ECHO(axisName);
152 152
       SERIAL_ECHOPAIR(":", pwm_scale);
153 153
       SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN);
154 154
       SERIAL_ECHOPGM("| ");
@@ -169,47 +169,47 @@ char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1",
169 169
       next_cOT = millis() + 500;
170 170
       #if HAS_HW_COMMS(X) || ENABLED(IS_TRAMS)
171 171
         static uint8_t x_otpw_cnt = 0;
172
-        monitor_tmc_driver(stepperX, axis_codes[X_AXIS], x_otpw_cnt);
172
+        monitor_tmc_driver(stepperX, extended_axis_codes[TMC_X], x_otpw_cnt);
173 173
       #endif
174 174
       #if HAS_HW_COMMS(Y) || ENABLED(IS_TRAMS)
175 175
         static uint8_t y_otpw_cnt = 0;
176
-        monitor_tmc_driver(stepperY, axis_codes[Y_AXIS], y_otpw_cnt);
176
+        monitor_tmc_driver(stepperY, extended_axis_codes[TMC_Y], y_otpw_cnt);
177 177
       #endif
178 178
       #if HAS_HW_COMMS(Z) || ENABLED(IS_TRAMS)
179 179
         static uint8_t z_otpw_cnt = 0;
180
-        monitor_tmc_driver(stepperZ, axis_codes[Z_AXIS], z_otpw_cnt);
180
+        monitor_tmc_driver(stepperZ, extended_axis_codes[TMC_Z], z_otpw_cnt);
181 181
       #endif
182 182
       #if HAS_HW_COMMS(X2)
183 183
         static uint8_t x2_otpw_cnt = 0;
184
-        monitor_tmc_driver(stepperX2, axis_codes[X_AXIS], x2_otpw_cnt);
184
+        monitor_tmc_driver(stepperX2, extended_axis_codes[TMC_X], x2_otpw_cnt);
185 185
       #endif
186 186
       #if HAS_HW_COMMS(Y2)
187 187
         static uint8_t y2_otpw_cnt = 0;
188
-        monitor_tmc_driver(stepperY2, axis_codes[Y_AXIS], y2_otpw_cnt);
188
+        monitor_tmc_driver(stepperY2, extended_axis_codes[TMC_Y], y2_otpw_cnt);
189 189
       #endif
190 190
       #if HAS_HW_COMMS(Z2)
191 191
         static uint8_t z2_otpw_cnt = 0;
192
-        monitor_tmc_driver(stepperZ2, axis_codes[Z_AXIS], z2_otpw_cnt);
192
+        monitor_tmc_driver(stepperZ2, extended_axis_codes[TMC_Z], z2_otpw_cnt);
193 193
       #endif
194 194
       #if HAS_HW_COMMS(E0) || ENABLED(IS_TRAMS)
195 195
         static uint8_t e0_otpw_cnt = 0;
196
-        monitor_tmc_driver(stepperE0, axis_codes[E_AXIS], e0_otpw_cnt);
196
+        monitor_tmc_driver(stepperE0, extended_axis_codes[TMC_E0], e0_otpw_cnt);
197 197
       #endif
198 198
       #if HAS_HW_COMMS(E1)
199 199
         static uint8_t e1_otpw_cnt = 0;
200
-        monitor_tmc_driver(stepperE1, axis_codes[E_AXIS], e1_otpw_cnt);
200
+        monitor_tmc_driver(stepperE1, extended_axis_codes[TMC_E1], e1_otpw_cnt);
201 201
       #endif
202 202
       #if HAS_HW_COMMS(E2)
203 203
         static uint8_t e2_otpw_cnt = 0;
204
-        monitor_tmc_driver(stepperE2, axis_codes[E_AXIS], e2_otpw_cnt);
204
+        monitor_tmc_driver(stepperE2, extended_axis_codes[TMC_E2], e2_otpw_cnt);
205 205
       #endif
206 206
       #if HAS_HW_COMMS(E3)
207 207
         static uint8_t e3_otpw_cnt = 0;
208
-        monitor_tmc_driver(stepperE3, axis_codes[E_AXIS], e3_otpw_cnt);
208
+        monitor_tmc_driver(stepperE3, extended_axis_codes[TMC_E3], e3_otpw_cnt);
209 209
       #endif
210 210
       #if HAS_HW_COMMS(E4)
211 211
         static uint8_t e4_otpw_cnt = 0;
212
-        monitor_tmc_driver(stepperE4, axis_codes[E_AXIS], e4_otpw_cnt);
212
+        monitor_tmc_driver(stepperE4, extended_axis_codes[TMC_E4], e4_otpw_cnt);
213 213
       #endif
214 214
 
215 215
       if (report_tmc_status) SERIAL_EOL();
@@ -299,7 +299,7 @@ void _tmc_say_sgt(const char name[], const int8_t sgt) {
299 299
       SERIAL_CHAR(':');
300 300
     }
301 301
     SERIAL_PRINT((drv_status >> 4) & 0xF, HEX);
302
-    SERIAL_PRINT(drv_status & 0xF, HEX);
302
+    SERIAL_PRINT((drv_status) & 0xF, HEX);
303 303
     SERIAL_EOL();
304 304
   }
305 305
 
@@ -376,10 +376,7 @@ void _tmc_say_sgt(const char name[], const int8_t sgt) {
376 376
         break;
377 377
       case TMC_TPWMTHRS_MMS: {
378 378
           uint32_t tpwmthrs_val = st.TPWMTHRS();
379
-          if (tpwmthrs_val)
380
-            SERIAL_ECHO(12650000UL * st.microsteps() / (256 * tpwmthrs_val * spmm));
381
-          else
382
-            SERIAL_CHAR('-');
379
+          tpwmthrs_val ? SERIAL_ECHO(12650000UL * st.microsteps() / (256 * tpwmthrs_val * spmm)) : SERIAL_CHAR('-');
383 380
         }
384 381
         break;
385 382
       case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;

Loading…
İptal
Kaydet