Merge pull request #51 from badgeteam/renze/small_fixes

Small fixes
This commit is contained in:
Renze Nicolai 2022-06-01 23:44:46 +02:00 committed by GitHub
commit 19c6a589e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 38 deletions

View file

@ -142,12 +142,9 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9
closedir(dir); closedir(dir);
bool render = true; bool render = true;
bool renderbg = true;
bool exit = false; bool exit = false;
file_browser_menu_args_t* menuArgs = NULL; 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) { while (1) {
rp2040_input_message_t buttonMessage = {0}; rp2040_input_message_t buttonMessage = {0};
@ -171,6 +168,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9
if (value) { if (value) {
menuArgs = pd_args; menuArgs = pd_args;
} }
break;
case RP2040_INPUT_BUTTON_ACCEPT: case RP2040_INPUT_BUTTON_ACCEPT:
case RP2040_INPUT_JOYSTICK_PRESS: case RP2040_INPUT_JOYSTICK_PRESS:
if (value) { if (value) {
@ -184,9 +182,16 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9
break; 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) { 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); ili9341_write(ili9341, pax_buffer->buf);
render = false; render = false;
} }
@ -201,6 +206,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9
} }
menuArgs = NULL; menuArgs = NULL;
render = true; render = true;
renderbg = true;
} }
if (exit) { if (exit) {

View file

@ -480,9 +480,7 @@ static bool run_test(ICE40* ice40, pax_buf_t* pax_buffer, const pax_font_t *font
} while (0) } while (0)
static void bool run_fpga_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341) {
run_all_tests(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341)
{
const pax_font_t *font; const pax_font_t *font;
int line = 0; int line = 0;
bool ok = true; 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); RUN_TEST("PMOD open", test_pmod_open);
/* Show instructions for interactive test */ /* 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+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+20, " - Check LCD color bars");
pax_draw_text(pax_buffer, 0xffc0c0c0, font, 9, 25, 20*line+30, " - Then LCD & RGB led color cycling"); 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 for button */
wait_button(buttonQueue); //wait_button(buttonQueue);
/* Clear the instructions from buffer */ /* 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 */ /* Handover LCD to FPGA */
ili9341_deinit(ili9341); ili9341_deinit(ili9341);
/* Run interactive tests */ /* Run interactive tests */
RUN_TEST("PMOD plug", test_pmod_plug); //RUN_TEST("PMOD plug", test_pmod_plug);
RUN_TEST("LCD init", test_lcd_init); RUN_TEST("LCD init", test_lcd_init);
/* Wait a second (for user to see color bars) */ /* 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); soc_message(ice40, SOC_CMD_LCD_RGB_CYCLE_SET, 1, NULL, 0);
/* Wait for button */ /* Wait for button */
wait_button(buttonQueue); if (!wait_button(buttonQueue)) {
ok = false;
}
/* Stop LCD / RGB cycling */ /* Stop LCD / RGB cycling */
soc_message(ice40, SOC_CMD_LCD_RGB_CYCLE_SET, 0, NULL, 0); soc_message(ice40, SOC_CMD_LCD_RGB_CYCLE_SET, 0, NULL, 0);
@ -550,21 +550,19 @@ error:
/* Pass / Fail result on screen */ /* Pass / Fail result on screen */
if (ok) 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 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); ili9341_write(ili9341, pax_buffer->buf);
/* Done, just wait for button */
wait_button(buttonQueue);
/* Cleanup */ /* Cleanup */
ice40_disable(ice40); ice40_disable(ice40);
return; return ok;
} }
void fpga_test(xQueueHandle buttonQueue, ICE40* ice40, pax_buf_t* pax_buffer, ILI9341* ili9341) { 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);
} }

View file

@ -102,10 +102,10 @@ void app_main(void) {
esp_restart(); esp_restart();
} }
display_boot_screen(pax_buffer, ili9341, "Starting...");
audio_init(); audio_init();
display_boot_screen(pax_buffer, ili9341, "Initializing RP2040...");
if (bsp_rp2040_init() != ESP_OK) { if (bsp_rp2040_init() != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize the RP2040 co-processor"); 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); 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 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) { if (rp2040_get_uid(rp2040, rp2040_uid) != ESP_OK) {
ESP_LOGE(TAG, "Failed to get RP2040 UID"); ESP_LOGE(TAG, "Failed to get RP2040 UID");
display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "Failed to read UID", NULL, NULL); display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "Failed to read UID", NULL, NULL);
esp_restart(); 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]); 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...");
if (bsp_ice40_init() != ESP_OK) { if (bsp_ice40_init() != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize the ICE40 FPGA"); ESP_LOGE(TAG, "Failed to initialize the ICE40 FPGA");
@ -143,7 +141,7 @@ void app_main(void) {
esp_restart(); esp_restart();
} }
display_boot_screen(pax_buffer, ili9341, "Initializing BNO055..."); /*display_boot_screen(pax_buffer, ili9341, "Initializing BNO055...");
if (bsp_bno055_init() != ESP_OK) { if (bsp_bno055_init() != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize the BNO055 position sensor"); ESP_LOGE(TAG, "Failed to initialize the BNO055 position sensor");
@ -155,9 +153,9 @@ void app_main(void) {
if (bno055 == NULL) { if (bno055 == NULL) {
ESP_LOGE(TAG, "bno055 is NULL"); ESP_LOGE(TAG, "bno055 is NULL");
esp_restart(); esp_restart();
} }*/
display_boot_screen(pax_buffer, ili9341, "Initializing BME680..."); /*display_boot_screen(pax_buffer, ili9341, "Initializing BME680...");
if (bsp_bme680_init() != ESP_OK) { if (bsp_bme680_init() != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize the BME680 position sensor"); ESP_LOGE(TAG, "Failed to initialize the BME680 position sensor");
@ -169,9 +167,9 @@ void app_main(void) {
if (bme680 == NULL) { if (bme680 == NULL) {
ESP_LOGE(TAG, "bme680 is NULL"); ESP_LOGE(TAG, "bme680 is NULL");
esp_restart(); esp_restart();
} }*/
display_boot_screen(pax_buffer, ili9341, "Initializing AppFS..."); //display_boot_screen(pax_buffer, ili9341, "Initializing AppFS...");
/* Start AppFS */ /* Start AppFS */
res = appfs_init(); res = appfs_init();
@ -181,7 +179,7 @@ void app_main(void) {
esp_restart(); esp_restart();
} }
display_boot_screen(pax_buffer, ili9341, "Initializing NVS..."); //display_boot_screen(pax_buffer, ili9341, "Initializing NVS...");
/* Start NVS */ /* Start NVS */
res = nvs_init(); res = nvs_init();
@ -191,7 +189,7 @@ void app_main(void) {
esp_restart(); esp_restart();
} }
display_boot_screen(pax_buffer, ili9341, "Initializing filesystem..."); //display_boot_screen(pax_buffer, ili9341, "Initializing filesystem...");
/* Start internal filesystem */ /* Start internal filesystem */
const esp_partition_t* fs_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, "locfd"); 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) { if (sdcard_ready) {
ESP_LOGI(TAG, "SD card filesystem mounted"); ESP_LOGI(TAG, "SD card filesystem mounted");
} }
play_bootsound();
/* Start LEDs */ /* Start LEDs */
ws2812_init(GPIO_LED_DATA); ws2812_init(GPIO_LED_DATA);
@ -230,6 +226,9 @@ void app_main(void) {
/* Start WiFi */ /* Start WiFi */
wifi_init(); wifi_init();
/* Rick that roll */
play_bootsound();
/* Launcher menu */ /* Launcher menu */
while (true) { while (true) {

View file

@ -87,7 +87,7 @@ void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili
} }
if (render) { 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); ili9341_write(ili9341, pax_buffer->buf);
render = false; render = false;
} }

View file

@ -86,7 +86,7 @@ void menu_settings(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili
} }
if (render) { 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); ili9341_write(ili9341, pax_buffer->buf);
render = false; render = false;
} }

Binary file not shown.