Webusb mode
This commit is contained in:
parent
d550c42991
commit
3bc3cd4420
1 changed files with 34 additions and 5 deletions
29
main/main.c
29
main/main.c
|
@ -49,6 +49,7 @@
|
|||
#include "menus/start.h"
|
||||
|
||||
#include "factory_test.h"
|
||||
#include "fpga_download.h"
|
||||
|
||||
extern const uint8_t wallpaper_png_start[] asm("_binary_wallpaper_png_start");
|
||||
extern const uint8_t wallpaper_png_end[] asm("_binary_wallpaper_png_end");
|
||||
|
@ -235,6 +236,19 @@ void app_main(void) {
|
|||
/* Start WiFi */
|
||||
wifi_init();
|
||||
|
||||
/* Check WebUSB mode */
|
||||
|
||||
uint8_t webusb_mode;
|
||||
res = rp2040_get_webusb_mode(rp2040, &webusb_mode);
|
||||
if (res != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read WebUSB mode: %d", res);
|
||||
display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "Failed to read WebUSB mode", NULL, NULL);
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "WebUSB mode 0x%02X", webusb_mode);
|
||||
|
||||
if (webusb_mode == 0x00) { // Normal boot
|
||||
/* Rick that roll */
|
||||
play_bootsound();
|
||||
|
||||
|
@ -242,6 +256,21 @@ void app_main(void) {
|
|||
while (true) {
|
||||
menu_start(rp2040->queue, pax_buffer, ili9341, app_description->version);
|
||||
}
|
||||
} else if (webusb_mode == 0x01) {
|
||||
display_boot_screen(pax_buffer, ili9341, "WebUSB mode");
|
||||
/*while (true) {
|
||||
|
||||
}*/
|
||||
} else if (webusb_mode == 0x02) {
|
||||
display_boot_screen(pax_buffer, ili9341, "FPGA download mode");
|
||||
while (true) {
|
||||
fpga_download(rp2040->queue, get_ice40(), pax_buffer, ili9341);
|
||||
}
|
||||
} else {
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), "Invalid mode 0x%02X", webusb_mode);
|
||||
display_boot_screen(pax_buffer, ili9341, buffer);
|
||||
}
|
||||
|
||||
free(framebuffer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue