diff --git a/software/firmware/source/SkyView/Platform_ESP32.cpp b/software/firmware/source/SkyView/Platform_ESP32.cpp index 31cd9607e..56160be5c 100644 --- a/software/firmware/source/SkyView/Platform_ESP32.cpp +++ b/software/firmware/source/SkyView/Platform_ESP32.cpp @@ -49,6 +49,11 @@ #include #endif /* CONFIG_IDF_TARGET_ESP32XX */ +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#include +#endif /* ESP_IDF_VERSION_MAJOR */ + #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */ #define TIME_TO_SLEEP 28 /* Time ESP32 will go to sleep (in seconds) */ @@ -371,7 +376,13 @@ static void ESP32_setup() } } +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + size_t flash_size; + esp_flash_get_size(NULL, (uint32_t *) &flash_size); +#else size_t flash_size = spi_flash_get_chip_size(); +#endif /* ESP_IDF_VERSION_MAJOR */ + size_t min_app_size = flash_size; esp_partition_iterator_t it; @@ -868,13 +879,14 @@ static void ESP32_Battery_setup() { #if defined(CONFIG_IDF_TARGET_ESP32) calibrate_voltage(settings->adapter == ADAPTER_TTGO_T5S ? - ADC1_GPIO35_CHANNEL : ADC1_GPIO36_CHANNEL); + (adc1_channel_t) ADC1_GPIO35_CHANNEL : + (adc1_channel_t) ADC1_GPIO36_CHANNEL); #elif defined(CONFIG_IDF_TARGET_ESP32S2) - calibrate_voltage(ADC1_GPIO9_CHANNEL); /* TBD */ + calibrate_voltage((adc1_channel_t) ADC1_GPIO9_CHANNEL); /* TBD */ #elif defined(CONFIG_IDF_TARGET_ESP32S3) - calibrate_voltage(ADC1_GPIO3_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO3_CHANNEL); #elif defined(CONFIG_IDF_TARGET_ESP32C3) - calibrate_voltage(ADC1_GPIO1_CHANNEL); /* TBD */ + calibrate_voltage((adc1_channel_t) ADC1_GPIO1_CHANNEL); /* TBD */ #else #error "This ESP32 family build variant is not supported!" #endif /* CONFIG_IDF_TARGET_ESP32 */ @@ -909,7 +921,12 @@ static portMUX_TYPE EPD_ident_mutex; static ep_model_id ESP32_EPD_ident() { ep_model_id rval = EP_GDEW027W3; /* default */ + +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + spinlock_initialize(&EPD_ident_mutex); +#else vPortCPUInitializeMutex(&EPD_ident_mutex); +#endif /* ESP_IDF_VERSION_MAJOR */ digitalWrite(SOC_GPIO_PIN_SS_WS, HIGH); pinMode(SOC_GPIO_PIN_SS_WS, OUTPUT); @@ -1125,10 +1142,16 @@ static int ESP32_WiFi_clients_count() wifi_sta_list_t stations; ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&stations)); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ + + return stations.num; +#else tcpip_adapter_sta_list_t infoList; ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&stations, &infoList)); return infoList.num; +#endif /* ESP_IDF_VERSION_MAJOR */ case WIFI_STA: default: return -1; /* error */ diff --git a/software/firmware/source/SkyWatch/BluetoothHelper.cpp b/software/firmware/source/SkyWatch/BluetoothHelper.cpp index bca321617..61a59dedd 100644 --- a/software/firmware/source/SkyWatch/BluetoothHelper.cpp +++ b/software/firmware/source/SkyWatch/BluetoothHelper.cpp @@ -73,7 +73,11 @@ class MyServerCallbacks: public BLEServerCallbacks { class MyCallbacks: public BLECharacteristicCallbacks { void onWrite(BLECharacteristic *pCharacteristic) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + String rxValue = pCharacteristic->getValue(); +#else std::string rxValue = pCharacteristic->getValue(); +#endif /* ESP_IDF_VERSION_MAJOR */ if (rxValue.length() > 0) { BLE_FIFO_RX->write(rxValue.c_str(), diff --git a/software/firmware/source/SkyWatch/Platform_ESP32.cpp b/software/firmware/source/SkyWatch/Platform_ESP32.cpp index 94961f7a5..4796b02f0 100644 --- a/software/firmware/source/SkyWatch/Platform_ESP32.cpp +++ b/software/firmware/source/SkyWatch/Platform_ESP32.cpp @@ -47,6 +47,10 @@ #include #endif /* CONFIG_IDF_TARGET_ESP32S2 */ +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#endif /* ESP_IDF_VERSION_MAJOR */ + #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */ #define TIME_TO_SLEEP 28 /* Time ESP32 will go to sleep (in seconds) */ @@ -641,10 +645,14 @@ static void ESP32_WiFi_set_param(int ndx, int value) ESP_ERROR_CHECK(esp_wifi_set_max_tx_power(ESP32_dBm_to_power_level[value])); break; case WIFI_PARAM_DHCP_LEASE_TIME: +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else tcpip_adapter_dhcps_option( (tcpip_adapter_dhcp_option_mode_t) TCPIP_ADAPTER_OP_SET, (tcpip_adapter_dhcp_option_id_t) TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME, (void*) <, sizeof(lt)); +#endif /* ESP_IDF_VERSION_MAJOR */ break; default: break; @@ -663,15 +671,20 @@ static void ESP32_WiFiUDP_stopAll() static IPAddress ESP32_WiFi_get_broadcast() { - tcpip_adapter_ip_info_t info; IPAddress broadcastIp; +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else + tcpip_adapter_ip_info_t info; + if (WiFi.getMode() == WIFI_STA) { tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &info); } else { tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &info); } broadcastIp = ~info.netmask.addr | info.ip.addr; +#endif /* ESP_IDF_VERSION_MAJOR */ return broadcastIp; } @@ -696,6 +709,9 @@ static void ESP32_WiFi_transmit_UDP(int port, byte *buf, size_t size) wifi_sta_list_t stations; ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&stations)); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else tcpip_adapter_sta_list_t infoList; ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&stations, &infoList)); @@ -706,6 +722,7 @@ static void ESP32_WiFi_transmit_UDP(int port, byte *buf, size_t size) Uni_Udp.write(buf, size); Uni_Udp.endPacket(); } +#endif /* ESP_IDF_VERSION_MAJOR */ break; case WIFI_OFF: default: @@ -728,10 +745,16 @@ static int ESP32_WiFi_clients_count() wifi_sta_list_t stations; ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&stations)); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ + + return stations.num; +#else tcpip_adapter_sta_list_t infoList; ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&stations, &infoList)); return infoList.num; +#endif /* ESP_IDF_VERSION_MAJOR */ case WIFI_STA: default: return -1; /* error */ @@ -782,11 +805,11 @@ static void ESP32_Battery_setup() } else if (hw_info.model == SOFTRF_MODEL_WEBTOP_USB) { #if defined(CONFIG_IDF_TARGET_ESP32S2) - calibrate_voltage(ADC1_GPIO9_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO9_CHANNEL); #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) - calibrate_voltage(ADC1_GPIO2_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO2_CHANNEL); #endif /* CONFIG_IDF_TARGET_ESP32S3 */ } } diff --git a/software/firmware/source/SkyWatch/TFTHelper.cpp b/software/firmware/source/SkyWatch/TFTHelper.cpp index 9e633c72c..fea9c9fba 100644 --- a/software/firmware/source/SkyWatch/TFTHelper.cpp +++ b/software/firmware/source/SkyWatch/TFTHelper.cpp @@ -92,8 +92,12 @@ void TFT_backlight_init(void) int bl_pin = (hw_info.model == SOFTRF_MODEL_WEBTOP_USB) ? SOC_GPIO_PIN_TDONGLE_TFT_BL : SOC_GPIO_PIN_TWATCH_TFT_BL; +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcAttachPin(bl_pin, BACKLIGHT_CHANNEL); ledcSetup(BACKLIGHT_CHANNEL, 12000, 8); +#endif /* ESP_IDF_VERSION_MAJOR */ } uint8_t TFT_backlight_getLevel() diff --git a/software/firmware/source/SoftRF/src/driver/Bluetooth.cpp b/software/firmware/source/SoftRF/src/driver/Bluetooth.cpp index 3c02f410e..08331dc37 100644 --- a/software/firmware/source/SoftRF/src/driver/Bluetooth.cpp +++ b/software/firmware/source/SoftRF/src/driver/Bluetooth.cpp @@ -92,7 +92,11 @@ class MyServerCallbacks: public BLEServerCallbacks { class UARTCallbacks: public BLECharacteristicCallbacks { void onWrite(BLECharacteristic *pUARTCharacteristic) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + String rxValue = pUARTCharacteristic->getValue(); +#else std::string rxValue = pUARTCharacteristic->getValue(); +#endif /* ESP_IDF_VERSION_MAJOR */ if (rxValue.length() > 0) { BLE_FIFO_RX->write(rxValue.c_str(), diff --git a/software/firmware/source/SoftRF/src/platform/ESP32.cpp b/software/firmware/source/SoftRF/src/platform/ESP32.cpp index 3f3678884..009bfcb2a 100644 --- a/software/firmware/source/SoftRF/src/platform/ESP32.cpp +++ b/software/firmware/source/SoftRF/src/platform/ESP32.cpp @@ -38,6 +38,11 @@ #include #include +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#include +#endif /* ESP_IDF_VERSION_MAJOR */ + #include "../system/SoC.h" #include "../system/Time.h" #include "../driver/Sound.h" @@ -418,7 +423,13 @@ static void ESP32_setup() WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); #endif +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + size_t flash_size; + esp_flash_get_size(NULL, (uint32_t *) &flash_size); +#else size_t flash_size = spi_flash_get_chip_size(); +#endif /* ESP_IDF_VERSION_MAJOR */ + size_t min_app_size = flash_size; esp_partition_iterator_t it; @@ -507,6 +518,9 @@ static void ESP32_setup() } } else { #if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); uint32_t pkg_ver = chip_ver & 0x7; if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) { @@ -514,6 +528,7 @@ static void ESP32_setup() lmic_pins.rst = SOC_GPIO_PIN_TBEAM_RF_RST_V05; lmic_pins.busy = SOC_GPIO_PIN_TBEAM_RF_BUSY_V08; } +#endif /* ESP_IDF_VERSION_MAJOR */ #elif defined(CONFIG_IDF_TARGET_ESP32S2) esp32_board = ESP32_S2_T8_V1_1; #elif defined(CONFIG_IDF_TARGET_ESP32S3) @@ -542,8 +557,12 @@ static void ESP32_setup() } if (SOC_GPIO_PIN_BUZZER != SOC_UNUSED_PIN) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcAttachPin(SOC_GPIO_PIN_BUZZER, LEDC_CHANNEL_BUZZER); ledcSetup(LEDC_CHANNEL_BUZZER, 0, LEDC_RESOLUTION_BUZZER); +#endif /* ESP_IDF_VERSION_MAJOR */ } if (hw_info.model == SOFTRF_MODEL_SKYWATCH) { @@ -1348,7 +1367,7 @@ static void ESP32_setup() delay(200); - calibrate_voltage(ADC1_GPIO2_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO2_CHANNEL); uint16_t gpio2_voltage = read_voltage(); // avg. of 32 samples if (gpio2_voltage > 1900) { @@ -2223,8 +2242,12 @@ static void ESP32_Sound_test(int var) { if (SOC_GPIO_PIN_BUZZER != SOC_UNUSED_PIN && settings->volume != BUZZER_OFF) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcAttachPin(SOC_GPIO_PIN_BUZZER, LEDC_CHANNEL_BUZZER); ledcSetup(LEDC_CHANNEL_BUZZER, 0, LEDC_RESOLUTION_BUZZER); +#endif /* ESP_IDF_VERSION_MAJOR */ if (var == REASON_DEFAULT_RST || var == REASON_EXT_SYS_RST || @@ -2248,7 +2271,11 @@ static void ESP32_Sound_test(int var) ledcWriteTone(LEDC_CHANNEL_BUZZER, 0); // off +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcDetachPin(SOC_GPIO_PIN_BUZZER); +#endif /* ESP_IDF_VERSION_MAJOR */ pinMode(SOC_GPIO_PIN_BUZZER, INPUT_PULLDOWN); } @@ -2303,15 +2330,23 @@ static void ESP32_Sound_tone(int hz, uint8_t volume) { if (SOC_GPIO_PIN_BUZZER != SOC_UNUSED_PIN && volume != BUZZER_OFF) { if (hz > 0) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcAttachPin(SOC_GPIO_PIN_BUZZER, LEDC_CHANNEL_BUZZER); ledcSetup(LEDC_CHANNEL_BUZZER, 0, LEDC_RESOLUTION_BUZZER); +#endif /* ESP_IDF_VERSION_MAJOR */ ledcWriteTone(LEDC_CHANNEL_BUZZER, hz); ledcWrite(LEDC_CHANNEL_BUZZER, volume == BUZZER_VOLUME_FULL ? 0xFF : 0x07); } else { ledcWriteTone(LEDC_CHANNEL_BUZZER, 0); // off +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcDetachPin(SOC_GPIO_PIN_BUZZER); +#endif /* ESP_IDF_VERSION_MAJOR */ pinMode(SOC_GPIO_PIN_BUZZER, INPUT_PULLDOWN); } } @@ -2390,10 +2425,14 @@ static void ESP32_WiFi_set_param(int ndx, int value) ESP_ERROR_CHECK(esp_wifi_set_max_tx_power(ESP32_dBm_to_power_level[value])); break; case WIFI_PARAM_DHCP_LEASE_TIME: +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else tcpip_adapter_dhcps_option( (tcpip_adapter_dhcp_option_mode_t) TCPIP_ADAPTER_OP_SET, (tcpip_adapter_dhcp_option_id_t) TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME, (void*) <, sizeof(lt)); +#endif /* ESP_IDF_VERSION_MAJOR */ break; default: break; @@ -2403,15 +2442,21 @@ static void ESP32_WiFi_set_param(int ndx, int value) static IPAddress ESP32_WiFi_get_broadcast() { - tcpip_adapter_ip_info_t info; IPAddress broadcastIp; +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else + tcpip_adapter_ip_info_t info; + if (WiFi.getMode() == WIFI_STA) { tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &info); } else { tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &info); } + broadcastIp = ~info.netmask.addr | info.ip.addr; +#endif /* ESP_IDF_VERSION_MAJOR */ return broadcastIp; } @@ -2437,6 +2482,9 @@ static void ESP32_WiFi_transmit_UDP(int port, byte *buf, size_t size) wifi_sta_list_t stations; ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&stations)); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else tcpip_adapter_sta_list_t infoList; ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&stations, &infoList)); @@ -2447,6 +2495,7 @@ static void ESP32_WiFi_transmit_UDP(int port, byte *buf, size_t size) Uni_Udp.write(buf, size); Uni_Udp.endPacket(); } +#endif /* ESP_IDF_VERSION_MAJOR */ break; case WIFI_OFF: default: @@ -2482,10 +2531,16 @@ static int ESP32_WiFi_clients_count() wifi_sta_list_t stations; ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&stations)); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ + + return stations.num; +#else tcpip_adapter_sta_list_t infoList; ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&stations, &infoList)); return infoList.num; +#endif /* ESP_IDF_VERSION_MAJOR */ case WIFI_STA: default: return -1; /* error */ @@ -2917,8 +2972,12 @@ static byte ESP32_Display_setup() SOC_GPIO_PIN_HELTRK_TFT_BL_V05 : SOC_GPIO_PIN_TWATCH_TFT_BL; +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcAttachPin(bl_pin, BACKLIGHT_CHANNEL); ledcSetup(BACKLIGHT_CHANNEL, 12000, 8); +#endif /* ESP_IDF_VERSION_MAJOR */ tft->setTextFont(4); tft->setTextSize(2); @@ -3378,7 +3437,11 @@ static void ESP32_Display_fini(int reason) SOC_GPIO_PIN_HELTRK_TFT_BL_V05 : SOC_GPIO_PIN_TWATCH_TFT_BL; +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else ledcDetachPin(bl_pin); +#endif /* ESP_IDF_VERSION_MAJOR */ pinMode(bl_pin, INPUT_PULLDOWN); tft->fillScreen(TFT_NAVY); @@ -3406,25 +3469,26 @@ static void ESP32_Battery_setup() #if defined(CONFIG_IDF_TARGET_ESP32) calibrate_voltage(hw_info.model == SOFTRF_MODEL_PRIME_MK2 || (esp32_board == ESP32_TTGO_V2_OLED && hw_info.revision == 16) ? - ADC1_GPIO35_CHANNEL : ADC1_GPIO36_CHANNEL); + (adc1_channel_t) ADC1_GPIO35_CHANNEL : + (adc1_channel_t) ADC1_GPIO36_CHANNEL); #elif defined(CONFIG_IDF_TARGET_ESP32S2) - calibrate_voltage(ADC1_GPIO9_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO9_CHANNEL); #elif defined(CONFIG_IDF_TARGET_ESP32S3) /* use this procedure on T-TWR Plus (has PMU) to calibrate audio ADC */ if (esp32_board == ESP32_HELTEC_TRACKER || esp32_board == ESP32_LILYGO_T_TWR_V2_0) { if (ESP.getEfuseMac() == 0x58f8ab188534ULL) { - calibrate_voltage(ADC1_GPIO1_CHANNEL, ADC_ATTEN_DB_0); + calibrate_voltage((adc1_channel_t) ADC1_GPIO1_CHANNEL, ADC_ATTEN_DB_0); } else { - calibrate_voltage(ADC1_GPIO1_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO1_CHANNEL); } } else if (esp32_board == ESP32_LILYGO_T_TWR_V2_1) { - calibrate_voltage(ADC1_GPIO1_CHANNEL, ADC_ATTEN_DB_0); + calibrate_voltage((adc1_channel_t) ADC1_GPIO1_CHANNEL, ADC_ATTEN_DB_0); } else { - calibrate_voltage(ADC1_GPIO2_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO2_CHANNEL); } #elif defined(CONFIG_IDF_TARGET_ESP32C3) - calibrate_voltage(ADC1_GPIO1_CHANNEL); + calibrate_voltage((adc1_channel_t) ADC1_GPIO1_CHANNEL); #else #error "This ESP32 family build variant is not supported!" #endif /* CONFIG_IDF_TARGET_ESP32 */ diff --git a/software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp b/software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp index ab36b0e17..184bf6d6c 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp @@ -32,7 +32,7 @@ * Classic APRS */ const rf_proto_desc_t aprs_proto_desc = { - "APRS", + .name = {'A','P','R','S', 0}, .type = RF_PROTOCOL_APRS, .modulation_type = RF_MODULATION_TYPE_2FSK, /* Bell 202 AFSK */ .preamble_type = APRS_PREAMBLE_TYPE, @@ -64,7 +64,7 @@ const rf_proto_desc_t aprs_proto_desc = { * APRS over LoRa */ const rf_proto_desc_t prol_proto_desc = { - "PRoL", + .name = {'P','R','o','L', 0}, .type = RF_PROTOCOL_APRS, .modulation_type = RF_MODULATION_TYPE_LORA, .preamble_type = 0 /* INVALID FOR LORA */, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/ES1090.cpp b/software/firmware/source/SoftRF/src/protocol/radio/ES1090.cpp index ee9c86f06..bbcf84e5e 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/ES1090.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/ES1090.cpp @@ -27,7 +27,7 @@ #include "../data/GDL90.h" const rf_proto_desc_t es1090_proto_desc = { - "ES", + .name = {'E','S', 0}, .type = RF_PROTOCOL_ADSB_1090, .modulation_type = RF_MODULATION_TYPE_PPM, .preamble_type = ES1090_PREAMBLE_TYPE, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/FANET.cpp b/software/firmware/source/SoftRF/src/protocol/radio/FANET.cpp index ef2f93138..b0ea0e1b9 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/FANET.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/FANET.cpp @@ -32,7 +32,7 @@ #include "../../driver/RF.h" const rf_proto_desc_t fanet_proto_desc = { - "FANET", + .name = {'F','A','N','E','T', 0}, .type = RF_PROTOCOL_FANET, .modulation_type = RF_MODULATION_TYPE_LORA, .preamble_type = 0 /* INVALID FOR LORA */, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/Legacy.cpp b/software/firmware/source/SoftRF/src/protocol/radio/Legacy.cpp index 45a254780..3df46e5ec 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/Legacy.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/Legacy.cpp @@ -29,7 +29,7 @@ #include "../../driver/EEPROM.h" const rf_proto_desc_t legacy_proto_desc = { - "Legacy", + .name = {'L','e','g','a','c','y', 0}, .type = RF_PROTOCOL_LEGACY, .modulation_type = RF_MODULATION_TYPE_2FSK, .preamble_type = LEGACY_PREAMBLE_TYPE, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/OGNTP.cpp b/software/firmware/source/SoftRF/src/protocol/radio/OGNTP.cpp index 899d8a286..da8821fd9 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/OGNTP.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/OGNTP.cpp @@ -28,7 +28,7 @@ #include "../../driver/EEPROM.h" const rf_proto_desc_t ogntp_proto_desc = { - "OGNTP", + .name = {'O','G','N','T','P', 0}, .type = RF_PROTOCOL_OGNTP, .modulation_type = RF_MODULATION_TYPE_2FSK, .preamble_type = OGNTP_PREAMBLE_TYPE, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/P3I.cpp b/software/firmware/source/SoftRF/src/protocol/radio/P3I.cpp index e7bdfe8d5..03d77ef3f 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/P3I.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/P3I.cpp @@ -26,7 +26,7 @@ #include "../../driver/RF.h" const rf_proto_desc_t p3i_proto_desc = { - "P3I", + .name = {'P','3','I', 0}, .type = RF_PROTOCOL_P3I, .modulation_type = RF_MODULATION_TYPE_2FSK, .preamble_type = P3I_PREAMBLE_TYPE, diff --git a/software/firmware/source/SoftRF/src/protocol/radio/UAT978.cpp b/software/firmware/source/SoftRF/src/protocol/radio/UAT978.cpp index f102eb4ff..16167105d 100644 --- a/software/firmware/source/SoftRF/src/protocol/radio/UAT978.cpp +++ b/software/firmware/source/SoftRF/src/protocol/radio/UAT978.cpp @@ -27,7 +27,7 @@ #include "../data/GDL90.h" const rf_proto_desc_t uat978_proto_desc = { - "UAT", + .name = {'U','A','T', 0}, .type = RF_PROTOCOL_ADSB_UAT, .modulation_type = RF_MODULATION_TYPE_2FSK, .preamble_type = UAT978_PREAMBLE_TYPE, diff --git a/software/firmware/source/libraries/ADC/battery.cpp b/software/firmware/source/libraries/ADC/battery.cpp index c8ab94200..ee6d700f8 100644 --- a/software/firmware/source/libraries/ADC/battery.cpp +++ b/software/firmware/source/libraries/ADC/battery.cpp @@ -25,13 +25,13 @@ esp_adc_cal_characteristics_t *adc_characs = #endif #if defined(CONFIG_IDF_TARGET_ESP32) -static adc1_channel_t adc_channel = ADC1_GPIO36_CHANNEL; +static adc1_channel_t adc_channel = (adc1_channel_t) ADC1_GPIO36_CHANNEL; #elif defined(CONFIG_IDF_TARGET_ESP32S2) -static adc1_channel_t adc_channel = ADC1_GPIO9_CHANNEL; +static adc1_channel_t adc_channel = (adc1_channel_t) ADC1_GPIO9_CHANNEL; #elif defined(CONFIG_IDF_TARGET_ESP32S3) -static adc1_channel_t adc_channel = ADC1_GPIO2_CHANNEL; +static adc1_channel_t adc_channel = (adc1_channel_t) ADC1_GPIO2_CHANNEL; #elif defined(CONFIG_IDF_TARGET_ESP32C3) -static adc1_channel_t adc_channel = ADC1_GPIO1_CHANNEL; +static adc1_channel_t adc_channel = (adc1_channel_t) ADC1_GPIO1_CHANNEL; #else #error "This ESP32 family build variant is not supported!" #endif /* CONFIG_IDF_TARGET_ESP32 */ diff --git a/software/firmware/source/libraries/Adafruit_SPIFlash/src/esp32/Adafruit_FlashTransport_ESP32.cpp b/software/firmware/source/libraries/Adafruit_SPIFlash/src/esp32/Adafruit_FlashTransport_ESP32.cpp index 9b8aa5832..28d15e72c 100644 --- a/software/firmware/source/libraries/Adafruit_SPIFlash/src/esp32/Adafruit_FlashTransport_ESP32.cpp +++ b/software/firmware/source/libraries/Adafruit_SPIFlash/src/esp32/Adafruit_FlashTransport_ESP32.cpp @@ -26,6 +26,10 @@ #ifdef ARDUINO_ARCH_ESP32 +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#endif /* ESP_IDF_VERSION_MAJOR */ + Adafruit_FlashTransport_ESP32::Adafruit_FlashTransport_ESP32(void) { _cmd_read = SFLASH_CMD_READ; _addr_len = 3; // work with most device if not set diff --git a/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.cpp b/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.cpp index 846fbf2c1..ed1d043f1 100644 --- a/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.cpp +++ b/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.cpp @@ -22,6 +22,9 @@ #ifdef ESP32 #include "driver/i2s.h" #include +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + #include +#endif /* ESP_IDF_VERSION_MAJOR */ #elif defined(ARDUINO_ARCH_RP2040) || ARDUINO_ESP8266_MAJOR >= 3 #include #elif ARDUINO_ESP8266_MAJOR < 3 diff --git a/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp b/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp index 1823b5d83..108db2b60 100644 --- a/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp +++ b/software/firmware/source/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp @@ -106,7 +106,11 @@ AudioOutputSPDIF::AudioOutputSPDIF(int dout_pin, int port, int dma_buf_count) .tx_desc_auto_clear = true, // Silence on underflow .fixed_mclk = 0, // Unused #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + .mclk_multiple = I2S_MCLK_MULTIPLE_256, // Unused +#else .mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused +#endif /* ESP_IDF_VERSION_MAJOR */ .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample #endif }; @@ -183,12 +187,14 @@ bool AudioOutputSPDIF::SetRate(int hz) int adjustedHz = AdjustI2SRate(hz); #if defined(ESP32) if (i2s_set_sample_rates((i2s_port_t)portNo, adjustedHz) == ESP_OK) { +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) if (adjustedHz == 88200) { // Manually fix the APLL rate for 44100. // See: https://github.com/espressif/esp-idf/issues/2634 // sdm0 = 28, sdm1 = 8, sdm2 = 5, odir = 0 -> 88199.977 rtc_clk_apll_enable(1, 28, 8, 5, 0); } +#endif /* CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 */ } else { audioLogger->println("ERROR changing S/PDIF sample rate"); } diff --git a/software/firmware/source/libraries/LibAPRS_ESP32/AFSK.cpp b/software/firmware/source/libraries/LibAPRS_ESP32/AFSK.cpp index d14301d30..3e1b4e677 100644 --- a/software/firmware/source/libraries/LibAPRS_ESP32/AFSK.cpp +++ b/software/firmware/source/libraries/LibAPRS_ESP32/AFSK.cpp @@ -110,7 +110,11 @@ static esp_err_t adc_set_i2s_data_pattern(adc_unit_t adc_unit, int seq_num, adc_ RTC_MODULE_CHECK((adc1_channel_t)channel < ADC1_CHANNEL_MAX, "ADC1 channel error", ESP_ERR_INVALID_ARG); } RTC_MODULE_CHECK(bits < ADC_WIDTH_MAX, "ADC bit width error", ESP_ERR_INVALID_ARG); +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + RTC_MODULE_CHECK(atten < SOC_ADC_ATTEN_NUM, "ADC Atten Err", ESP_ERR_INVALID_ARG); +#else RTC_MODULE_CHECK(atten < ADC_ATTEN_MAX, "ADC Atten Err", ESP_ERR_INVALID_ARG); +#endif /* ESP_IDF_VERSION_MAJOR */ // portENTER_CRITICAL(&rtc_spinlock); // Configure pattern table, each 8 bit defines one channel @@ -272,10 +276,14 @@ hw_timer_t *timer = NULL; void AFSK_TimerEnable(bool sts) { +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + /* TBD */ +#else if (sts == true) timerAlarmEnable(timer); else timerAlarmDisable(timer); +#endif /* ESP_ARDUINO_VERSION */ } #endif /* !I2S_INTERNAL || CONFIG_IDF_TARGET_ESP32S3 */ #endif /* ESP32 */ @@ -321,20 +329,24 @@ void AFSK_hw_init(void) uint64_t mac = ESP.getEfuseMac(); if (mac == 0x7475ac188534ULL /* || mac == 0x58f8ab188534ULL */) { /* work around wrong R22 value (should be 47K) issue on very first T-TWR Plus batches */ - adc1_config_channel_atten(SPK_PIN, ADC_ATTEN_DB_11); // Input 3.3Vp-p,Use R 10K divider input power 3.3V + adc1_config_channel_atten((adc1_channel_t) SPK_PIN, ADC_ATTEN_DB_11); // Input 3.3Vp-p,Use R 10K divider input power 3.3V } else { - adc1_config_channel_atten(SPK_PIN, ADC_ATTEN_DB_0); // Input 1.24Vp-p,Use R 47K-(10K//10K) divider input power 1.2Vref + adc1_config_channel_atten((adc1_channel_t) SPK_PIN, ADC_ATTEN_DB_0); // Input 1.24Vp-p,Use R 47K-(10K//10K) divider input power 1.2Vref } // esp_adc_cal_get_characteristics(V_REF, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, &characteristics); // Serial.printf("v_ref routed to 3.3V\n"); +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + /* TBD */ +#else // Start a timer at 9.6kHz to sample the ADC and play the audio on the DAC. timer = timerBegin(3, 10, true); // 80 MHz / 10 = 8MHz hardware clock timerAttachInterrupt(timer, &sample_isr, true); // Attaches the handler function to the timer timerAlarmWrite(timer, 834, true); // Interrupts when counter == 834, 9592.3 times a second // timerAlarmEnable(timer); +#endif /* ESP_ARDUINO_VERSION */ #endif /* CONFIG_IDF_TARGET_ESP32S3 */ #endif /* I2S_INTERNAL */ #endif /* ESP32 */ @@ -963,7 +975,7 @@ void IRAM_ATTR sample_isr() } #endif // digitalWrite(4, HIGH); - adcVal = adc1_get_raw(SPK_PIN); // Read ADC1_0 From PIN 36(VP) + adcVal = adc1_get_raw((adc1_channel_t) SPK_PIN); // Read ADC1_0 From PIN 36(VP) // Auto offset level offset_new += adcVal; offset_count++; diff --git a/software/firmware/source/libraries/LibAPRS_ESP32/S3_quirks.c b/software/firmware/source/libraries/LibAPRS_ESP32/S3_quirks.c index f6e680e68..7e9bab5e4 100644 --- a/software/firmware/source/libraries/LibAPRS_ESP32/S3_quirks.c +++ b/software/firmware/source/libraries/LibAPRS_ESP32/S3_quirks.c @@ -1,6 +1,8 @@ #if defined(ESP32) #include "sdkconfig.h" +#include + #if defined(CONFIG_IDF_TARGET_ESP32S3) #include "hal/i2s_hal.h" #include "esp_err.h" @@ -12,6 +14,10 @@ static int mclk_calc(i2s_ll_mclk_div_t *cal) int ma = 0; int mb = 0; +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + /* TBD */ + return -1; +#else cal->mclk_div = I2S_LL_BASE_CLK / MCLK_FREQ; cal->a = 1; cal->b = 0; @@ -43,6 +49,7 @@ static int mclk_calc(i2s_ll_mclk_div_t *cal) min = abs(mb - ma); } } +#endif /* ESP_ARDUINO_VERSION */ } int S3_i2s_mclk_quirk(int i2s_num, uint16_t *a, uint16_t *b, uint16_t *c) @@ -52,6 +59,9 @@ int S3_i2s_mclk_quirk(int i2s_num, uint16_t *a, uint16_t *b, uint16_t *c) int rval = mclk_calc(cal); +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + /* TBD */ +#else *a = cal->a; *b = cal->b; *c = cal->mclk_div; @@ -60,6 +70,7 @@ int S3_i2s_mclk_quirk(int i2s_num, uint16_t *a, uint16_t *b, uint16_t *c) i2s_hal_init(&hal, i2s_num); i2s_ll_tx_set_clk(hal.dev, cal); +#endif /* ESP_ARDUINO_VERSION */ return rval; } diff --git a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/Esp32_i2s.c b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/Esp32_i2s.c index 5893d19d4..3fd8bb842 100644 --- a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/Esp32_i2s.c +++ b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/Esp32_i2s.c @@ -65,10 +65,17 @@ esp_err_t i2sSetSampleRate(uint8_t bus_num, uint32_t sample_rate, bool parallel_ #define MATRIX_DETACH_OUT_SIG 0x100 -#if ESP_IDF_VERSION_MAJOR<=4 +#if ESP_IDF_VERSION_MAJOR<=5 #define I2S_BASE_CLK (160000000L) #endif +#if ESP_IDF_VERSION_MAJOR>=5 +#define I2S_NUM_MAX I2S_NUM_AUTO +#include +#endif + +#include + #define I2S_DMA_BLOCK_COUNT_DEFAULT 0 // 20 bytes gives us enough time if we use single stage idle // But it can't be longer due to non-parrallel mode and 50us reset time @@ -414,12 +421,20 @@ void i2sInit(uint8_t bus_num, // (I2S_NUM_MAX == 2) if (bus_num) { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else periph_module_enable(PERIPH_I2S1_MODULE); +#endif /* ESP_IDF_VERSION_MAJOR */ } else #endif { +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 + /* TBD */ +#else periph_module_enable(PERIPH_I2S0_MODULE); +#endif /* ESP_IDF_VERSION_MAJOR */ } esp_intr_disable(I2S[bus_num].isr_handle); diff --git a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32I2sMethod.h b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32I2sMethod.h index 5ebbd74d7..42bea2d93 100644 --- a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32I2sMethod.h +++ b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32I2sMethod.h @@ -35,6 +35,29 @@ extern "C" #include "Esp32_i2s.h" } +#if defined(ESP_IDF_VERSION_MAJOR) && (ESP_IDF_VERSION_MAJOR >= 4) // IDF 4+ +#include "soc/gpio_pins.h" +#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 +#include "esp32/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/gpio.h" +#else +#error Target CONFIG_IDF_TARGET is not supported +#endif +#else // ESP32 Before IDF 4.0 +#include "rom/gpio.h" +#define GPIO_MATRIX_CONST_ZERO_INPUT GPIO_FUNC_IN_LOW +#define GPIO_MATRIX_CONST_ONE_INPUT GPIO_FUNC_IN_HIGH +#endif + const uint16_t c_dmaBytesPerPixelBytes = 4; class NeoEsp32I2sSpeedWs2812x diff --git a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h index 2a22163e5..69eaaaf0d 100644 --- a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h +++ b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h @@ -54,6 +54,29 @@ extern "C" #define NEOPIXELBUS_RMT_INT_FLAGS (ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1) #endif +#if defined(ESP_IDF_VERSION_MAJOR) && (ESP_IDF_VERSION_MAJOR >= 4) // IDF 4+ +#include "soc/gpio_pins.h" +#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 +#include "esp32/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/gpio.h" +#else +#error Target CONFIG_IDF_TARGET is not supported +#endif +#else // ESP32 Before IDF 4.0 +#include "rom/gpio.h" +#define GPIO_MATRIX_CONST_ZERO_INPUT GPIO_FUNC_IN_LOW +#define GPIO_MATRIX_CONST_ONE_INPUT GPIO_FUNC_IN_HIGH +#endif + class NeoEsp32RmtSpeed { public: diff --git a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEspBitBangMethod.cpp b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEspBitBangMethod.cpp index 93ae066f5..5e6bda864 100644 --- a/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEspBitBangMethod.cpp +++ b/software/firmware/source/libraries/NeoPixelBus/src/internal/methods/NeoEspBitBangMethod.cpp @@ -28,6 +28,12 @@ License along with NeoPixel. If not, see #include +#if defined(ARDUINO_ARCH_ESP32) +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#endif /* ESP_IDF_VERSION_MAJOR */ +#endif /* ARDUINO_ARCH_ESP32 */ + static inline uint32_t getCycleCount(void) { uint32_t ccount; diff --git a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h index c0dc893aa..caac6df85 100644 --- a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h +++ b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h @@ -12,6 +12,10 @@ #include "soc/spi_reg.h" #include "driver/spi_master.h" +#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR>=5 +#include +#endif /* ESP_IDF_VERSION_MAJOR */ + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32) #define CONFIG_IDF_TARGET_ESP32 #endif diff --git a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_C3.h b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_C3.h index 7cc2ac6c9..e604dcb93 100644 --- a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_C3.h +++ b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_C3.h @@ -18,6 +18,10 @@ #include "soc/spi_reg.h" #include "driver/spi_master.h" +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) +#include +#endif /* ESP_ARDUINO_VERSION */ + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32) #define CONFIG_IDF_TARGET_ESP32 #endif diff --git a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.h b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.h index 4ec4e20ea..b2767d045 100644 --- a/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.h +++ b/software/firmware/source/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.h @@ -18,6 +18,10 @@ #include "soc/spi_reg.h" #include "driver/spi_master.h" +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) +#include +#endif /* ESP_ARDUINO_VERSION */ + #if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32) #define CONFIG_IDF_TARGET_ESP32 #endif