frappy_psi.phytron: stop motor before restart

restarting the phytron motor without prior stop leads
to funny behaviour.

- send stop before restart
- stop motor when moving but status not busy
- restart when motor drives the wrong way

+ better status text when stopping

Change-Id: I82cd59297b3c79a354a4eeb5ba03fc65bedf755f
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31929
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2023-08-09 15:03:12 +02:00
parent 2272aecf0f
commit 501b781144
2 changed files with 79 additions and 25 deletions

View File

@@ -89,7 +89,10 @@ class HasStates:
elif newstate:
# restart case
if status is not None:
status = sm.status[0], f'restarting ({status[1]})'
if sm.status[1] == status[1]:
status = sm.status
else:
status = sm.status[0], f'restarting ({status[1]})'
else:
# start case
status = self.get_status(sm.next_task.newstate, BUSY)