Disable sensor init and make boot much faster

This commit is contained in:
Renze Nicolai 2022-06-01 23:35:22 +02:00
parent 9bc2efd1c8
commit e1030d1363

View file

@ -102,9 +102,9 @@ void app_main(void) {
esp_restart(); esp_restart();
} }
audio_init(); display_boot_screen(pax_buffer, ili9341, "Starting...");
display_boot_screen(pax_buffer, ili9341, "Initializing RP2040..."); audio_init();
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");
@ -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");
@ -221,8 +219,6 @@ void app_main(void) {
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);
uint8_t ledBuffer[15] = {50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0}; uint8_t ledBuffer[15] = {50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0};
@ -231,6 +227,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) {
menu_start(rp2040->queue, pax_buffer, ili9341); menu_start(rp2040->queue, pax_buffer, ili9341);