Skip to content

Commit

Permalink
⚡️ Skip a redundant BLTouch::command (MarlinFirmware#25656)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfries authored and EvilGremlin committed May 17, 2023
1 parent b17a2b8 commit a90ff99
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Marlin/src/feature/bltouch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit a90ff99

Please sign in to comment.