|
|
@ -81,6 +81,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
Stepper stepper; // Singleton
|
|
|
|
Stepper stepper; // Singleton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_MOTOR_CURRENT_PWM
|
|
|
|
|
|
|
|
bool Stepper::initialized; // = false
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __AVR__
|
|
|
|
#ifdef __AVR__
|
|
|
|
#include "speed_lookuptable.h"
|
|
|
|
#include "speed_lookuptable.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2161,6 +2165,9 @@ void Stepper::init() {
|
|
|
|
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
|
|
|
|
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
|
|
|
|
|
|
|
|
|
|
|
|
set_directions();
|
|
|
|
set_directions();
|
|
|
|
|
|
|
|
#if HAS_MOTOR_CURRENT_PWM
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -2466,6 +2473,7 @@ void Stepper::report_positions() {
|
|
|
|
#if HAS_MOTOR_CURRENT_PWM
|
|
|
|
#if HAS_MOTOR_CURRENT_PWM
|
|
|
|
|
|
|
|
|
|
|
|
void Stepper::refresh_motor_power() {
|
|
|
|
void Stepper::refresh_motor_power() {
|
|
|
|
|
|
|
|
if (!initialized) return;
|
|
|
|
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
|
|
|
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
|
|
|
switch (i) {
|
|
|
|
switch (i) {
|
|
|
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
|
|
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
|
|
@ -2498,6 +2506,8 @@ void Stepper::report_positions() {
|
|
|
|
|
|
|
|
|
|
|
|
#elif HAS_MOTOR_CURRENT_PWM
|
|
|
|
#elif HAS_MOTOR_CURRENT_PWM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!initialized) return;
|
|
|
|
|
|
|
|
|
|
|
|
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
|
|
|
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
|
|
|
motor_current_setting[driver] = current; // update motor_current_setting
|
|
|
|
motor_current_setting[driver] = current; // update motor_current_setting
|
|
|
|
|
|
|
|
|
|
|
|