Fix wrong exit condition in ice40_init, add extra checks to main

This commit is contained in:
Renze Nicolai 2022-05-13 13:22:03 +02:00
parent 3be5e78a09
commit 90636e01c6
2 changed files with 18 additions and 1 deletions

View file

@ -164,7 +164,7 @@ esp_err_t bsp_ice40_init() {
if (!bsp_ready) return ESP_FAIL;
if (!rp2040_ready) return ESP_FAIL;
if (rp2040_fw_version == 0xFF) return ESP_FAIL; // The ICE40 FPGA can only be controlled when the RP2040 is not in bootloader mode
if (rp2040_ready) return ESP_OK;
if (ice40_ready) return ESP_OK;
dev_ice40.spi_bus = SPI_BUS;
dev_ice40.pin_cs = GPIO_SPI_CS_FPGA;

View file

@ -309,6 +309,11 @@ void app_main(void) {
}
ILI9341* ili9341 = get_ili9341();
if (ili9341 == NULL) {
ESP_LOGE(TAG, "ili9341 is NULL");
esp_restart();
}
display_boot_screen(pax_buffer, ili9341);
@ -319,6 +324,10 @@ void app_main(void) {
}
RP2040* rp2040 = get_rp2040();
if (rp2040 == NULL) {
ESP_LOGE(TAG, "rp2040 is NULL");
esp_restart();
}
rp2040_updater(rp2040, pax_buffer, ili9341, framebuffer); // Handle RP2040 firmware update & bootloader mode
@ -329,6 +338,10 @@ void app_main(void) {
}
ICE40* ice40 = get_ice40();
if (ice40 == NULL) {
ESP_LOGE(TAG, "ice40 is NULL");
esp_restart();
}
if (bsp_bno055_init() != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize the BNO055 position sensor");
@ -337,6 +350,10 @@ void app_main(void) {
}
BNO055* bno055 = get_bno055();
if (bno055 == NULL) {
ESP_LOGE(TAG, "bno055 is NULL");
esp_restart();
}
/* Start AppFS */
res = appfs_init();