Skip to content

Commit 1f1ca34

Browse files
committed
πŸ§‘β€πŸ’» Tweak limit_and_warn
1 parent 8d4ab15 commit 1f1ca34

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

β€ŽMarlin/src/module/planner.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -3320,16 +3320,12 @@ void Planner::refresh_positioning() {
33203320
}
33213321

33223322
// Apply limits to a variable and give a warning if the value was out of range
3323-
inline void limit_and_warn(float &val, const AxisEnum axis, PGM_P const setting_name, const xyze_float_t &max_limit) {
3323+
inline void limit_and_warn(float &val, const AxisEnum axis, FSTR_P const setting_name, const xyze_float_t &max_limit) {
33243324
const uint8_t lim_axis = TERN_(HAS_EXTRUDERS, axis > E_AXIS ? E_AXIS :) axis;
33253325
const float before = val;
33263326
LIMIT(val, 0.1f, max_limit[lim_axis]);
3327-
if (before != val) {
3328-
SERIAL_CHAR(AXIS_CHAR(lim_axis));
3329-
SERIAL_ECHOPGM(" Max ");
3330-
SERIAL_ECHOPGM_P(setting_name);
3331-
SERIAL_ECHOLNPGM(" limited to ", val);
3332-
}
3327+
if (before != val)
3328+
SERIAL_ECHOLN(C(AXIS_CHAR(lim_axis)), F(" Max "), setting_name, F(" limited to "), val);
33333329
}
33343330

33353331
/**
@@ -3348,7 +3344,7 @@ void Planner::set_max_acceleration(const AxisEnum axis, float inMaxAccelMMS2) {
33483344
constexpr xyze_float_t max_accel_edit = DEFAULT_MAX_ACCELERATION;
33493345
const xyze_float_t max_acc_edit_scaled = max_accel_edit * 2;
33503346
#endif
3351-
limit_and_warn(inMaxAccelMMS2, axis, PSTR("Acceleration"), max_acc_edit_scaled);
3347+
limit_and_warn(inMaxAccelMMS2, axis, F("Acceleration"), max_acc_edit_scaled);
33523348
#endif
33533349
settings.max_acceleration_mm_per_s2[axis] = inMaxAccelMMS2;
33543350

@@ -3371,7 +3367,7 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) {
33713367
constexpr xyze_float_t max_fr_edit = DEFAULT_MAX_FEEDRATE;
33723368
const xyze_float_t max_fr_edit_scaled = max_fr_edit * 2;
33733369
#endif
3374-
limit_and_warn(inMaxFeedrateMMS, axis, PSTR("Feedrate"), max_fr_edit_scaled);
3370+
limit_and_warn(inMaxFeedrateMMS, axis, F("Feedrate"), max_fr_edit_scaled);
33753371
#endif
33763372
settings.max_feedrate_mm_s[axis] = inMaxFeedrateMMS;
33773373
}
@@ -3394,7 +3390,7 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) {
33943390
(DEFAULT_ZJERK) * 2, (DEFAULT_EJERK) * 2 }
33953391
#endif
33963392
;
3397-
limit_and_warn(inMaxJerkMMS, axis, PSTR("Jerk"), max_jerk_edit);
3393+
limit_and_warn(inMaxJerkMMS, axis, F("Jerk"), max_jerk_edit);
33983394
#endif
33993395
max_jerk[axis] = inMaxJerkMMS;
34003396
}

0 commit comments

Comments
Β (0)