Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial multiwake support #264

Merged
merged 6 commits into from
Sep 21, 2023
Merged

Initial multiwake support #264

merged 6 commits into from
Sep 21, 2023

Conversation

stintel
Copy link
Collaborator

@stintel stintel commented Sep 15, 2023

This PR implements handling of multiple Willow devices waking at the same time. With WAS support, only the Willow device with the highest wake word volume will send a command to the endpoint. Without WAS support, Willow will function like before.

It is possible to trigger VAD START before the wake_result is received from WAS, which will cause Willow devices who have lost the wake race to start streaming to WIS already. This should be improved, but will require some refactoring. For now, this should be good enough to demonstrate the feature, but the feature should be considered experimental.

@stintel stintel force-pushed the feature/multiwake branch 3 times, most recently from 8dd390c to a31ac0c Compare September 18, 2023 12:11
stintel and others added 6 commits September 21, 2023 16:34
This requires modifications to ESP-ADF, so we need to bump it to a newer
version.
We currently do LVGL calls when handling AUDIO_REC_WAKEUP_END and
MSG_STOP. We trigger MSG_STOP from AUDIO_REC_WAKEUP_END, so it's better
to consolidate the LVGL calls so we only need to acquire a lock once.

Move the LVGL call from AUDIO_REC_WAKEUP_END to MSG_STOP.
The wake_start message will send the wake audio volume to WAS, needed to
implement multiwake support. When the WAS WebSocket is disconnected,
skip sending the message, as this is latency sensitive, and
re-establishing the connection would take too long. By then, the wake
session would have already expired.

Another problem with trying to reconnect on wake, is that when WAS is
still down, the connection attempt times out and slows down the entire
operation of wake, vad, stream, ... and Willow appears to hang.

Finally, Willow will try to reconnect to WAS anyway.
We cannot write the "WOW Active - Exiting" message from the WAS code, as
it would be overwritten with "Thinking" on AUDIO_REC_WAKEUP_END, which
is triggered by audio_recorder_trigger_stop.
When VAD_START is triggered before we got the multiwake result from WAS,
we have started streaming to WIS already. Use the multiwake_won boolean
to bail out early when handling the HTTP_STREAM_FINISH_REQUEST event, to
avoid updating the UI or playing chimes or TTS when we lost the
multiwake race.

Ideally we only start streaming to WIS once we get the wake result, but
this will require some refactoring.
@stintel stintel merged commit 328b8f9 into main Sep 21, 2023
16 checks passed
@stintel stintel deleted the feature/multiwake branch September 21, 2023 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Willows in earshot of one another should not all wake and stream on wake word
2 participants