diff --git a/main/file_browser.c b/main/file_browser.c index 719c02b..0a5cf91 100644 --- a/main/file_browser.c +++ b/main/file_browser.c @@ -142,12 +142,9 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9 closedir(dir); bool render = true; + bool renderbg = true; bool exit = false; file_browser_menu_args_t* menuArgs = NULL; - - pax_background(pax_buffer, 0xFFFFFF); - pax_noclip(pax_buffer); - pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] install [B] back"); while (1) { rp2040_input_message_t buttonMessage = {0}; @@ -171,6 +168,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9 if (value) { menuArgs = pd_args; } + break; case RP2040_INPUT_BUTTON_ACCEPT: case RP2040_INPUT_JOYSTICK_PRESS: if (value) { @@ -184,9 +182,16 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9 break; } } + + if (renderbg) { + pax_background(pax_buffer, 0xFFFFFF); + pax_noclip(pax_buffer); + pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] install [B] back"); + renderbg = false; + } if (render) { - menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF72008a); + menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF000000); ili9341_write(ili9341, pax_buffer->buf); render = false; } @@ -201,6 +206,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9 } menuArgs = NULL; render = true; + renderbg = true; } if (exit) { diff --git a/main/fpga_test.c b/main/fpga_test.c index 74b2a26..a621c76 100644 --- a/main/fpga_test.c +++ b/main/fpga_test.c @@ -480,9 +480,7 @@ static bool run_test(ICE40* ice40, pax_buf_t* pax_buffer, const pax_font_t *font } while (0) -static void -run_all_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341) -{ +bool run_fpga_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341) { const pax_font_t *font; int line = 0; bool ok = true; @@ -510,23 +508,23 @@ run_all_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI RUN_TEST("PMOD open", test_pmod_open); /* Show instructions for interactive test */ - pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+ 0, "Insert PMOD plug"); + /*pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+ 0, "Insert PMOD plug"); pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+10, "Then press button for interactive test"); pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+20, " - Check LCD color bars"); pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+30, " - Then LCD & RGB led color cycling"); - ili9341_write(ili9341, pax_buffer->buf); + ili9341_write(ili9341, pax_buffer->buf);*/ /* Wait for button */ - wait_button(buttonQueue); + //wait_button(buttonQueue); /* Clear the instructions from buffer */ - pax_draw_rect(pax_buffer, 0xff8060f0, 0, 20*line, 320, 240-20*line); + //pax_draw_rect(pax_buffer, 0xff8060f0, 0, 20*line, 320, 240-20*line); /* Handover LCD to FPGA */ ili9341_deinit(ili9341); /* Run interactive tests */ - RUN_TEST("PMOD plug", test_pmod_plug); + //RUN_TEST("PMOD plug", test_pmod_plug); RUN_TEST("LCD init", test_lcd_init); /* Wait a second (for user to see color bars) */ @@ -536,7 +534,9 @@ run_all_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI soc_message(ice40, SOC_CMD_LCD_RGB_CYCLE_SET, 1, NULL, 0); /* Wait for button */ - wait_button(buttonQueue); + if (!wait_button(buttonQueue)) { + ok = false; + } /* Stop LCD / RGB cycling */ soc_message(ice40, SOC_CMD_LCD_RGB_CYCLE_SET, 0, NULL, 0); @@ -550,21 +550,19 @@ error: /* Pass / Fail result on screen */ if (ok) - pax_draw_text(pax_buffer, 0xff00ff00, font, 36, 100, 20*line, "PASS"); + pax_draw_text(pax_buffer, 0xff00ff00, font, 36, 0, 20*line, "FPGA PASS"); else - pax_draw_text(pax_buffer, 0xffff0000, font, 36, 100, 20*line, "FAIL"); + pax_draw_text(pax_buffer, 0xffff0000, font, 36, 0, 20*line, "FPGA FAIL"); ili9341_write(ili9341, pax_buffer->buf); - /* Done, just wait for button */ - wait_button(buttonQueue); - /* Cleanup */ ice40_disable(ice40); - return; + return ok; } void fpga_test(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341) { - run_all_tests(buttonQueue, ice40, pax_buffer, ili9341); + run_fpga_tests(buttonQueue, ice40, pax_buffer, ili9341); + wait_button(buttonQueue); } diff --git a/main/main.c b/main/main.c index 6bed481..1b5f8a3 100644 --- a/main/main.c +++ b/main/main.c @@ -102,10 +102,10 @@ void app_main(void) { esp_restart(); } + display_boot_screen(pax_buffer, ili9341, "Starting..."); + audio_init(); - display_boot_screen(pax_buffer, ili9341, "Initializing RP2040..."); - if (bsp_rp2040_init() != ESP_OK) { ESP_LOGE(TAG, "Failed to initialize the RP2040 co-processor"); display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "RP2040 co-processor error", NULL, NULL); @@ -120,16 +120,14 @@ void app_main(void) { rp2040_updater(rp2040, pax_buffer, ili9341); // Handle RP2040 firmware update & bootloader mode - uint8_t rp2040_uid[8]; + /*uint8_t rp2040_uid[8]; if (rp2040_get_uid(rp2040, rp2040_uid) != ESP_OK) { ESP_LOGE(TAG, "Failed to get RP2040 UID"); display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "Failed to read UID", NULL, NULL); esp_restart(); } - printf("RP2040 UID: %02X%02X%02X%02X%02X%02X%02X%02X\n", rp2040_uid[0], rp2040_uid[1], rp2040_uid[2], rp2040_uid[3], rp2040_uid[4], rp2040_uid[5], rp2040_uid[6], rp2040_uid[7]); - - display_boot_screen(pax_buffer, ili9341, "Initializing ICE40..."); + printf("RP2040 UID: %02X%02X%02X%02X%02X%02X%02X%02X\n", rp2040_uid[0], rp2040_uid[1], rp2040_uid[2], rp2040_uid[3], rp2040_uid[4], rp2040_uid[5], rp2040_uid[6], rp2040_uid[7]);*/ if (bsp_ice40_init() != ESP_OK) { ESP_LOGE(TAG, "Failed to initialize the ICE40 FPGA"); @@ -143,7 +141,7 @@ void app_main(void) { esp_restart(); } - display_boot_screen(pax_buffer, ili9341, "Initializing BNO055..."); + /*display_boot_screen(pax_buffer, ili9341, "Initializing BNO055..."); if (bsp_bno055_init() != ESP_OK) { ESP_LOGE(TAG, "Failed to initialize the BNO055 position sensor"); @@ -155,9 +153,9 @@ void app_main(void) { if (bno055 == NULL) { ESP_LOGE(TAG, "bno055 is NULL"); esp_restart(); - } + }*/ - display_boot_screen(pax_buffer, ili9341, "Initializing BME680..."); + /*display_boot_screen(pax_buffer, ili9341, "Initializing BME680..."); if (bsp_bme680_init() != ESP_OK) { ESP_LOGE(TAG, "Failed to initialize the BME680 position sensor"); @@ -169,9 +167,9 @@ void app_main(void) { if (bme680 == NULL) { ESP_LOGE(TAG, "bme680 is NULL"); esp_restart(); - } + }*/ - display_boot_screen(pax_buffer, ili9341, "Initializing AppFS..."); + //display_boot_screen(pax_buffer, ili9341, "Initializing AppFS..."); /* Start AppFS */ res = appfs_init(); @@ -181,7 +179,7 @@ void app_main(void) { esp_restart(); } - display_boot_screen(pax_buffer, ili9341, "Initializing NVS..."); + //display_boot_screen(pax_buffer, ili9341, "Initializing NVS..."); /* Start NVS */ res = nvs_init(); @@ -191,7 +189,7 @@ void app_main(void) { esp_restart(); } - display_boot_screen(pax_buffer, ili9341, "Initializing filesystem..."); + //display_boot_screen(pax_buffer, ili9341, "Initializing filesystem..."); /* Start internal filesystem */ const esp_partition_t* fs_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, "locfd"); @@ -220,8 +218,6 @@ void app_main(void) { if (sdcard_ready) { ESP_LOGI(TAG, "SD card filesystem mounted"); } - - play_bootsound(); /* Start LEDs */ ws2812_init(GPIO_LED_DATA); @@ -230,6 +226,9 @@ void app_main(void) { /* Start WiFi */ wifi_init(); + + /* Rick that roll */ + play_bootsound(); /* Launcher menu */ while (true) { diff --git a/main/menus/launcher.c b/main/menus/launcher.c index dbf4902..e65e1dd 100644 --- a/main/menus/launcher.c +++ b/main/menus/launcher.c @@ -87,7 +87,7 @@ void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili } if (render) { - menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF72008a); + menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF000000); ili9341_write(ili9341, pax_buffer->buf); render = false; } diff --git a/main/menus/settings.c b/main/menus/settings.c index c840187..eaaa2e6 100644 --- a/main/menus/settings.c +++ b/main/menus/settings.c @@ -86,7 +86,7 @@ void menu_settings(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili } if (render) { - menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF2f55a8); + menu_render(pax_buffer, menu, 0, 0, 320, 220, 0xFF000000); ili9341_write(ili9341, pax_buffer->buf); render = false; } diff --git a/resources/rp2040_firmware.bin b/resources/rp2040_firmware.bin index c50baef..89d7459 100755 Binary files a/resources/rp2040_firmware.bin and b/resources/rp2040_firmware.bin differ