Bugfixes...

This commit is contained in:
jpunkt 2021-11-04 14:21:33 +01:00
parent 711454a06c
commit 939a8b4e4a
2 changed files with 25 additions and 22 deletions

View file

@ -35,6 +35,7 @@ class SerialCommands(Enum):
BACKLIGHT = 'B'
FRONTLIGHT = 'F'
USER_INTERACTION = 'U'
RECORD = 'C'
REWIND = 'R'
@ -135,7 +136,7 @@ def wait_for_input(hal: PizzaHAL, go_callback: Any,
:param to_callback: called on timeout
:param timeout: inactivity timeout in seconds (default 120)
"""
resp = hal.send_cmd(SerialCommands.USER_INTERACTION, timeout)
resp = hal.send_cmd(SerialCommands.USER_INTERACTION, timeout).strip()
if resp == 'B':
go_callback(**kwargs)
elif resp == 'R':
@ -208,7 +209,10 @@ def record_sound(hal: PizzaHAL, filename: Any, duration: int,
myrecording = sd.rec(int(duration * AUDIO_REC_SR),
samplerate=AUDIO_REC_SR,
channels=2)
# TODO user interaction instead
resp = hal.send_cmd(SerialCommands.RECORD, duration).strip()
if resp == 'I':
sd.stop()
else:
sd.wait() # Wait until recording is finished
# TODO test
myrecording = np.int16(myrecording)

View file

@ -2,43 +2,42 @@ from pizzactrl import storyboard, fs_names
STORYBOARD = [
storyboard.Chapter(
# storyboard.Do(storyboard.Activity.ADVANCE_UP),
storyboard.Do(storyboard.Activity.LIGHT_BACK, # Bild 1
storyboard.Do(storyboard.Activity.LIGHT_LAYER, # VERT01
intensity=1.0, fade=1.0)
),
storyboard.Chapter(
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('03en')),
sound=fs_names.StoryFile('01en')),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('02en')),
storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
storyboard.Do(storyboard.Activity.ADVANCE_UP) # Bild 2
storyboard.Do(storyboard.Activity.ADVANCE_UP) # VERT02up
),
storyboard.Chapter(
storyboard.Do(storyboard.Activity.LIGHT_BACK, # Bild 1
intensity=1.0, fade=1.0),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('04en')),
storyboard.Do(storyboard.Activity.ADVANCE_UP), # Bild 3
sound=fs_names.StoryFile('03en')),
storyboard.Do(storyboard.Activity.ADVANCE_UP), # VERT02down
storyboard.Do(storyboard.Activity.LIGHT_BACK,
intensity=1.0, fade=0.5),
storyboard.Do(storyboard.Activity.LIGHT_LAYER,
intensity=0.0, fade=0.5),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('05en')),
storyboard.Do(storyboard.Activity.ADVANCE_UP), # VERT03
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('06en')),
storyboard.Do(storyboard.Activity.LIGHT_BACK,
intensity=0.0, fade=1.0),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('07en')),
storyboard.Do(storyboard.Activity.ADVANCE_UP), # Bild 4
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('08en')),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('09en')),
storyboard.Do(storyboard.Activity.LIGHT_BACK,
intensity=0.0),
storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
storyboard.Do(storyboard.Activity.ADVANCE_UP), # Bild 5
storyboard.Do(storyboard.Activity.ADVANCE_UP), # VERT04
storyboard.Do(storyboard.Activity.LIGHT_LAYER,
intensity=1.0, fade=1.0),
),
storyboard.Chapter(
storyboard.Do(storyboard.Activity.LIGHT_BACK,
intensity=1.0),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('10en')),
sound=fs_names.StoryFile('08en')),
storyboard.Do(storyboard.Activity.PLAY_SOUND,
sound=fs_names.StoryFile('11en')),
storyboard.Do(storyboard.Activity.PLAY_SOUND,