Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in FAST_PWM_FAN and TouchUI with NO_MOTION_BEFORE_HOMING #25005

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Marlin/src/HAL/AVR/fast_pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
LIMIT(res_pc_temp, 1U, maxtop);

// Calculate frequencies of test prescaler and resolution values
const uint32_t f_diff = _MAX(f, f_desired) - _MIN(f, f_desired),
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_pc_temp = (F_CPU) / (2 * p * res_pc_temp),
f_pc_diff = _MAX(f_pc_temp, f_desired) - _MIN(f_pc_temp, f_desired);
const int f_diff = ABS(f - int(f_desired)),
f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)),
f_fast_diff = ABS(f_fast_temp - int(f_desired)),
f_pc_temp = (F_CPU) / (2 * p * res_pc_temp),
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
// Set the Wave Generation Mode to FAST PWM
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ namespace ExtUI {
bool canMove(const axis_t axis) {
switch (axis) {
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
case X: return axis_should_home(X_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))
case X: return !axis_should_home(X_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))
#else
case X: case Y: case Z: return true;
#endif
Expand Down