Prep serial IDF 5.2 support

This commit is contained in:
Theo Arends 2024-07-04 16:04:59 +02:00
parent 843dd17aec
commit 04a6d5513b
4 changed files with 8 additions and 8 deletions

View File

@ -150,7 +150,7 @@ void TasmotaSerial::setTransmitEnablePin(int tx_enable_pin) {
#ifdef ESP32 #ifdef ESP32
bool TasmotaSerial::freeUart(void) { bool TasmotaSerial::freeUart(void) {
for (uint32_t i = SOC_UART_NUM -1; i >= 0; i--) { for (uint32_t i = SOC_UART_HP_NUM -1; i >= 0; i--) {
if (0 == bitRead(tasmota_serial_uart_bitmap, i)) { if (0 == bitRead(tasmota_serial_uart_bitmap, i)) {
m_uart = uart_port_t(i); m_uart = uart_port_t(i);
bitSet(tasmota_serial_uart_bitmap, m_uart); bitSet(tasmota_serial_uart_bitmap, m_uart);

View File

@ -33,6 +33,12 @@
#ifdef ESP32 #ifdef ESP32
#include <HardwareSerial.h> #include <HardwareSerial.h>
// IDF 5.2 has changed counting UART channels, SOC_UART_NUM includes now LP UARTS too for ESP32-C6 and -P4
#ifndef SOC_UART_HP_NUM
#define SOC_UART_HP_NUM SOC_UART_NUM // Set new define SOC_UART_HP_NUM in pre IDF 5.2 to SOC_UART_NUM
#endif
#endif #endif
class TasmotaSerial : public Stream { class TasmotaSerial : public Stream {

View File

@ -191,11 +191,5 @@ typedef int SerConfu8;
#define LCD_CAM_LCD_UPDATE_REG LCD_CAM_LCD_UPDATE_M #define LCD_CAM_LCD_UPDATE_REG LCD_CAM_LCD_UPDATE_M
#endif // LCD_CAM_LCD_UPDATE_M #endif // LCD_CAM_LCD_UPDATE_M
// IDF 5.2 has changed counting UART channels, SOC_UART_NUM includes now LP UARTS too
#ifdef SOC_UART_HP_NUM
#undef SOC_UART_NUM
#define SOC_UART_NUM SOC_UART_HP_NUM
#endif
#endif // ESP32 #endif // ESP32
#endif // __ESP8266TOESP32_H__ #endif // __ESP8266TOESP32_H__

View File

@ -3125,7 +3125,7 @@ void SML_Init(void) {
uint16_t memory = 0; uint16_t memory = 0;
#ifdef ESP32 #ifdef ESP32
uint32_t uart_index = SOC_UART_NUM - 1; uint32_t uart_index = SOC_UART_HP_NUM - 1;
#endif #endif
sml_globs.sml_send_blocks = 0; sml_globs.sml_send_blocks = 0;