Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tools/docker_bin_output/
tools/docker_bin_output/
.flash-venv/
**/.flash-venv/
.claude/settings.local.json
Binary file modified binaries-esp32s3/adv/M5MonsterC5-CardputerADV-adv-full.bin
Binary file not shown.
Binary file modified binaries-esp32s3/adv/M5MonsterC5-CardputerADV-adv.bin
Binary file not shown.
Binary file modified binaries-esp32s3/adv/M5MonsterC5-CardputerADV.bin
Binary file not shown.
Binary file modified binaries-esp32s3/adv/bootloader-adv.bin
Binary file not shown.
Binary file modified binaries-esp32s3/adv/bootloader.bin
Binary file not shown.
16 changes: 7 additions & 9 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ bool is_board_sd_missing(void)
static void uart_sd_check_line_callback(const char *line, void *user_data)
{
(void)user_data;
if (!line || board_sd_missing || !board_sd_check_pending) {
if (!line || !board_sd_check_pending) {
return;
}

if (strstr(line, "Failed to initialize SD card") != NULL ||
strstr(line, "ESP_ERR_INVALID_RESPONSE") != NULL ||
strstr(line, "Make sure SD card is properly inserted.") != NULL ||
strstr(line, "Command returned non-zero error code") != NULL) {
if (strcmp(line, "SD_OK") == 0) {
board_sd_check_pending = false;
} else if (strcmp(line, "SD_NONE") == 0) {
board_sd_missing = true;
board_sd_check_pending = false;
}
Expand Down Expand Up @@ -180,11 +179,10 @@ void app_main(void)

if (board_detected) {
ESP_LOGI(TAG, "ESP32C5 board detected");
ESP_LOGI(TAG, "Checking Monster SD card via list_sd...");
vTaskDelay(pdMS_TO_TICKS(1000)); // Let JanOS finish SD init before querying
ESP_LOGI(TAG, "Checking Monster SD card via sd_status...");
board_sd_check_pending = true;
board_sd_check_start_ms = esp_timer_get_time() / 1000;
uart_send_command("list_sd");
uart_send_command("sd_status");
} else {
ESP_LOGW(TAG, "Continuing without board detection");
}
Expand Down Expand Up @@ -269,7 +267,7 @@ void app_main(void)
// Stop listening for SD check after a short timeout
if (board_sd_check_pending) {
int64_t now_ms = esp_timer_get_time() / 1000;
if ((now_ms - board_sd_check_start_ms) > 3000) {
if ((now_ms - board_sd_check_start_ms) > 500) {
board_sd_check_pending = false;
}
}
Expand Down
Loading