Fix stepper use before init. Add Ultimaker2+ Extended clone config (#13284)
This commit is contained in:
parent
edc4e037c4
commit
71773b128d
2103
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h
Normal file
2103
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h
Normal file
File diff suppressed because it is too large
Load Diff
2263
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h
Normal file
2263
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -2265,7 +2265,7 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
|
||||
constexpr uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
|
||||
for (uint8_t q = 3; q--;)
|
||||
stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
|
||||
#endif
|
||||
|
@ -81,6 +81,10 @@
|
||||
|
||||
Stepper stepper; // Singleton
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
bool Stepper::initialized; // = false
|
||||
#endif
|
||||
|
||||
#ifdef __AVR__
|
||||
#include "speed_lookuptable.h"
|
||||
#endif
|
||||
@ -2161,6 +2165,9 @@ void Stepper::init() {
|
||||
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
|
||||
|
||||
set_directions();
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
initialized = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2466,6 +2473,7 @@ void Stepper::report_positions() {
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
|
||||
void Stepper::refresh_motor_power() {
|
||||
if (!initialized) return;
|
||||
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
||||
switch (i) {
|
||||
#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
|
||||
|
||||
if (!initialized) return;
|
||||
|
||||
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
||||
motor_current_setting[driver] = current; // update motor_current_setting
|
||||
|
||||
|
@ -239,6 +239,7 @@ class Stepper {
|
||||
#define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
|
||||
#endif
|
||||
static uint32_t motor_current_setting[3];
|
||||
static bool initialized;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -97,6 +97,8 @@
|
||||
#define FAN_PIN 7
|
||||
#endif
|
||||
|
||||
#define ORIG_E0_AUTO_FAN_PIN 77
|
||||
|
||||
//
|
||||
// Misc. Functions
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user