mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-23 10:08:57 +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"
|
||||
|
||||
bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) {
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("BLTouch Command :", cmd);
|
||||
servo[Z_PROBE_SERVO_NR].move(cmd);
|
||||
safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay
|
||||
const BLTCommand current = servo[Z_PROBE_SERVO_NR].read();
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("BLTouch from ", current, " to ", cmd);
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue