Fix SPI bus contention crash on serial game upload
Serial uploader was crashing the Pico when launching games because it accessed SD card (SPI) while Core 1 was refreshing display (also SPI). Display and SD card share the same SPI bus and cannot be accessed simultaneously. Split game launch into prepare and execute phases: - prepare: Re-scan games directory (safe, SD access done immediately) - execute: Load Lua script from SD (deferred until display is idle) Main loop now checks !is_refresh_in_progress() before completing launch, preventing SPI conflicts. Also updated SD card best practices skill to document SPI bus contention as the #1 most critical issue to avoid. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,13 @@ public:
|
||||
// Returns true if a game was launched
|
||||
bool process();
|
||||
|
||||
// Check if uploader wants to launch a game (after upload complete)
|
||||
bool wants_to_launch_game() const { return state == LAUNCHING_GAME; }
|
||||
|
||||
// Complete the game launch (call only when safe - no display refresh in progress)
|
||||
// Returns true if launch succeeded
|
||||
bool complete_launch();
|
||||
|
||||
// Get the filename of the last uploaded game (without .lua extension)
|
||||
const char* get_last_uploaded_filename() const { return last_uploaded_name; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user