🔨🩹 Misc. code corrections, notes
This commit is contained in:
@@ -51,10 +51,25 @@ void GcodeSuite::M907() {
|
||||
if (!parser.seen("BS" STR_AXES_LOGICAL))
|
||||
return M907_report();
|
||||
|
||||
if (parser.seenval('S')) for (uint8_t i = 0; i < MOTOR_CURRENT_COUNT; ++i) stepper.set_digipot_current(i, 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)
|
||||
// Additional extruders use B,C.
|
||||
// TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B<index>?
|
||||
// S<current> - Set current in mA for all axes
|
||||
if (parser.seenval('S'))
|
||||
for (uint8_t i = 0; i < MOTOR_CURRENT_COUNT; ++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)
|
||||
LOOP_LOGICAL_AXES(i)
|
||||
if (parser.seenval(IAXIS_CHAR(i)))
|
||||
stepper.set_digipot_current(i, parser.value_int());
|
||||
|
||||
/**
|
||||
* Additional extruders use B,C in this legacy protocol
|
||||
* TODO: Update to allow for an index with X, Y, Z, E axis to isolate a single stepper
|
||||
* and use configured axis names instead of IJKUVW. i.e., Match the behavior of
|
||||
* other G-codes that set stepper-specific parameters. If necessary deprecate G-codes.
|
||||
* Bonus Points: Standardize a method that all G-codes can use to refer to one or
|
||||
* more steppers/drivers and apply to various G-codes.
|
||||
*/
|
||||
#if E_STEPPERS >= 2
|
||||
if (parser.seenval('B')) stepper.set_digipot_current(E_AXIS + 1, parser.value_int());
|
||||
#if E_STEPPERS >= 3
|
||||
@@ -72,14 +87,12 @@ void GcodeSuite::M907() {
|
||||
|
||||
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")
|
||||
NUM_AXIS_GANG("X", "Y",, "I", "J", "K", "U", "V", "W")
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
"Z"
|
||||
#endif
|
||||
#if HAS_MOTOR_CURRENT_PWM_E
|
||||
"E"
|
||||
#endif
|
||||
TERN_(HAS_MOTOR_CURRENT_PWM_E, "E")
|
||||
)) return M907_report();
|
||||
|
||||
if (parser.seenval('S')) for (uint8_t a = 0; a < MOTOR_CURRENT_COUNT; ++a) stepper.set_digipot_current(a, parser.value_int());
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#endif
|
||||
|
||||
// If an axis's Homing Current differs from standard current...
|
||||
#define HAS_HOME_CURRENT(N) (N##_CURRENT_HOME > 0 && N##_CURRENT_HOME != N##_CURRENT)
|
||||
#define HAS_HOME_CURRENT(N) TERN0(EDITABLE_HOMING_CURRENT, N##_IS_TRINAMIC && N##_HOME_DIR != 0) || (N##_CURRENT_HOME > 0 && N##_CURRENT_HOME != N##_CURRENT)
|
||||
#if HAS_HOME_CURRENT(X)
|
||||
#define X_HAS_HOME_CURRENT 1
|
||||
#endif
|
||||
|
||||
@@ -1890,7 +1890,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
/**
|
||||
* ULTIPANEL encoder
|
||||
*/
|
||||
#if IS_ULTIPANEL && NONE(IS_NEWPANEL, SR_LCD_2W_NL) && !PIN_EXISTS(SHIFT_CLK)
|
||||
#if IS_ULTIPANEL && NONE(HAS_ROTARY_ENCODER, SR_LCD_2W_NL, SR_LCD_3W_NL) && !PIN_EXISTS(SHIFT_CLK)
|
||||
#error "ULTIPANEL controllers require some kind of encoder."
|
||||
#endif
|
||||
|
||||
@@ -4041,11 +4041,11 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
|
||||
#elif _PIN_CONFLICT(CONTROLLERFAN)
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with CONTROLLERFAN_PIN."
|
||||
#elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_XY)
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_XY."
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_XY_PIN."
|
||||
#elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_Z)
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_Z."
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_Z_PIN."
|
||||
#elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_E)
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_E."
|
||||
#error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_E_PIN."
|
||||
#endif
|
||||
#endif
|
||||
#undef _PIN_CONFLICT
|
||||
|
||||
@@ -3673,7 +3673,7 @@ void Stepper::report_positions() {
|
||||
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
|
||||
|
||||
void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) {
|
||||
if (WITHIN(driver, 0, MOTOR_CURRENT_COUNT - 1))
|
||||
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
||||
motor_current_setting[driver] = current; // update motor_current_setting
|
||||
|
||||
if (!initialized) return;
|
||||
|
||||
Reference in New Issue
Block a user