make Tasmota compatible for Arduino espressif32 based on IDF 5.2.2 (#21723)

Co-authored-by: Christian Baars <Baars@gmx.de>
This commit is contained in:
Jason2866 2024-07-03 20:27:18 +02:00 committed by GitHub
parent 59fc68026b
commit b1422ff6b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 37 additions and 13 deletions

View File

@ -152,7 +152,7 @@ void TasmotaSerial::setTransmitEnablePin(int tx_enable_pin) {
bool TasmotaSerial::freeUart(void) {
for (uint32_t i = SOC_UART_NUM -1; i >= 0; i--) {
if (0 == bitRead(tasmota_serial_uart_bitmap, i)) {
m_uart = i;
m_uart = uart_port_t(i);
bitSet(tasmota_serial_uart_bitmap, m_uart);
return true;
}

View File

@ -109,7 +109,7 @@ class TasmotaSerial : public Stream {
uint32_t m_speed;
uint32_t m_config;
HardwareSerial *TSerial;
int m_uart = 0;
uart_port_t m_uart = uart_port_t(0);
#endif
};

View File

@ -75,8 +75,9 @@ bool NtpServer::processOneRequest(uint32_t utc, uint32_t millisecs)
packet.receiveTimestampFraction = recvFract;
// ...and the transmit time.
// the latency has been between 135 and 175 microseconds in internal testing, so we harcode 150
uint32_t transFract = recvFract+(150*(10^3)/(2^32)); // microsec/((10^3)/(2^32))
// the latency has been between 135 and 175 microseconds in internal testing, so we hardcode 150
constexpr uint32_t latency = (150*1000) / (1LL << 32);
uint32_t transFract = recvFract + latency;
if (recvFract>transFract){
recvSecs++; //overflow
}

View File

@ -96,6 +96,10 @@ public:
int connect(const char *host, uint16_t port) override;
int connect(IPAddress ip, uint16_t port, int32_t timeout) { return connect(ip, port, 0);}
int connect(const char *host, uint16_t port, int32_t timeout) { return connect(host, port, 0);}
uint8_t connected() override;
void validate(const char *host, uint16_t port);

View File

@ -183,5 +183,19 @@ typedef int SerConfu8;
#define STATION_IF 0
// ESP32 needed define to support IDF 5.2 based Arduino builds
// Name has changed
#ifdef LCD_CAM_LCD_UPDATE_M
#define LCD_CAM_LCD_UPDATE_REG 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 // __ESP8266TOESP32_H__

View File

@ -77,7 +77,8 @@ lib_extra_dirs = ${library.lib_extra_dirs}
[env:tasmota32_base]
; *** Uncomment next lines ";" to enable development Tasmota Arduino version ESP32
;platform = https://github.com/tasmota/platform-espressif32.git
;platform = https://github.com/Jason2866/platform-espressif32/releases/download/2024.07.20/platform-espressif32.zip
;platform_packages = framework-arduinoespressif32 @
; framework-arduino-solo1 @
; framework-arduino-ITEAD @

View File

@ -166,7 +166,11 @@ void CrashDumpClear(void)
// extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack, uint32_t stack_end )
// esp_err_t IRAM_ATTR esp_backtrace_print(int depth)
#if defined __has_include && __has_include("xtensa_api.h")
#include "xtensa_api.h"
#else
#include "freertos/xtensa_api.h"
#endif
#include "esp_debug_helpers.h"
#include "esp_cpu_utils.h"
extern "C" {