ports/stm32: Fix microspeech demo.

- Need to poll events to schedule the audio callback after switching
from pendsv.
- Fixes #1904
This commit is contained in:
iabdalkader 2023-09-25 12:27:18 +02:00
parent 0aa18ec11b
commit 0648071141
3 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ audio.start_streaming(speech.audio_callback)
while True:
# Run micro-speech without a timeout and filter detections by label index.
idx = speech.listen(model, timeout=0, threshold=0.78, filter=[2, 3])
idx = speech.listen(model, timeout=0, threshold=0.70, filter=[2, 3])
led = led_green if idx == 2 else led_red
print(labels[idx])
for i in range(0, 4):

View File

@ -23,7 +23,7 @@ audio.start_streaming(speech.audio_callback)
while True:
# Run micro-speech without a timeout and filter detections by label index.
idx = speech.listen(model, timeout=0, threshold=0.78, filter=[2, 3])
idx = speech.listen(model, timeout=0, threshold=0.70, filter=[2, 3])
led = led_green if idx == 2 else led_red
print(labels[idx])
for i in range(0, 4):

View File

@ -170,7 +170,7 @@ STATIC mp_obj_t py_micro_speech_listen(uint n_args, const mp_obj_t *args, mp_map
uint32_t start = HAL_GetTick();
while (timeout == 0 || (HAL_GetTick() - start) < timeout) {
__WFI();
MICROPY_EVENT_POLL_HOOK
if (microspeech->new_slices == false) {
continue;