Added abort to command
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-04-11 14:10:14 +02:00
parent 203b513c9e
commit 964a072e80
4 changed files with 27 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ class ProgramExecutor(Thread):
def abort(self):
self._state = ProgramExecutorStates.ABORTED
# TODO: implement abort
self._program[self._pc].abort()
def get_status(self) -> dict:
return {
@@ -55,7 +55,7 @@ class ProgramExecutor(Thread):
self._state = ProgramExecutorStates.RUNNING
self._logger.info("Start running program")
while True: # needed for loop
while self._state == ProgramExecutorStates.RUNNING: # needed for loop
self._loop_counter += 1
for i, step in enumerate(self._program):
self._pc = i
@@ -69,12 +69,13 @@ class ProgramExecutor(Thread):
self._state = ProgramExecutorStates.CRASHED
return
# TODO: jogging wait
if self._state != ProgramExecutorStates.RUNNING:
self._logger.info(f"State changed to {self._state.name}. Execution will now stop!")
return
if self._loop:
self._logger.debug("Looping program")
else:
self._logger.debug("Program ended")
break
self._state = ProgramExecutorStates.DONE
self._logger.info("Program ended")
self._state = ProgramExecutorStates.DONE
return