Add sanity checks to Linear Advance 1.5 (#9859)
This commit is contained in:
parent
f7b44ac2a6
commit
951b65c2de
2 changed files with 23 additions and 8 deletions
|
|
@ -10469,14 +10469,19 @@ inline void gcode_M502() {
|
|||
* K<factor> Set advance K factor
|
||||
*/
|
||||
inline void gcode_M900() {
|
||||
stepper.synchronize();
|
||||
|
||||
const float newK = parser.floatval('K', -1);
|
||||
if (newK >= 0) planner.extruder_advance_K = newK;
|
||||
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR("Advance K=", planner.extruder_advance_K);
|
||||
SERIAL_EOL();
|
||||
if (parser.seenval('K')) {
|
||||
const float newK = parser.floatval('K');
|
||||
if (WITHIN(newK, 0, 10)) {
|
||||
stepper.synchronize();
|
||||
planner.extruder_advance_K = newK;
|
||||
}
|
||||
else
|
||||
SERIAL_PROTOCOLLNPGM("?K value out of range (0-10).");
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K);
|
||||
}
|
||||
}
|
||||
#endif // LIN_ADVANCE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue