Switch the motors off when the designs are done or stopped
After the last design (or a Stop), the player sends $SLP (GRBL and FluidNC sleep), so the motors stop holding and the table is quiet. The page shows "Motors off"; the next design wakes the controller (reset + unlock) and homes first, since the arm can be moved by hand while the motors are off. The jog panel wakes it too. Setting: motion.motors_off_when_done (default true). Checked on the real Uno: Idle -> $SLP -> Sleep -> reset -> Alarm -> $X -> Idle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8967271e90
commit
7afe562124
10 files changed
+104
-10
No files matched your search
@@ -346,7 +346,33 @@ class Controller:
|
||||
self._presses = 0
|
||||
return self.query()
|
||||
|
||||
def motors_off(self):
|
||||
"""Switch the motors off with the sleep command ($SLP; FluidNC has it too). They stop
|
||||
holding, so the arm turns by hand and the position is lost: before moving again the
|
||||
controller needs waking (a reset, see wake_up) and the table homing."""
|
||||
self.guard = None
|
||||
if self.query().state != 'Sleep':
|
||||
self.command('$SLP')
|
||||
self.query()
|
||||
|
||||
def wake_up(self):
|
||||
"""Out of sleep: only a reset wakes it, and it then waits in ALARM until unlocked."""
|
||||
if self.query().state != 'Sleep':
|
||||
return
|
||||
self.realtime(RT_RESET)
|
||||
t_end, seen = time.monotonic() + 3, None
|
||||
while time.monotonic() < t_end:
|
||||
for line in self._lines():
|
||||
if 'grbl' in line.lower() or 'fluidnc' in line.lower():
|
||||
seen = time.monotonic()
|
||||
if seen and time.monotonic() - seen > 0.2:
|
||||
break
|
||||
time.sleep(0.02)
|
||||
self.pending.clear()
|
||||
self.query()
|
||||
|
||||
def unlock(self):
|
||||
self.wake_up()
|
||||
if self.query().state == 'Alarm':
|
||||
self.command('$X')
|
||||
|
||||
|
||||
Reference in new issue
Block a user