first round of bugfixes...
This commit is contained in:
parent
6bb685779d
commit
114c8fc321
2 changed files with 9 additions and 22 deletions
|
@ -3,8 +3,9 @@ import sys
|
||||||
import click
|
import click
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .statemachine import Statemachine, State
|
from pizzactrl.statemachine import Statemachine, State
|
||||||
from . import sb_de, sb_en
|
from pizzactrl.sb_showcase import STORYBOARD
|
||||||
|
from pizzactrl.hal_serial import PizzaHAL
|
||||||
|
|
||||||
logger = logging.getLogger('pizzactrl.main')
|
logger = logging.getLogger('pizzactrl.main')
|
||||||
|
|
||||||
|
@ -20,18 +21,14 @@ def main(move: bool=False, test: bool=False, debug: bool=False, loop: bool=False
|
||||||
else:
|
else:
|
||||||
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
||||||
|
|
||||||
sm = Statemachine(story_de=sb_de.STORYBOARD,
|
hal = PizzaHAL()
|
||||||
story_en=sb_en.STORYBOARD,
|
sm = Statemachine(hal, STORYBOARD, move=move, loop=loop, test=test)
|
||||||
move=move,
|
|
||||||
loop=loop)
|
|
||||||
sm.test = test
|
sm.test = test
|
||||||
|
|
||||||
exitcode = 0
|
exitcode = 0
|
||||||
try:
|
try:
|
||||||
sm.run()
|
sm.run()
|
||||||
except Exception:
|
|
||||||
logger.exception('An Error occurred while running the statemachine')
|
|
||||||
exitcode = 1
|
|
||||||
finally:
|
finally:
|
||||||
if sm.state is State.ERROR:
|
if sm.state is State.ERROR:
|
||||||
exitcode = 2
|
exitcode = 2
|
||||||
|
@ -39,16 +36,5 @@ def main(move: bool=False, test: bool=False, debug: bool=False, loop: bool=False
|
||||||
sys.exit(exitcode)
|
sys.exit(exitcode)
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option('--time', help='Safety deactivation time', type=float,
|
|
||||||
default=13.2)
|
|
||||||
def rewind(time: float):
|
|
||||||
from . import hal
|
|
||||||
pizza = hal.PizzaHAL()
|
|
||||||
hal.rewind(pizza.motor_ud, pizza.ud_sensor, max_time=time)
|
|
||||||
hal.turn_off(pizza)
|
|
||||||
del pizza
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -161,7 +161,7 @@ class Statemachine:
|
||||||
self.story.hal = self.hal
|
self.story.hal = self.hal
|
||||||
fs_names.generate_session_id()
|
fs_names.generate_session_id()
|
||||||
|
|
||||||
while self.story.hasnext():
|
while self.story.hasnext() and self.hal.lid_open:
|
||||||
self.story.play_chapter()
|
self.story.play_chapter()
|
||||||
self.story.advance_chapter()
|
self.story.advance_chapter()
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ class Statemachine:
|
||||||
# logger.debug('Converting video...')
|
# logger.debug('Converting video...')
|
||||||
# cmdstring = f'MP4Box -add {fs_names.REC_DRAW_CITY} {fs_names.REC_MERGED_VIDEO}'
|
# cmdstring = f'MP4Box -add {fs_names.REC_DRAW_CITY} {fs_names.REC_MERGED_VIDEO}'
|
||||||
# call([cmdstring], shell=True)
|
# call([cmdstring], shell=True)
|
||||||
|
self.hal.flush_serial()
|
||||||
self._next_state()
|
self._next_state()
|
||||||
|
|
||||||
def _rewind(self):
|
def _rewind(self):
|
||||||
|
@ -183,6 +183,7 @@ class Statemachine:
|
||||||
Rewind all scrolls, post-process videos
|
Rewind all scrolls, post-process videos
|
||||||
"""
|
"""
|
||||||
turn_off(self.hal)
|
turn_off(self.hal)
|
||||||
|
self.story.skip_flag = False
|
||||||
self.story.rewind()
|
self.story.rewind()
|
||||||
|
|
||||||
if self.loop:
|
if self.loop:
|
||||||
|
|
Loading…
Reference in a new issue