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.
This commit is contained in:
bunnie 2023-12-24 23:35:47 +08:00
parent 23a9b0cc34
commit 8931f10383

View file

@ -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();