From 8931f103830a23be4422742d293d2e9da413cc58 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 24 Dec 2023 23:35:47 +0800 Subject: [PATCH] work around boot instability issue with a delay setting up codec in TTS The `codec` seems to hang sometimes during `Setup8kStereo` at boot. Did not get to the bottom of it, but suspect that the RTC I2C init sequence is interfering with the codec init sequence. This might be resolved while also fixing #467, but for now, a short delay on boot works around the problem. --- services/tts/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/services/tts/src/main.rs b/services/tts/src/main.rs index ee616a1d3..6ea668d0e 100644 --- a/services/tts/src/main.rs +++ b/services/tts/src/main.rs @@ -175,6 +175,7 @@ fn main() -> ! { } }); let mut codec = codec::Codec::new(&xns).unwrap(); + tt.sleep_ms(150).unwrap(); // de-congest startup sequence; TODO: make this not a race condition with RTC access. might be related to #467 (insufficiently broad locking of the I2C bus) codec.setup_8k_stream().expect("couldn't setup stream"); tt.sleep_ms(50).unwrap(); codec.set_speaker_volume(VolumeOps::Set, Some(0.0)).unwrap();