From 7adc14a5aa5c0462d64c33f6389a5effdc433343 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Tue, 10 Mar 2020 20:01:18 -0400 Subject: [PATCH] fixing some merging issues --- main/esp_app_main.c | 22 +++++++++++++++++----- sdkconfig | 6 +++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/main/esp_app_main.c b/main/esp_app_main.c index fa6a8a04..1650ccda 100644 --- a/main/esp_app_main.c +++ b/main/esp_app_main.c @@ -35,7 +35,7 @@ #include "nvs_flash.h" #include "esp_log.h" #include "freertos/event_groups.h" - +#include "mdns.h" #include "lwip/api.h" #include "lwip/err.h" #include "lwip/netdb.h" @@ -44,8 +44,9 @@ #include "wifi_manager.h" #include "squeezelite-ota.h" #include -#include "platform_config.h" +#include "config.h" #include "audio_controls.h" +#include "platform_config.h" #include "telnet.h" #include "messaging.h" @@ -70,12 +71,22 @@ extern const uint8_t server_cert_pem_end[] asm("_binary_github_pem_end"); // as an exception _init function don't need include extern void services_init(void); extern void display_init(char *welcome); - -bool is_recovery_running; const char * str_or_unknown(const char * str) { return (str?str:unknown_string_placeholder); } - +bool is_recovery_running; /* brief this is an exemple of a callback that you can setup in your own app to get notified of wifi manager event */ void cb_connection_got_ip(void *pvParameter){ + static ip4_addr_t ip; + tcpip_adapter_ip_info_t ipInfo; + + tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ipInfo); + if (ip.addr && ipInfo.ip.addr != ip.addr) { + ESP_LOGW(TAG, "IP change, need to reboot"); + if(!wait_for_commit()){ + ESP_LOGW(TAG,"Unable to commit configuration. "); + } + esp_restart(); + } + ip.addr = ipInfo.ip.addr; ESP_LOGI(TAG, "I have a connection!"); messaging_post_message(MESSAGING_INFO,MESSAGING_CLASS_SYSTEM,"Wifi connected"); xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); @@ -375,6 +386,7 @@ void app_main() ESP_LOGI(TAG,"Initializing display"); display_init("SqueezeESP32"); + if(!is_recovery_running){ ESP_LOGI(TAG,"Checking if certificates need to be updated"); update_certificates(); diff --git a/sdkconfig b/sdkconfig index 0e17db69..deb89506 100644 --- a/sdkconfig +++ b/sdkconfig @@ -437,10 +437,10 @@ CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set +CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_DEFAULT_LEVEL=4 CONFIG_LOG_COLORS=y CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_L2_TO_L3_COPY is not set