Fix FAST_PWM_FAN / TouchUI with NO_MOTION_BEFORE_HOMING (#25005)
Fix regressions from #20323, #23463
This commit is contained in:
parent
968f04defb
commit
473d2b888a
@ -146,11 +146,11 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
|
|||||||
LIMIT(res_pc_temp, 1U, maxtop);
|
LIMIT(res_pc_temp, 1U, maxtop);
|
||||||
|
|
||||||
// Calculate frequencies of test prescaler and resolution values
|
// Calculate frequencies of test prescaler and resolution values
|
||||||
const uint32_t f_diff = _MAX(f, f_desired) - _MIN(f, f_desired),
|
const int f_diff = ABS(f - int(f_desired)),
|
||||||
f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)),
|
f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)),
|
||||||
f_fast_diff = _MAX(f_fast_temp, f_desired) - _MIN(f_fast_temp, f_desired),
|
f_fast_diff = ABS(f_fast_temp - int(f_desired)),
|
||||||
f_pc_temp = (F_CPU) / (2 * p * res_pc_temp),
|
f_pc_temp = (F_CPU) / (2 * p * res_pc_temp),
|
||||||
f_pc_diff = _MAX(f_pc_temp, f_desired) - _MIN(f_pc_temp, f_desired);
|
f_pc_diff = ABS(f_pc_temp - int(f_desired));
|
||||||
|
|
||||||
if (f_fast_diff < f_diff && f_fast_diff <= f_pc_diff) { // FAST values are closest to desired f
|
if (f_fast_diff < f_diff && f_fast_diff <= f_pc_diff) { // FAST values are closest to desired f
|
||||||
// Set the Wave Generation Mode to FAST PWM
|
// Set the Wave Generation Mode to FAST PWM
|
||||||
|
@ -375,9 +375,9 @@ namespace ExtUI {
|
|||||||
bool canMove(const axis_t axis) {
|
bool canMove(const axis_t axis) {
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
|
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||||
case X: return axis_should_home(X_AXIS);
|
case X: return !axis_should_home(X_AXIS);
|
||||||
OPTCODE(HAS_Y_AXIS, case Y: return axis_should_home(Y_AXIS))
|
OPTCODE(HAS_Y_AXIS, case Y: return !axis_should_home(Y_AXIS))
|
||||||
OPTCODE(HAS_Z_AXIS, case Z: return axis_should_home(Z_AXIS))
|
OPTCODE(HAS_Z_AXIS, case Z: return !axis_should_home(Z_AXIS))
|
||||||
#else
|
#else
|
||||||
case X: case Y: case Z: return true;
|
case X: case Y: case Z: return true;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user