From 620611bdc09486cc4a60127d0b713d52bb890a82 Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Thu, 30 May 2024 10:07:27 +0300 Subject: [PATCH] [ESP32-Sx/C3] build compatibility of SkyView and WebTop with Core 3.0.0 --- software/firmware/source/SkyView/Platform_ESP32.cpp | 8 ++++++-- software/firmware/source/SkyView/Platform_ESP32.h | 5 ++++- software/firmware/source/SkyWatch/Platform_ESP32.cpp | 12 ++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/software/firmware/source/SkyView/Platform_ESP32.cpp b/software/firmware/source/SkyView/Platform_ESP32.cpp index 874ed617c..0cb51440a 100644 --- a/software/firmware/source/SkyView/Platform_ESP32.cpp +++ b/software/firmware/source/SkyView/Platform_ESP32.cpp @@ -888,6 +888,7 @@ static void ESP32_WiFiUDP_stopAll() static void ESP32_Battery_setup() { +#if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5 #if defined(CONFIG_IDF_TARGET_ESP32) calibrate_voltage(settings->adapter == ADAPTER_TTGO_T5S ? (adc1_channel_t) ADC1_GPIO35_CHANNEL : @@ -903,6 +904,9 @@ static void ESP32_Battery_setup() #else #error "This ESP32 family build variant is not supported!" #endif /* CONFIG_IDF_TARGET_ESP32 */ +#else + /* TBD */ +#endif /* ESP_IDF_VERSION_MAJOR */ } static float ESP32_Battery_voltage() @@ -929,11 +933,11 @@ SoftSPI swSPI(SOC_GPIO_PIN_MOSI_WS, SOC_GPIO_PIN_MOSI_WS, /* half duplex */ SOC_GPIO_PIN_SCK_WS); -#if defined(CONFIG_IDF_TARGET_ESP32C6) +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 static spinlock_t EPD_ident_mutex; #else static portMUX_TYPE EPD_ident_mutex; -#endif /* CONFIG_IDF_TARGET_ESP32C6 */ +#endif /* ESP_IDF_VERSION_MAJOR */ static ep_model_id ESP32_EPD_ident() { diff --git a/software/firmware/source/SkyView/Platform_ESP32.h b/software/firmware/source/SkyView/Platform_ESP32.h index 1d6acf197..c0ca63639 100644 --- a/software/firmware/source/SkyView/Platform_ESP32.h +++ b/software/firmware/source/SkyView/Platform_ESP32.h @@ -140,7 +140,10 @@ //#define USE_ADAFRUIT_MSC // Audio -//#define EXCLUDE_AUDIO +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#define EXCLUDE_AUDIO +#endif /* ESP_IDF_VERSION_MAJOR */ + #if !defined(EXCLUDE_AUDIO) //#define USE_EXT_I2S_DAC #endif /* EXCLUDE_AUDIO */ diff --git a/software/firmware/source/SkyWatch/Platform_ESP32.cpp b/software/firmware/source/SkyWatch/Platform_ESP32.cpp index 9532bc9d1..5390fbade 100644 --- a/software/firmware/source/SkyWatch/Platform_ESP32.cpp +++ b/software/firmware/source/SkyWatch/Platform_ESP32.cpp @@ -595,7 +595,11 @@ static void ESP32_reset() static void ESP32_sleep_ms(int ms) { esp_sleep_enable_timer_wakeup(ms * 1000); +#if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5 esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH,ESP_PD_OPTION_ON); +#else + /* TBD */ +#endif /* ESP_IDF_VERSION_MAJOR */ esp_light_sleep_start(); } @@ -817,11 +821,19 @@ static void ESP32_Battery_setup() } else if (hw_info.model == SOFTRF_MODEL_WEBTOP_USB) { #if defined(CONFIG_IDF_TARGET_ESP32S2) +#if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5 calibrate_voltage((adc1_channel_t) ADC1_GPIO9_CHANNEL); +#else + /* TBD */ +#endif /* ESP_IDF_VERSION_MAJOR */ #endif /* CONFIG_IDF_TARGET_ESP32S2 */ } else if (hw_info.model == SOFTRF_MODEL_WEBTOP_SERIAL) { #if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) +#if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5 calibrate_voltage((adc1_channel_t) ADC1_GPIO2_CHANNEL); +#else + /* TBD */ +#endif /* ESP_IDF_VERSION_MAJOR */ #endif /* CONFIG_IDF_TARGET_ESP32S3 */ } }