-
Notifications
You must be signed in to change notification settings - Fork 99
Delay STM/decks boot by 5 seconds if AI-deck is attached #102
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
Conversation
|
For flashing to work correctly with the updated delay, you also need the corresponding PR from the Python lib: bitcraze/crazyflie-lib-python#510 |
ataffanel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I think the memory handling code would be nicer if a bit more generic.
- Updated `memoryHasDeck(...)` to take `vid`, `pid`, and `boardName` as parameters, making it more flexible for different deck types. - Introduced `#define MEMORY_BITCRAZE_VID 0xBC`, `#define MEMORY_AIDECK_PID 0x12`, and `#define MEMORY_AIDECK_BOARDNAME "bcAI"` for specifying AI-deck search parameters. - Now calling `memoryHasDeck(MEMORY_BITCRAZE_VID, MEMORY_AIDECK_PID, MEMORY_AIDECK_BOARDNAME)` to check for AI-deck presence. This improves reusability and makes it easier to extend deck detection logic in the future.
- Introduce `DeckInfo` struct to parse the deck header (vid, pid, etc.) instead of using raw offsets. - Compute a 32-bit CRC over the header, comparing its LSB with the stored single-byte CRC in the deck. - Add a second CRC check for the TLV region. - Replace magic offset constants with named macros (e.g. DECK_INFO_HEADER_SIZE, DECK_INFO_TLV_DATA_POS). - Maintain the original logic for board name detection, but ensure any corrupted header or TLV fails early. - Include and reference a separate `crc32_calc.h/.c` for the 32-bit polynomial-based CRC calculations.
ataffanel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loogs great, thanks for the changes!
PR #69 introduced a 1-second delay before booting the STM32 and decks to prevent the GAP8 from freezing. However, we still saw the issue, even when using only the AI-deck. The severity varied depending on the combination of attached decks.
This PR increases the delay to 5 seconds, which, based on testing, significantly improves stability. However, if issues persist, a further increase may be necessary.
Additionally, this PR ensures that the delayed boot is deck-dependent. Now, the delay is only applied when an AI-deck is attached. To achieve this, we read the OW memory during startup. If no AI-deck is present, the previous 1-second delay is removed entirely.