From 9bc2efd1c8ea8c3babdf26ad187df0949c9cba39 Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 1 Jun 2022 23:33:34 +0200 Subject: [PATCH 1/5] Fix redraw and back button behaviour for file browser --- main/file_browser.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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) { From e1030d13631517c5811d2021adb6d3a1b8384822 Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 1 Jun 2022 23:35:22 +0200 Subject: [PATCH 2/5] Disable sensor init and make boot much faster --- main/main.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) 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) { From 1caca379f1b64d361d9276712b636065a12b016f Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 1 Jun 2022 23:35:50 +0200 Subject: [PATCH 3/5] Set menu color to black for launcher and settings menus --- main/menus/launcher.c | 2 +- main/menus/settings.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; } From 9983ef8b11f322e989a7189f43b87b9b52792797 Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 1 Jun 2022 23:36:20 +0200 Subject: [PATCH 4/5] Update RP2040 firmware --- resources/rp2040_firmware.bin | Bin 36084 -> 36076 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/resources/rp2040_firmware.bin b/resources/rp2040_firmware.bin index c50baefd957db68fcda43b581556434d32bf4f91..89d7459314583a46ed8744d17b18b15c30827bf8 100755 GIT binary patch delta 2301 zcmcgteQZ=!7Qg3x%uHKK?`)}UnNEE(W7k$%3N77MK%E)Z`RGtuD_W!~ZBdzS6ov*9 zVAL5JltwX9?}`O%sC2(rq845;W?|g=!6vxN+6fvkhFxR{rP5|ESvH-1OlQw4gR8{E z_>V97z2CX#{O-Nyo_Ftk*Y*e_dxTwQ<-B&FRh{P=LRDxC5Ta~KBg)85poB<@h8dfp ztpT5aJIy2Uyclu+`#*Ac;7Gtth+&kR$I#$r?5pGxC1L?83qTKAfi^ryh>q0P9a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X=LR)+Kla+Sv(yViVBg$Pb~_bvi-`-`(*&w)iWNA4Myk0{R%X zx!&sf?$I}z-p;Ctr~@HP0?`6M9!Y>^LpCo1AdY=OTaXwtaov zR)Hzt8TbgI3gJWeS;yYJ5MzbS#maWvqdWN4<_)s?!%CnpmjFHD26_P>8`%Z44_`R6 K2I#S!K>rO=WV_J- From 2ba444477ce7eb4cff5c73086677a8eac5c8b13c Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 1 Jun 2022 23:36:33 +0200 Subject: [PATCH 5/5] Return result, disable PMOD plug test --- main/fpga_test.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) 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); }