UltiMachine Archim 1 support (#12404)
This commit is contained in:
@ -2407,13 +2407,13 @@ void Stepper::report_positions() {
|
||||
void Stepper::refresh_motor_power() {
|
||||
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
||||
switch (i) {
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
||||
case 0:
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
case 1:
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E) || PIN_EXISTS(MOTOR_CURRENT_PWM_E0) || PIN_EXISTS(MOTOR_CURRENT_PWM_E1)
|
||||
case 2:
|
||||
#endif
|
||||
digipot_current(i, motor_current_setting[i]);
|
||||
@ -2426,7 +2426,7 @@ void Stepper::report_positions() {
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
|
||||
|
||||
void Stepper::digipot_current(const uint8_t driver, const int current) {
|
||||
void Stepper::digipot_current(const uint8_t driver, const int16_t current) {
|
||||
|
||||
#if HAS_DIGIPOTSS
|
||||
|
||||
@ -2440,15 +2440,33 @@ void Stepper::report_positions() {
|
||||
|
||||
#define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE))
|
||||
switch (driver) {
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||
case 0: _WRITE_CURRENT_PWM(XY); break;
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
case 1: _WRITE_CURRENT_PWM(Z); break;
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||
case 2: _WRITE_CURRENT_PWM(E); break;
|
||||
#endif
|
||||
case 0:
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
|
||||
_WRITE_CURRENT_PWM(X);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
||||
_WRITE_CURRENT_PWM(Y);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||
_WRITE_CURRENT_PWM(XY);
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
_WRITE_CURRENT_PWM(Z);
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||
_WRITE_CURRENT_PWM(E);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E0)
|
||||
_WRITE_CURRENT_PWM(E0);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E1)
|
||||
_WRITE_CURRENT_PWM(E1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -2469,6 +2487,12 @@ void Stepper::report_positions() {
|
||||
|
||||
#elif HAS_MOTOR_CURRENT_PWM
|
||||
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_X_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_Y_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN);
|
||||
#endif
|
||||
@ -2478,12 +2502,19 @@ void Stepper::report_positions() {
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E0)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_E0_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E1)
|
||||
SET_OUTPUT(MOTOR_CURRENT_PWM_E1_PIN);
|
||||
#endif
|
||||
|
||||
refresh_motor_power();
|
||||
|
||||
// Set Timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise)
|
||||
SET_CS5(PRESCALER_1);
|
||||
|
||||
#ifdef __AVR__
|
||||
SET_CS5(PRESCALER_1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2587,6 +2618,7 @@ void Stepper::report_positions() {
|
||||
SET_OUTPUT(E5_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const uint8_t microstep_modes[] = MICROSTEP_MODES;
|
||||
for (uint16_t i = 0; i < COUNT(microstep_modes); i++)
|
||||
microstep_mode(i, microstep_modes[i]);
|
||||
|
Reference in New Issue
Block a user