From 055d87ce9dc567e3c5713937bd3850647f6b4184 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 26 Feb 2020 09:08:14 -0500 Subject: [PATCH] prevent startup delay from display if i2c is unresponsive - release --- main/esp_app_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main/esp_app_main.c b/main/esp_app_main.c index b9db45bb..1cdaa920 100644 --- a/main/esp_app_main.c +++ b/main/esp_app_main.c @@ -341,7 +341,10 @@ void register_default_nvs(){ ESP_LOGD(TAG,"Done setting default values in nvs."); } - +void displayInitCallback(TimerHandle_t pxTimer){ + ESP_LOGD(TAG,"Initializing display"); + display_init("SqueezeESP32"); +} void app_main() { char * fwurl = NULL; @@ -364,10 +367,10 @@ void app_main() ESP_LOGD(TAG,"Configuring services"); services_init(); - - ESP_LOGD(TAG,"Initializing display"); - display_init("SqueezeESP32"); - + // initialize display in a timer thread to prevent locking up + // the main init sequence + TimerHandle_t display_init = xTimerCreate( "DisplInit", 100,pdFALSE,NULL,displayInitCallback); + xTimerStart(display_init, portMAX_DELAY); #if !RECOVERY_APPLICATION ESP_LOGI(TAG,"Checking if certificates need to be updated"); update_certificates();