💥 Update Motor Current G-codes for extra axes (#23975)
This commit is contained in:
parent
5005c7b64c
commit
8aaf64d917
|
@ -31,19 +31,11 @@ uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
|
||||||
|
|
||||||
// Commonly-used strings in serial output
|
// Commonly-used strings in serial output
|
||||||
PGMSTR(NUL_STR, ""); PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T");
|
PGMSTR(NUL_STR, ""); PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T");
|
||||||
PGMSTR(X_STR, "X"); PGMSTR(Y_STR, "Y"); PGMSTR(Z_STR, "Z"); PGMSTR(E_STR, "E");
|
|
||||||
PGMSTR(U_STR, STR_U); PGMSTR(V_STR, STR_V); PGMSTR(W_STR, STR_W);
|
|
||||||
PGMSTR(X_LBL, "X:"); PGMSTR(Y_LBL, "Y:"); PGMSTR(Z_LBL, "Z:"); PGMSTR(E_LBL, "E:");
|
|
||||||
PGMSTR(U_LBL, STR_U ":"); PGMSTR(V_LBL, STR_V ":"); PGMSTR(W_LBL, STR_W ":");
|
|
||||||
PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
|
PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
|
||||||
PGMSTR(SP_X_STR, " X"); PGMSTR(SP_Y_STR, " Y"); PGMSTR(SP_Z_STR, " Z"); PGMSTR(SP_E_STR, " E");
|
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));
|
||||||
PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");
|
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 ":"));
|
||||||
PGMSTR(I_STR, STR_I); PGMSTR(J_STR, STR_J); PGMSTR(K_STR, STR_K);
|
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));
|
||||||
PGMSTR(I_LBL, STR_I ":"); PGMSTR(J_LBL, STR_J ":"); PGMSTR(K_LBL, STR_K ":");
|
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 ":"));
|
||||||
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);
|
|
||||||
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 ":");
|
|
||||||
|
|
||||||
// Hook Meatpack if it's enabled on the first leaf
|
// Hook Meatpack if it's enabled on the first leaf
|
||||||
#if ENABLED(MEATPACK_ON_SERIAL_PORT_1)
|
#if ENABLED(MEATPACK_ON_SERIAL_PORT_1)
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
// Commonly-used strings in serial output
|
// Commonly-used strings in serial output
|
||||||
extern const char NUL_STR[], SP_P_STR[], SP_T_STR[],
|
extern const char NUL_STR[], SP_P_STR[], SP_T_STR[],
|
||||||
SP_A_STR[], SP_B_STR[], SP_C_STR[],
|
SP_A_STR[], SP_B_STR[], SP_C_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[], SP_E_STR[],
|
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[]),
|
||||||
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[],
|
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[]),
|
||||||
X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[], E_STR[],
|
LOGICAL_AXIS_LIST(E_STR[], X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[]),
|
||||||
X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[], E_LBL[];
|
LOGICAL_AXIS_LIST(E_LBL[], X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[]);
|
||||||
|
|
||||||
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);
|
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);
|
||||||
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);
|
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);
|
||||||
|
|
|
@ -60,7 +60,7 @@ int StepperDAC::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
|
void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
|
||||||
if (!dac_present) return;
|
if (!(dac_present && channel < LOGICAL_AXES)) return;
|
||||||
|
|
||||||
NOMORE(val, uint16_t(DAC_STEPPER_MAX));
|
NOMORE(val, uint16_t(DAC_STEPPER_MAX));
|
||||||
|
|
||||||
|
@ -85,13 +85,11 @@ void StepperDAC::print_values() {
|
||||||
if (!dac_present) return;
|
if (!dac_present) return;
|
||||||
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
|
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOPGM_P(SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")"));
|
LOOP_LOGICAL_AXES(a) {
|
||||||
#if HAS_Y_AXIS
|
SERIAL_CHAR(' ', IAXIS_CHAR(a), ':');
|
||||||
SERIAL_ECHOPGM_P(SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")"));
|
SERIAL_ECHO(dac_perc(a));
|
||||||
#endif
|
SERIAL_ECHOPGM_P(PSTR(" ("), dac_amps(AxisEnum(a)), PSTR(")"));
|
||||||
#if HAS_Z_AXIS
|
}
|
||||||
SERIAL_ECHOPGM_P(SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")"));
|
|
||||||
#endif
|
|
||||||
#if HAS_EXTRUDERS
|
#if HAS_EXTRUDERS
|
||||||
SERIAL_ECHOLNPGM_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
|
SERIAL_ECHOLNPGM_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,7 +79,7 @@ void GcodeSuite::G34() {
|
||||||
stepper.set_digipot_current(Z_AXIS, target_current);
|
stepper.set_digipot_current(Z_AXIS, target_current);
|
||||||
#elif HAS_MOTOR_CURRENT_PWM
|
#elif HAS_MOTOR_CURRENT_PWM
|
||||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||||
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
|
const uint32_t previous_current = stepper.motor_current_setting[1]; // Z
|
||||||
stepper.set_digipot_current(1, target_current);
|
stepper.set_digipot_current(1, target_current);
|
||||||
#elif HAS_MOTOR_CURRENT_DAC
|
#elif HAS_MOTOR_CURRENT_DAC
|
||||||
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
|
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
|
||||||
|
|
|
@ -40,8 +40,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M907: Set digital trimpot motor current using axis codes X [Y] [Z] [I] [J] [K] [U] [V] [W] [E]
|
* M907: Set digital trimpot motor current using axis codes X [Y] [Z] [I] [J] [K] [U] [V] [W] [E]
|
||||||
* B<current> - Special case for 4th (E) axis
|
* B<current> - Special case for E1 (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451)
|
||||||
* S<current> - Special case to set first 3 axes
|
* C<current> - Special case for E2 (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451)
|
||||||
|
* S<current> - Set current in mA for all axes (Requires DIGIPOTSS_PIN or DIGIPOT_MCP4018 or DIGIPOT_MCP4451), or
|
||||||
|
* Set percentage of max current for all axes (Requires HAS_DIGIPOT_DAC)
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M907() {
|
void GcodeSuite::M907() {
|
||||||
#if HAS_MOTOR_CURRENT_SPI
|
#if HAS_MOTOR_CURRENT_SPI
|
||||||
|
@ -49,47 +51,65 @@ void GcodeSuite::M907() {
|
||||||
if (!parser.seen("BS" LOGICAL_AXES_STRING))
|
if (!parser.seen("BS" LOGICAL_AXES_STRING))
|
||||||
return M907_report();
|
return M907_report();
|
||||||
|
|
||||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int());
|
if (parser.seenval('S')) LOOP_L_N(i, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(i, parser.value_int());
|
||||||
if (parser.seenval('B')) stepper.set_digipot_current(4, parser.value_int());
|
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)
|
||||||
if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.set_digipot_current(i, parser.value_int());
|
// Additional extruders use B,C.
|
||||||
|
// TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B<index>?
|
||||||
|
#if E_STEPPERS >= 2
|
||||||
|
if (parser.seenval('B')) stepper.set_digipot_current(E_AXIS + 1, parser.value_int());
|
||||||
|
#if E_STEPPERS >= 3
|
||||||
|
if (parser.seenval('C')) stepper.set_digipot_current(E_AXIS + 2, parser.value_int());
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif HAS_MOTOR_CURRENT_PWM
|
#elif HAS_MOTOR_CURRENT_PWM
|
||||||
|
|
||||||
if (!parser.seen(
|
#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)
|
||||||
#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)
|
#define HAS_X_Y_XY_I_J_K_U_V_W 1
|
||||||
"XY" SECONDARY_AXIS_GANG("I", "J", "K", "U", "V", "W")
|
#endif
|
||||||
|
|
||||||
|
#if HAS_X_Y_XY_I_J_K_U_V_W || ANY_PIN(MOTOR_CURRENT_PWM_E, MOTOR_CURRENT_PWM_Z)
|
||||||
|
|
||||||
|
if (!parser.seen("S"
|
||||||
|
#if HAS_X_Y_XY_I_J_K_U_V_W
|
||||||
|
"XY" SECONDARY_AXIS_GANG("I", "J", "K", "U", "V", "W")
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
|
"Z"
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||||
|
"E"
|
||||||
|
#endif
|
||||||
|
)) return M907_report();
|
||||||
|
|
||||||
|
if (parser.seenval('S')) LOOP_L_N(a, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(a, parser.value_int());
|
||||||
|
|
||||||
|
#if HAS_X_Y_XY_I_J_K_U_V_W
|
||||||
|
if (NUM_AXIS_GANG(
|
||||||
|
parser.seenval('X'), || parser.seenval('Y'), || false,
|
||||||
|
|| parser.seenval('I'), || parser.seenval('J'), || parser.seenval('K'),
|
||||||
|
|| parser.seenval('U'), || parser.seenval('V'), || parser.seenval('W')
|
||||||
|
)) stepper.set_digipot_current(0, parser.value_int());
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
"Z"
|
if (parser.seenval('Z')) stepper.set_digipot_current(1, parser.value_int());
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||||
"E"
|
if (parser.seenval('E')) stepper.set_digipot_current(2, parser.value_int());
|
||||||
#endif
|
#endif
|
||||||
)) return M907_report();
|
|
||||||
|
|
||||||
#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)
|
|
||||||
if (NUM_AXIS_GANG(
|
|
||||||
parser.seenval('X'), || parser.seenval('Y'), || false,
|
|
||||||
|| parser.seenval('I'), || parser.seenval('J'), || parser.seenval('K'),
|
|
||||||
|| parser.seenval('U'), || parser.seenval('V'), || parser.seenval('W')
|
|
||||||
)) stepper.set_digipot_current(0, parser.value_int());
|
|
||||||
#endif
|
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
|
||||||
if (parser.seenval('Z')) stepper.set_digipot_current(1, parser.value_int());
|
|
||||||
#endif
|
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
|
||||||
if (parser.seenval('E')) stepper.set_digipot_current(2, parser.value_int());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // HAS_MOTOR_CURRENT_PWM
|
#endif // HAS_MOTOR_CURRENT_PWM
|
||||||
|
|
||||||
#if HAS_MOTOR_CURRENT_I2C
|
#if HAS_MOTOR_CURRENT_I2C
|
||||||
// this one uses actual amps in floating point
|
// this one uses actual amps in floating point
|
||||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float());
|
if (parser.seenval('S')) LOOP_L_N(q, DIGIPOT_I2C_NUM_CHANNELS) digipot_i2c.set_current(q, parser.value_float());
|
||||||
// Additional extruders use B,C,D for channels 4,5,6.
|
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)
|
||||||
// TODO: Change these parameters because 'E' is used. B<index>?
|
// Additional extruders use B,C,D.
|
||||||
#if HAS_EXTRUDERS
|
// TODO: Change these parameters because 'E' is used and because 'D' should be reserved for debugging. B<index>?
|
||||||
for (uint8_t i = E_AXIS + 1; i < DIGIPOT_I2C_NUM_CHANNELS; i++)
|
#if E_STEPPERS >= 2
|
||||||
|
for (uint8_t i = E_AXIS + 1; i < _MAX(DIGIPOT_I2C_NUM_CHANNELS, (NUM_AXES + 3)); i++)
|
||||||
if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c.set_current(i, parser.value_float());
|
if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c.set_current(i, parser.value_float());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,9 +117,9 @@ void GcodeSuite::M907() {
|
||||||
#if HAS_MOTOR_CURRENT_DAC
|
#if HAS_MOTOR_CURRENT_DAC
|
||||||
if (parser.seenval('S')) {
|
if (parser.seenval('S')) {
|
||||||
const float dac_percent = parser.value_float();
|
const float dac_percent = parser.value_float();
|
||||||
LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
|
LOOP_LOGICAL_AXES(i) stepper_dac.set_current_percent(i, dac_percent);
|
||||||
}
|
}
|
||||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float());
|
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)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +139,14 @@ void GcodeSuite::M907() {
|
||||||
SERIAL_CHAR(' ', IAXIS_CHAR(q));
|
SERIAL_CHAR(' ', IAXIS_CHAR(q));
|
||||||
SERIAL_ECHO(stepper.motor_current_setting[q]);
|
SERIAL_ECHO(stepper.motor_current_setting[q]);
|
||||||
}
|
}
|
||||||
SERIAL_CHAR(' ', 'B'); // B (maps to E1 by default)
|
#if E_STEPPERS >= 2
|
||||||
SERIAL_ECHOLN(stepper.motor_current_setting[4]);
|
SERIAL_ECHOPGM_P(PSTR(" B"), stepper.motor_current_setting[E_AXIS + 1] // B (maps to E1 with NUM_AXES 3 according to DIGIPOT_CHANNELS)
|
||||||
|
#if E_STEPPERS >= 3
|
||||||
|
, PSTR(" C"), stepper.motor_current_setting[E_AXIS + 2] // C (mapping to E2 must be defined by DIGIPOT_CHANNELS)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
SERIAL_EOL();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,14 +204,24 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
|
||||||
|
|
||||||
if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, F("I2 Z"), true); }
|
if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, F("I2 Z"), true); }
|
||||||
if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, F("I3 Z"), true); }
|
if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, F("I3 Z"), true); }
|
||||||
|
#if HAS_I_AXIS
|
||||||
if (TERN0( I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_I_STR), true); }
|
if (TERN0(I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_I_STR), true); }
|
||||||
if (TERN0( J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_J_STR), true); }
|
#endif
|
||||||
if (TERN0( K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_K_STR), true); }
|
#if HAS_J_AXIS
|
||||||
if (TERN0( U_HAS_STEALTHCHOP, stepperU.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_U_STR), true); }
|
if (TERN0(J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_J_STR), true); }
|
||||||
if (TERN0( V_HAS_STEALTHCHOP, stepperV.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_V_STR), true); }
|
#endif
|
||||||
if (TERN0( W_HAS_STEALTHCHOP, stepperW.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_W_STR), true); }
|
#if HAS_K_AXIS
|
||||||
|
if (TERN0(K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_K_STR), true); }
|
||||||
|
#endif
|
||||||
|
#if HAS_U_AXIS
|
||||||
|
if (TERN0(U_HAS_STEALTHCHOP, stepperU.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_U_STR), true); }
|
||||||
|
#endif
|
||||||
|
#if HAS_V_AXIS
|
||||||
|
if (TERN0(V_HAS_STEALTHCHOP, stepperV.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_V_STR), true); }
|
||||||
|
#endif
|
||||||
|
#if HAS_W_AXIS
|
||||||
|
if (TERN0(W_HAS_STEALTHCHOP, stepperW.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_W_STR), true); }
|
||||||
|
#endif
|
||||||
if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, F("T0 E"), true); }
|
if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, F("T0 E"), true); }
|
||||||
if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, F("T1 E"), true); }
|
if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, F("T1 E"), true); }
|
||||||
if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, F("T2 E"), true); }
|
if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, F("T2 E"), true); }
|
||||||
|
|
|
@ -447,7 +447,15 @@ typedef struct SettingsDataStruct {
|
||||||
// HAS_MOTOR_CURRENT_PWM
|
// HAS_MOTOR_CURRENT_PWM
|
||||||
//
|
//
|
||||||
#ifndef MOTOR_CURRENT_COUNT
|
#ifndef MOTOR_CURRENT_COUNT
|
||||||
#define MOTOR_CURRENT_COUNT NUM_AXES
|
#if HAS_MOTOR_CURRENT_PWM
|
||||||
|
#define MOTOR_CURRENT_COUNT 3
|
||||||
|
#elif HAS_MOTOR_CURRENT_DAC
|
||||||
|
#define MOTOR_CURRENT_COUNT LOGICAL_AXES
|
||||||
|
#elif HAS_MOTOR_CURRENT_I2C
|
||||||
|
#define MOTOR_CURRENT_COUNT DIGIPOT_I2C_NUM_CHANNELS
|
||||||
|
#else // HAS_MOTOR_CURRENT_SPI
|
||||||
|
#define MOTOR_CURRENT_COUNT DISTINCT_AXES
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
uint32_t motor_current_setting[MOTOR_CURRENT_COUNT]; // M907 X Z E ...
|
uint32_t motor_current_setting[MOTOR_CURRENT_COUNT]; // M907 X Z E ...
|
||||||
|
|
||||||
|
|
|
@ -3367,7 +3367,7 @@ void Stepper::report_positions() {
|
||||||
if (!initialized) return;
|
if (!initialized) return;
|
||||||
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
#if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y)
|
#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)
|
||||||
case 0:
|
case 0:
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
|
@ -3415,6 +3415,24 @@ void Stepper::report_positions() {
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||||
_WRITE_CURRENT_PWM(XY);
|
_WRITE_CURRENT_PWM(XY);
|
||||||
#endif
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_I)
|
||||||
|
_WRITE_CURRENT_PWM(I);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_J)
|
||||||
|
_WRITE_CURRENT_PWM(J);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_K)
|
||||||
|
_WRITE_CURRENT_PWM(K);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_U)
|
||||||
|
_WRITE_CURRENT_PWM(U);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_V)
|
||||||
|
_WRITE_CURRENT_PWM(V);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_W)
|
||||||
|
_WRITE_CURRENT_PWM(W);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
|
@ -3464,6 +3482,24 @@ void Stepper::report_positions() {
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||||
INIT_CURRENT_PWM(XY);
|
INIT_CURRENT_PWM(XY);
|
||||||
#endif
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_I)
|
||||||
|
INIT_CURRENT_PWM(I);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_J)
|
||||||
|
INIT_CURRENT_PWM(J);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_K)
|
||||||
|
INIT_CURRENT_PWM(K);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_U)
|
||||||
|
INIT_CURRENT_PWM(U);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_V)
|
||||||
|
INIT_CURRENT_PWM(V);
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_W)
|
||||||
|
INIT_CURRENT_PWM(W);
|
||||||
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
INIT_CURRENT_PWM(Z);
|
INIT_CURRENT_PWM(Z);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -329,7 +329,7 @@ class Stepper {
|
||||||
#ifndef MOTOR_CURRENT_PWM_FREQUENCY
|
#ifndef MOTOR_CURRENT_PWM_FREQUENCY
|
||||||
#define MOTOR_CURRENT_PWM_FREQUENCY 31400
|
#define MOTOR_CURRENT_PWM_FREQUENCY 31400
|
||||||
#endif
|
#endif
|
||||||
#define MOTOR_CURRENT_COUNT NUM_AXES
|
#define MOTOR_CURRENT_COUNT 3
|
||||||
#elif HAS_MOTOR_CURRENT_SPI
|
#elif HAS_MOTOR_CURRENT_SPI
|
||||||
static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
|
static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
|
||||||
#define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)
|
#define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)
|
||||||
|
|
Loading…
Reference in a new issue