compiles for 2.0.13/idf4.4.6 and 3.0.0/idf5.1 (see pio_local.example)

This commit is contained in:
MichaelDvP
2023-10-03 15:28:27 +02:00
parent 3c8a00be09
commit a3300e94a7
8 changed files with 25 additions and 9 deletions

View File

@@ -84,7 +84,7 @@ typedef struct {
};
} lwip_event_packet_t;
static xQueueHandle _async_queue;
static QueueHandle_t _async_queue;
static TaskHandle_t _async_service_task_handle = NULL;

View File

@@ -185,7 +185,7 @@ void AsyncEventSourceClient::_queueMessage(AsyncEventSourceMessage *dataMessage)
return;
}
if(_messageQueue.length() >= SSE_MAX_QUEUED_MESSAGES){
ets_printf(String(F("ERROR: Too many messages queued\n")).c_str());
// ets_printf(String(F("ERROR: Too many messages queued\n")).c_str());
delete dataMessage;
} else {
_messageQueue.add(dataMessage);

View File

@@ -71,8 +71,8 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
memset(_buf, 0x00, 16);
#ifdef ESP32
mbedtls_md5_init(&_ctx);
mbedtls_md5_update_ret (&_ctx,data,len);
mbedtls_md5_finish_ret(&_ctx,data);
mbedtls_md5_update (&_ctx,data,len);
mbedtls_md5_finish(&_ctx,data);
mbedtls_internal_md5_process( &_ctx ,data);
#else
MD5Init(&_ctx);

View File

@@ -1,5 +1,6 @@
#include <UploadFileService.h>
#include <esp_ota_ops.h>
#include <esp_app_format.h>
#include "../../src/emsesp_stub.hpp"

View File

@@ -21,6 +21,9 @@ default_envs = esp32_4M
; default_envs = debug
[env:esp32_4M]
; update to arduino 3, IDF 5
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
;
; if using OTA enter your details below
; upload_protocol = espota
; upload_flags =

View File

@@ -213,15 +213,23 @@ void AnalogSensor::reload() {
publish_sensor(sensor);
} else if (sensor.type() >= AnalogType::PWM_0) {
LOG_DEBUG("Adding PWM output sensor on GPIO %02d", sensor.gpio());
uint channel = sensor.type() - AnalogType::PWM_0;
#if ESP_IDF_VERSION_MAJOR >= 5
ledcAttach(sensor.gpio(), sensor.factor(), 13);
#else
uint8_t channel = sensor.type() - AnalogType::PWM_0;
ledcSetup(channel, sensor.factor(), 13);
ledcAttachPin(sensor.gpio(), channel);
#endif
if (sensor.offset() > 100) {
sensor.set_offset(100);
} else if (sensor.offset() < 0) {
sensor.set_offset(0);
}
#if ESP_IDF_VERSION_MAJOR >= 5
ledcWrite(sensor.gpio(), (uint32_t)(sensor.offset() * 8191 / 100));
#else
ledcWrite(channel, (uint32_t)(sensor.offset() * 8191 / 100));
#endif
sensor.set_value(sensor.offset());
sensor.set_uom(DeviceValueUOM::PERCENT);
publish_sensor(sensor);
@@ -798,7 +806,6 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) {
return true;
}
} else if (sensor.type() >= AnalogType::PWM_0) {
uint8_t channel = sensor.type() - AnalogType::PWM_0;
if (val > 100) {
val = 100;
} else if (val < 0) {
@@ -806,7 +813,12 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) {
}
sensor.set_offset(val);
sensor.set_value(val);
#if ESP_IDF_VERSION_MAJOR >= 5
ledcWrite(sensor.gpio(), (uint32_t)(sensor.offset() * 8191 / 100));
#else
uint8_t channel = sensor.type() - AnalogType::PWM_0;
ledcWrite(channel, (uint32_t)(val * 8191 / 100));
#endif
publish_sensor(sensor);
return true;
}

View File

@@ -696,7 +696,7 @@ void System::network_init(bool refresh) {
// ETH_CLOCK_GPIO17_OUT = 3 RMII clock output from GPIO17, for 50hz inverted clock
auto clock_mode = (eth_clock_mode_t)eth_clock_mode_;
eth_present_ = ETH.begin(phy_addr, power, mdc, mdio, type, clock_mode);
eth_present_ = ETH.begin((eth_phy_type_t)phy_addr, power, mdc, mdio, type, clock_mode);
#endif
}

View File

@@ -251,7 +251,7 @@ void WebDataService::write_device_value(AsyncWebServerRequest * request, JsonVar
return_code = Command::call(device_type, cmd, data.as<const char *>(), true, id, output);
} else if (data.is<int>()) {
char s[10];
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<int>(), 0), true, id, output);
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<int32_t>(), 0), true, id, output);
} else if (data.is<float>()) {
char s[10];
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<float>(), 1), true, id, output);
@@ -288,7 +288,7 @@ void WebDataService::write_device_value(AsyncWebServerRequest * request, JsonVar
return_code = Command::call(device_type, cmd, data.as<const char *>(), true, id, output);
} else if (data.is<int>()) {
char s[10];
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<int>(), 0), true, id, output);
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<int32_t>(), 0), true, id, output);
} else if (data.is<float>()) {
char s[10];
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<float>(), 1), true, id, output);