mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-02-02 15:06:29 +00:00
⚡️ Skip a redundant BLTouch::command (#25656)
This commit is contained in:
parent
cf1f56f132
commit
b5ccd65fb5
1 changed files with 8 additions and 3 deletions
|
@ -42,9 +42,14 @@ bool BLTouch::od_5v_mode; // Initialized by settings.load, 0 = Open Drai
|
||||||
#include "../core/debug_out.h"
|
#include "../core/debug_out.h"
|
||||||
|
|
||||||
bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) {
|
bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) {
|
||||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("BLTouch Command :", cmd);
|
const BLTCommand current = servo[Z_PROBE_SERVO_NR].read();
|
||||||
servo[Z_PROBE_SERVO_NR].move(cmd);
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("BLTouch from ", current, " to ", cmd);
|
||||||
safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay
|
// If the new command is the same, skip it (and the delay).
|
||||||
|
// The previous write should've already delayed to detect the alarm.
|
||||||
|
if (cmd != current) {
|
||||||
|
servo[Z_PROBE_SERVO_NR].move(cmd);
|
||||||
|
safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay
|
||||||
|
}
|
||||||
return triggered();
|
return triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue