Browse Source

💥 Update Motor Current G-codes for extra axes (#23975)

DerAndere 2 years ago
parent
commit
8aaf64d917
No account linked to committer's email address

+ 4
- 12
Marlin/src/core/serial.cpp View File

@@ -31,19 +31,11 @@ uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
31 31
 
32 32
 // Commonly-used strings in serial output
33 33
 PGMSTR(NUL_STR,   "");   PGMSTR(SP_P_STR, " P");  PGMSTR(SP_T_STR, " T");
34
-PGMSTR(X_STR,     "X");  PGMSTR(Y_STR,     "Y");  PGMSTR(Z_STR,     "Z");  PGMSTR(E_STR,     "E");
35
-PGMSTR(U_STR, STR_U); PGMSTR(V_STR, STR_V); PGMSTR(W_STR, STR_W);
36
-PGMSTR(X_LBL,     "X:"); PGMSTR(Y_LBL,     "Y:"); PGMSTR(Z_LBL,     "Z:"); PGMSTR(E_LBL,     "E:");
37
-PGMSTR(U_LBL, STR_U ":"); PGMSTR(V_LBL, STR_V ":"); PGMSTR(W_LBL, STR_W ":");
38 34
 PGMSTR(SP_A_STR, " A");  PGMSTR(SP_B_STR, " B");  PGMSTR(SP_C_STR, " C");
39
-PGMSTR(SP_X_STR, " X");  PGMSTR(SP_Y_STR, " Y");  PGMSTR(SP_Z_STR, " Z");  PGMSTR(SP_E_STR, " E");
40
-PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");
41
-PGMSTR(I_STR, STR_I);     PGMSTR(J_STR, STR_J);     PGMSTR(K_STR, STR_K);
42
-PGMSTR(I_LBL, STR_I ":"); PGMSTR(J_LBL, STR_J ":"); PGMSTR(K_LBL, STR_K ":");
43
-PGMSTR(SP_I_STR, " " STR_I);     PGMSTR(SP_J_STR, " " STR_J);     PGMSTR(SP_K_STR, " " STR_K);
44
-PGMSTR(SP_U_STR, " " STR_U); PGMSTR(SP_V_STR, " " STR_V); PGMSTR(SP_W_STR, " " STR_W);
45
-PGMSTR(SP_I_LBL, " " STR_I ":"); PGMSTR(SP_J_LBL, " " STR_J ":"); PGMSTR(SP_K_LBL, " " STR_K ":");
46
-PGMSTR(SP_U_LBL, " " STR_U ":"); PGMSTR(SP_V_LBL, " " STR_V ":"); PGMSTR(SP_W_LBL, " " STR_W ":");
35
+LOGICAL_AXIS_CODE(PGMSTR(SP_E_STR, " E"),  PGMSTR(SP_X_STR, " X"),  PGMSTR(SP_Y_STR, " Y"),  PGMSTR(SP_Z_STR, " Z"),  PGMSTR(SP_I_STR, " " STR_I),     PGMSTR(SP_J_STR, " " STR_J),     PGMSTR(SP_K_STR, " " STR_K),     PGMSTR(SP_U_STR, " " STR_U),     PGMSTR(SP_V_STR, " " STR_V),     PGMSTR(SP_W_STR, " " STR_W));
36
+LOGICAL_AXIS_CODE(PGMSTR(SP_E_LBL, " E:"), PGMSTR(SP_X_LBL, " X:"), PGMSTR(SP_Y_LBL, " Y:"), PGMSTR(SP_Z_LBL, " Z:"), PGMSTR(SP_I_LBL, " " STR_I ":"), PGMSTR(SP_J_LBL, " " STR_J ":"), PGMSTR(SP_K_LBL, " " STR_K ":"), PGMSTR(SP_U_LBL, " " STR_U ":"), PGMSTR(SP_V_LBL, " " STR_V ":"), PGMSTR(SP_W_LBL, " " STR_W ":"));
37
+LOGICAL_AXIS_CODE(PGMSTR(E_STR, "E"),  PGMSTR(X_STR, "X"),  PGMSTR(Y_STR, "Y"),  PGMSTR(Z_STR, "Z"),  PGMSTR(I_STR, STR_I),     PGMSTR(J_STR, STR_J),     PGMSTR(K_STR, STR_K),     PGMSTR(U_STR, STR_U),     PGMSTR(V_STR, STR_V),     PGMSTR(W_STR, STR_W));
38
+LOGICAL_AXIS_CODE(PGMSTR(E_LBL, "E:"), PGMSTR(X_LBL, "X:"), PGMSTR(Y_LBL, "Y:"), PGMSTR(Z_LBL, "Z:"), PGMSTR(I_LBL, STR_I ":"), PGMSTR(J_LBL, STR_J ":"), PGMSTR(K_LBL, STR_K ":"), PGMSTR(U_LBL, STR_U ":"), PGMSTR(V_LBL, STR_V ":"), PGMSTR(W_LBL, STR_W ":"));
47 39
 
48 40
 // Hook Meatpack if it's enabled on the first leaf
49 41
 #if ENABLED(MEATPACK_ON_SERIAL_PORT_1)

+ 4
- 4
Marlin/src/core/serial.h View File

@@ -31,10 +31,10 @@
31 31
 // Commonly-used strings in serial output
32 32
 extern const char NUL_STR[], SP_P_STR[], SP_T_STR[],
33 33
                   SP_A_STR[], SP_B_STR[], SP_C_STR[],
34
-                  SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_I_STR[], SP_J_STR[], SP_K_STR[], SP_U_STR[], SP_V_STR[], SP_W_STR[], SP_E_STR[],
35
-                  SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_I_LBL[], SP_J_LBL[], SP_K_LBL[], SP_U_LBL[], SP_V_LBL[], SP_W_LBL[], SP_E_LBL[],
36
-                  X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[], E_STR[],
37
-                  X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[], E_LBL[];
34
+                  LOGICAL_AXIS_LIST(SP_E_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_I_STR[], SP_J_STR[], SP_K_STR[], SP_U_STR[], SP_V_STR[], SP_W_STR[]),
35
+                  LOGICAL_AXIS_LIST(SP_E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_I_LBL[], SP_J_LBL[], SP_K_LBL[], SP_U_LBL[], SP_V_LBL[], SP_W_LBL[]),
36
+                  LOGICAL_AXIS_LIST(E_STR[], X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[]),
37
+                  LOGICAL_AXIS_LIST(E_LBL[], X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[]);
38 38
 
39 39
 PGM_P const SP_AXIS_LBL[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_LBL, SP_X_LBL, SP_Y_LBL, SP_Z_LBL, SP_I_LBL, SP_J_LBL, SP_K_LBL, SP_U_LBL, SP_V_LBL, SP_W_LBL);
40 40
 PGM_P const SP_AXIS_STR[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_STR, SP_X_STR, SP_Y_STR, SP_Z_STR, SP_I_STR, SP_J_STR, SP_K_STR, SP_U_STR, SP_V_STR, SP_W_STR);

+ 6
- 8
Marlin/src/feature/dac/stepper_dac.cpp View File

@@ -60,7 +60,7 @@ int StepperDAC::init() {
60 60
 }
61 61
 
62 62
 void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
63
-  if (!dac_present) return;
63
+  if (!(dac_present && channel < LOGICAL_AXES)) return;
64 64
 
65 65
   NOMORE(val, uint16_t(DAC_STEPPER_MAX));
66 66
 
@@ -85,13 +85,11 @@ void StepperDAC::print_values() {
85 85
   if (!dac_present) return;
86 86
   SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
87 87
   SERIAL_ECHO_START();
88
-  SERIAL_ECHOPGM_P(SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")"));
89
-  #if HAS_Y_AXIS
90
-    SERIAL_ECHOPGM_P(SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")"));
91
-  #endif
92
-  #if HAS_Z_AXIS
93
-    SERIAL_ECHOPGM_P(SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")"));
94
-  #endif
88
+  LOOP_LOGICAL_AXES(a) {
89
+    SERIAL_CHAR(' ', IAXIS_CHAR(a), ':');
90
+    SERIAL_ECHO(dac_perc(a));
91
+    SERIAL_ECHOPGM_P(PSTR(" ("), dac_amps(AxisEnum(a)), PSTR(")"));
92
+  }
95 93
   #if HAS_EXTRUDERS
96 94
     SERIAL_ECHOLNPGM_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
97 95
   #endif

+ 1
- 1
Marlin/src/gcode/calibrate/G34.cpp View File

@@ -79,7 +79,7 @@ void GcodeSuite::G34() {
79 79
     stepper.set_digipot_current(Z_AXIS, target_current);
80 80
   #elif HAS_MOTOR_CURRENT_PWM
81 81
     const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
82
-    const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
82
+    const uint32_t previous_current = stepper.motor_current_setting[1]; // Z
83 83
     stepper.set_digipot_current(1, target_current);
84 84
   #elif HAS_MOTOR_CURRENT_DAC
85 85
     const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);

+ 58
- 32
Marlin/src/gcode/feature/digipot/M907-M910.cpp View File

@@ -40,8 +40,10 @@
40 40
 
41 41
 /**
42 42
  * M907: Set digital trimpot motor current using axis codes X [Y] [Z] [I] [J] [K] [U] [V] [W] [E]
43
- *   B<current> - Special case for 4th (E) axis
44
- *   S<current> - Special case to set first 3 axes
43
+ *   B<current> - Special case for E1 (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451)
44
+ *   C<current> - Special case for E2 (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451)
45
+ *   S<current> - Set current in mA for all axes (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451), or
46
+ *                Set percentage of max current for all axes (Requires HAS_DIGIPOT_DAC)
45 47
  */
46 48
 void GcodeSuite::M907() {
47 49
   #if HAS_MOTOR_CURRENT_SPI
@@ -49,47 +51,65 @@ void GcodeSuite::M907() {
49 51
     if (!parser.seen("BS" LOGICAL_AXES_STRING))
50 52
       return M907_report();
51 53
 
52
-    LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int());
53
-    if (parser.seenval('B')) stepper.set_digipot_current(4, parser.value_int());
54
-    if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.set_digipot_current(i, parser.value_int());
54
+    if (parser.seenval('S')) LOOP_L_N(i, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(i, parser.value_int());
55
+    LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int());    // X Y Z (I J K U V W) E (map to drivers according to DIGIPOT_CHANNELS. Default with NUM_AXES 3: map X Y Z E to X Y Z E0)
56
+    // Additional extruders use B,C.
57
+    // TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B<index>?
58
+    #if E_STEPPERS >= 2
59
+      if (parser.seenval('B')) stepper.set_digipot_current(E_AXIS + 1, parser.value_int());
60
+      #if E_STEPPERS >= 3
61
+        if (parser.seenval('C')) stepper.set_digipot_current(E_AXIS + 2, parser.value_int());
62
+      #endif
63
+    #endif
55 64
 
56 65
   #elif HAS_MOTOR_CURRENT_PWM
57 66
 
58
-    if (!parser.seen(
59
-      #if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K, MOTOR_CURRENT_PWM_U, MOTOR_CURRENT_PWM_V, MOTOR_CURRENT_PWM_W)
60
-        "XY" SECONDARY_AXIS_GANG("I", "J", "K", "U", "V", "W")
67
+    #if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K, MOTOR_CURRENT_PWM_U, MOTOR_CURRENT_PWM_V, MOTOR_CURRENT_PWM_W)
68
+      #define HAS_X_Y_XY_I_J_K_U_V_W 1
69
+    #endif
70
+
71
+    #if HAS_X_Y_XY_I_J_K_U_V_W || ANY_PIN(MOTOR_CURRENT_PWM_E, MOTOR_CURRENT_PWM_Z)
72
+
73
+      if (!parser.seen("S"
74
+        #if HAS_X_Y_XY_I_J_K_U_V_W
75
+          "XY" SECONDARY_AXIS_GANG("I", "J", "K", "U", "V", "W")
76
+        #endif
77
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
78
+          "Z"
79
+        #endif
80
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
81
+          "E"
82
+        #endif
83
+      )) return M907_report();
84
+
85
+      if (parser.seenval('S')) LOOP_L_N(a, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(a, parser.value_int());
86
+
87
+      #if HAS_X_Y_XY_I_J_K_U_V_W
88
+        if (NUM_AXIS_GANG(
89
+               parser.seenval('X'), || parser.seenval('Y'), || false,
90
+            || parser.seenval('I'), || parser.seenval('J'), || parser.seenval('K'),
91
+            || parser.seenval('U'), || parser.seenval('V'), || parser.seenval('W')
92
+        )) stepper.set_digipot_current(0, parser.value_int());
61 93
       #endif
62 94
       #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
63
-        "Z"
95
+        if (parser.seenval('Z')) stepper.set_digipot_current(1, parser.value_int());
64 96
       #endif
65 97
       #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
66
-        "E"
98
+        if (parser.seenval('E')) stepper.set_digipot_current(2, parser.value_int());
67 99
       #endif
68
-    )) return M907_report();
69 100
 
70
-    #if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K, MOTOR_CURRENT_PWM_U, MOTOR_CURRENT_PWM_V, MOTOR_CURRENT_PWM_W)
71
-      if (NUM_AXIS_GANG(
72
-             parser.seenval('X'), || parser.seenval('Y'), || false,
73
-          || parser.seenval('I'), || parser.seenval('J'), || parser.seenval('K'),
74
-          || parser.seenval('U'), || parser.seenval('V'), || parser.seenval('W')
75
-      )) stepper.set_digipot_current(0, parser.value_int());
76
-    #endif
77
-    #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
78
-      if (parser.seenval('Z')) stepper.set_digipot_current(1, parser.value_int());
79
-    #endif
80
-    #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
81
-      if (parser.seenval('E')) stepper.set_digipot_current(2, parser.value_int());
82 101
     #endif
83 102
 
84 103
   #endif // HAS_MOTOR_CURRENT_PWM
85 104
 
86 105
   #if HAS_MOTOR_CURRENT_I2C
87 106
     // this one uses actual amps in floating point
88
-    LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float());
89
-    // Additional extruders use B,C,D for channels 4,5,6.
90
-    // TODO: Change these parameters because 'E' is used. B<index>?
91
-    #if HAS_EXTRUDERS
92
-      for (uint8_t i = E_AXIS + 1; i < DIGIPOT_I2C_NUM_CHANNELS; i++)
107
+    if (parser.seenval('S')) LOOP_L_N(q, DIGIPOT_I2C_NUM_CHANNELS) digipot_i2c.set_current(q, parser.value_float());
108
+      LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float());      // X Y Z (I J K U V W) E (map to drivers according to pots adresses. Default with NUM_AXES 3 X Y Z E: map to X Y Z E0)
109
+    // Additional extruders use B,C,D.
110
+    // TODO: Change these parameters because 'E' is used and because 'D' should be reserved for debugging. B<index>?
111
+    #if E_STEPPERS >= 2
112
+      for (uint8_t i = E_AXIS + 1; i < _MAX(DIGIPOT_I2C_NUM_CHANNELS, (NUM_AXES + 3)); i++)
93 113
         if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c.set_current(i, parser.value_float());
94 114
     #endif
95 115
   #endif
@@ -97,9 +117,9 @@ void GcodeSuite::M907() {
97 117
   #if HAS_MOTOR_CURRENT_DAC
98 118
     if (parser.seenval('S')) {
99 119
       const float dac_percent = parser.value_float();
100
-      LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
120
+      LOOP_LOGICAL_AXES(i) stepper_dac.set_current_percent(i, dac_percent);
101 121
     }
102
-    LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float());
122
+    LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float());   // X Y Z (I J K U V W) E (map to drivers according to DAC_STEPPER_ORDER. Default with NUM_AXES 3: X Y Z E map to X Y Z E0)
103 123
   #endif
104 124
 }
105 125
 
@@ -119,8 +139,14 @@ void GcodeSuite::M907() {
119 139
         SERIAL_CHAR(' ', IAXIS_CHAR(q));
120 140
         SERIAL_ECHO(stepper.motor_current_setting[q]);
121 141
       }
122
-      SERIAL_CHAR(' ', 'B');                                  // B (maps to E1 by default)
123
-      SERIAL_ECHOLN(stepper.motor_current_setting[4]);
142
+      #if E_STEPPERS >= 2
143
+        SERIAL_ECHOPGM_P(PSTR(" B"), stepper.motor_current_setting[E_AXIS + 1]  // B (maps to E1 with NUM_AXES 3 according to DIGIPOT_CHANNELS)
144
+          #if E_STEPPERS >= 3
145
+            , PSTR(" C"), stepper.motor_current_setting[E_AXIS + 2]             // C (mapping to E2 must be defined by DIGIPOT_CHANNELS)
146
+          #endif
147
+        );
148
+      #endif
149
+      SERIAL_EOL();
124 150
     #endif
125 151
   }
126 152
 

+ 18
- 8
Marlin/src/gcode/feature/trinamic/M569.cpp View File

@@ -204,14 +204,24 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
204 204
 
205 205
   if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, F("I2 Z"), true); }
206 206
   if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, F("I3 Z"), true); }
207
-
208
-  if (TERN0( I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_I_STR), true); }
209
-  if (TERN0( J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_J_STR), true); }
210
-  if (TERN0( K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_K_STR), true); }
211
-  if (TERN0( U_HAS_STEALTHCHOP, stepperU.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_U_STR), true); }
212
-  if (TERN0( V_HAS_STEALTHCHOP, stepperV.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_V_STR), true); }
213
-  if (TERN0( W_HAS_STEALTHCHOP, stepperW.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_W_STR), true); }
214
-
207
+  #if HAS_I_AXIS
208
+    if (TERN0(I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_I_STR), true); }
209
+  #endif
210
+  #if HAS_J_AXIS
211
+    if (TERN0(J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_J_STR), true); }
212
+  #endif
213
+  #if HAS_K_AXIS
214
+    if (TERN0(K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_K_STR), true); }
215
+  #endif
216
+  #if HAS_U_AXIS
217
+    if (TERN0(U_HAS_STEALTHCHOP, stepperU.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_U_STR), true); }
218
+  #endif
219
+  #if HAS_V_AXIS
220
+    if (TERN0(V_HAS_STEALTHCHOP, stepperV.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_V_STR), true); }
221
+  #endif
222
+  #if HAS_W_AXIS
223
+    if (TERN0(W_HAS_STEALTHCHOP, stepperW.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_W_STR), true); }
224
+  #endif
215 225
   if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, F("T0 E"), true); }
216 226
   if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, F("T1 E"), true); }
217 227
   if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, F("T2 E"), true); }

+ 9
- 1
Marlin/src/module/settings.cpp View File

@@ -447,7 +447,15 @@ typedef struct SettingsDataStruct {
447 447
   // HAS_MOTOR_CURRENT_PWM
448 448
   //
449 449
   #ifndef MOTOR_CURRENT_COUNT
450
-    #define MOTOR_CURRENT_COUNT NUM_AXES
450
+    #if HAS_MOTOR_CURRENT_PWM
451
+      #define MOTOR_CURRENT_COUNT 3
452
+    #elif HAS_MOTOR_CURRENT_DAC
453
+      #define MOTOR_CURRENT_COUNT LOGICAL_AXES
454
+    #elif HAS_MOTOR_CURRENT_I2C
455
+      #define MOTOR_CURRENT_COUNT DIGIPOT_I2C_NUM_CHANNELS
456
+    #else // HAS_MOTOR_CURRENT_SPI
457
+      #define MOTOR_CURRENT_COUNT DISTINCT_AXES
458
+    #endif
451 459
   #endif
452 460
   uint32_t motor_current_setting[MOTOR_CURRENT_COUNT];  // M907 X Z E ...
453 461
 

+ 37
- 1
Marlin/src/module/stepper.cpp View File

@@ -3367,7 +3367,7 @@ void Stepper::report_positions() {
3367 3367
     if (!initialized) return;
3368 3368
     LOOP_L_N(i, COUNT(motor_current_setting)) {
3369 3369
       switch (i) {
3370
-        #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y)
3370
+        #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K, MOTOR_CURRENT_PWM_U, MOTOR_CURRENT_PWM_V, MOTOR_CURRENT_PWM_W)
3371 3371
           case 0:
3372 3372
         #endif
3373 3373
         #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
@@ -3415,6 +3415,24 @@ void Stepper::report_positions() {
3415 3415
             #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
3416 3416
               _WRITE_CURRENT_PWM(XY);
3417 3417
             #endif
3418
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_I)
3419
+              _WRITE_CURRENT_PWM(I);
3420
+            #endif
3421
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_J)
3422
+              _WRITE_CURRENT_PWM(J);
3423
+            #endif
3424
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_K)
3425
+              _WRITE_CURRENT_PWM(K);
3426
+            #endif
3427
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_U)
3428
+              _WRITE_CURRENT_PWM(U);
3429
+            #endif
3430
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_V)
3431
+              _WRITE_CURRENT_PWM(V);
3432
+            #endif
3433
+            #if PIN_EXISTS(MOTOR_CURRENT_PWM_W)
3434
+              _WRITE_CURRENT_PWM(W);
3435
+            #endif
3418 3436
             break;
3419 3437
           case 1:
3420 3438
             #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
@@ -3464,6 +3482,24 @@ void Stepper::report_positions() {
3464 3482
         #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
3465 3483
           INIT_CURRENT_PWM(XY);
3466 3484
         #endif
3485
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_I)
3486
+          INIT_CURRENT_PWM(I);
3487
+        #endif
3488
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_J)
3489
+          INIT_CURRENT_PWM(J);
3490
+        #endif
3491
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_K)
3492
+          INIT_CURRENT_PWM(K);
3493
+        #endif
3494
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_U)
3495
+          INIT_CURRENT_PWM(U);
3496
+        #endif
3497
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_V)
3498
+          INIT_CURRENT_PWM(V);
3499
+        #endif
3500
+        #if PIN_EXISTS(MOTOR_CURRENT_PWM_W)
3501
+          INIT_CURRENT_PWM(W);
3502
+        #endif
3467 3503
         #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
3468 3504
           INIT_CURRENT_PWM(Z);
3469 3505
         #endif

+ 1
- 1
Marlin/src/module/stepper.h View File

@@ -329,7 +329,7 @@ class Stepper {
329 329
         #ifndef MOTOR_CURRENT_PWM_FREQUENCY
330 330
           #define MOTOR_CURRENT_PWM_FREQUENCY 31400
331 331
         #endif
332
-        #define MOTOR_CURRENT_COUNT NUM_AXES
332
+        #define MOTOR_CURRENT_COUNT 3
333 333
       #elif HAS_MOTOR_CURRENT_SPI
334 334
         static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
335 335
         #define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)

Loading…
Cancel
Save