Repository navigation
Conversation
MainTask held g_i2cMutex across the entire notecardWaitConnection() loop, which can block for up to NOTEHUB_CONNECT_TIMEOUT_MS (30s), starving every other I2C bus user (sensor reads, audio, command polls) for the full duration. Inline the poll loop in MainTask so the mutex is acquired and released per 1s connection probe and is free during the inter-probe delay. PVD shutdown is still checked each iteration. Closes review finding M5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding M5
MainTaskacquiredg_i2cMutexand held it across the wholenotecardWaitConnection(NOTEHUB_CONNECT_TIMEOUT_MS)call (SongbirdTasks.cpp:372-375). That call polls connection status every 1s for up to 30 seconds, so any other task needing the I2C bus (sensor reads, audio via Qwiic buzzer, command polls) was blocked for up to 30s on boot.Fix
Inline the connection poll loop directly in
MainTask:notecardIsConnected()for a single probe, release the mutex.vTaskDelay(1000)with the bus released during the delay.notecardWaitConnection()remains part of the public Notecard API for other callers; MainTask no longer uses it so it can keep the bus free between probes.Testing
Not host-testable — this is FreeRTOS mutex/timing behavior on the STM32 target with no native harness. Verification gate is a clean dual-env build.
Build
pio run— both envs pass (blues_cygnet + cygnet_debug SUCCESS).Closes review finding M5