chore: checkpoint current IDF 5.5 remediation state

This commit is contained in:
Sebastien L
2026-02-11 20:23:37 +00:00
parent 73bd096f37
commit 71a9c06fe4
197 changed files with 19719 additions and 1015 deletions

View File

@@ -1,6 +1,5 @@
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES json tools platform_config display wifi-manager esp-tls
PRIV_REQUIRES soc esp32
INCLUDE_DIRS .
REQUIRES json tools platform_config display wifi-manager esp-tls driver esp_wifi
PRIV_REQUIRES soc
)

View File

@@ -26,7 +26,6 @@
#include "sdkconfig.h"
#include "soc/efuse_periph.h"
#include "driver/gpio.h"
#include "driver/spi_common_internal.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/efuse.h"
#endif
@@ -96,7 +95,7 @@ const sys_i2c_bus* get_i2c_bus(i2c_port_t port){
if(platform->dev.has_i2c && port == platform->dev.i2c.port-sys_i2c_port_PORT0 && platform->dev.i2c.scl>=0){
return &platform->dev.i2c;
}
if(platform->dev.has_dac && platform->dev.dac.has_i2c && platform->dev.dac.i2c.port == port && platform->dev.dac.i2c.scl>=0){
if(platform->dev.has_dac && platform->dev.dac.has_i2c && (platform->dev.dac.i2c.port - sys_i2c_port_PORT0) == port && platform->dev.dac.i2c.scl>=0){
return &platform->dev.dac.i2c;
}
return NULL;

View File

@@ -119,7 +119,7 @@ esp_err_t actrls_init(const char* profile_name) {
p = strchr(p, '=');
int double_press = dev_config->knobonly.delay_ms > 0 ? dev_config->knobonly.delay_ms : 350;
rotary.timer = xTimerCreate("knobTimer", double_press / portTICK_RATE_MS, pdFALSE, NULL, rotary_timer);
rotary.timer = xTimerCreate("knobTimer", double_press / portTICK_PERIOD_MS, pdFALSE, NULL, rotary_timer);
longpress = 500;
ESP_LOGI(TAG, "single knob navigation %d", double_press);
} else {
@@ -254,7 +254,7 @@ static void control_rotary_handler(void* client, rotary_event_e event, bool long
// need to add a left button the first time
if (rotary.left_count == 1) (*current_controls[sys_btns_actions_KNOB_LEFT])(true);
}
xTimerStart(rotary.timer, 20 / portTICK_RATE_MS);
xTimerStart(rotary.timer, 20 / portTICK_PERIOD_MS);
rotary.left_count++;
} else if (rotary.long_state)
action = sys_btns_actions_A_PREV;
@@ -286,7 +286,7 @@ static void control_rotary_handler(void* client, rotary_event_e event, bool long
action = sys_btns_actions_B_LEFT;
xTimerStop(rotary.timer, 0);
} else
xTimerStart(rotary.timer, 20 / portTICK_RATE_MS);
xTimerStart(rotary.timer, 20 / portTICK_PERIOD_MS);
rotary.click_pending = !rotary.click_pending;
} else if (long_press)
rotary.long_state = !rotary.long_state;

View File

@@ -80,7 +80,7 @@ void battery_svc_init(void) {
adc1_config_channel_atten(BATTERY_CHANNEL(battery), ATTENUATION(battery));
battery.avg = adc1_get_raw(BATTERY_CHANNEL(battery)) * battery.scale / 4095.0;
battery.timer = xTimerCreate("battery", BATTERY_TIMER / portTICK_RATE_MS, pdTRUE, NULL, battery_callback);
battery.timer = xTimerCreate("battery", BATTERY_TIMER / portTICK_PERIOD_MS, pdTRUE, NULL, battery_callback);
xTimerStart(battery.timer, portMAX_DELAY);
ESP_LOGI(TAG, "Battery measure channel: %u, scale %f, atten %d, cells %u, avg %.2fV", BATTERY_CHANNEL(battery), battery.scale, ATTENUATION(battery), battery.battery_config->cells, battery.avg);

View File

@@ -151,7 +151,7 @@ static void buttons_handler(struct button_s* button, int level) {
if (button->long_press && !button->long_timer && button->level == button->type) {
// detect a long press, so hold event generation
ESP_LOGD(TAG, "setting long timer gpio:%u level:%u", button->gpio, button->level);
xTimerChangePeriod(button->timer, button->long_press / portTICK_RATE_MS, 0);
xTimerChangePeriod(button->timer, button->long_press / portTICK_PERIOD_MS, 0);
button->long_timer = true;
} else {
// send a button pressed/released event (content is copied in queue)
@@ -279,7 +279,7 @@ void button_create(void* client, int gpio, int type, bool pull, int debounce, bu
buttons[n_buttons].shifter_gpio = shifter_gpio;
buttons[n_buttons].type = type;
buttons[n_buttons].timer =
xTimerCreate("buttonTimer", buttons[n_buttons].debounce / portTICK_RATE_MS, pdFALSE, (void*)&buttons[n_buttons], buttons_timer_handler);
xTimerCreate("buttonTimer", buttons[n_buttons].debounce / portTICK_PERIOD_MS, pdFALSE, (void*)&buttons[n_buttons], buttons_timer_handler);
buttons[n_buttons].self = buttons + n_buttons;
for (int i = 0; i < n_buttons; i++) {
@@ -318,7 +318,7 @@ void button_create(void* client, int gpio, int type, bool pull, int debounce, bu
for (int i = 0; polled_gpio[i].gpio != -1; i++)
if (polled_gpio[i].gpio == gpio) {
if (!polled_timer) {
polled_timer = xTimerCreate("buttonsPolling", 100 / portTICK_RATE_MS, pdTRUE, polled_gpio, buttons_polling);
polled_timer = xTimerCreate("buttonsPolling", 100 / portTICK_PERIOD_MS, pdTRUE, polled_gpio, buttons_polling);
xTimerStart(polled_timer, portMAX_DELAY);
}

View File

@@ -198,14 +198,14 @@ gpio_exp_t* gpio_exp_create(const gpio_exp_config_t *config) {
}
if(config->phy.ena_pin>=0){
ESP_LOGD(TAG,"Enabling expander with pin %d level %d",config->phy.ena_pin,config->phy.ena_lvl);
gpio_pad_select_gpio(config->phy.ena_pin);
esp_rom_gpio_pad_select_gpio(config->phy.ena_pin);
gpio_set_direction(config->phy.ena_pin, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(config->phy.ena_pin, config->phy.ena_lvl);
}
// set interrupt if possible
if (config->intr >= 0) {
gpio_pad_select_gpio(config->intr);
esp_rom_gpio_pad_select_gpio(config->intr);
gpio_set_direction(config->intr, GPIO_MODE_INPUT);
switch (expander->model->trigger) {
@@ -702,7 +702,7 @@ static esp_err_t i2c_write(uint8_t port, uint8_t addr, uint8_t reg, uint32_t dat
else i2c_master_write_byte(cmd, data, I2C_MASTER_NACK);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(port, cmd, 100 / portTICK_RATE_MS);
esp_err_t ret = i2c_master_cmd_begin(port, cmd, 100 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
if (ret != ESP_OK) {
@@ -737,7 +737,7 @@ static uint32_t i2c_read(uint8_t port, uint8_t addr, uint8_t reg, int len) {
else i2c_master_read_byte(cmd, (uint8_t*) &data, I2C_MASTER_NACK);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(port, cmd, 100 / portTICK_RATE_MS);
esp_err_t ret = i2c_master_cmd_begin(port, cmd, 100 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
if (ret != ESP_OK) {

View File

@@ -62,4 +62,4 @@ esp_err_t gpio_isr_handler_add_x(int gpio, gpio_isr_t isr_handler, void* args)
esp_err_t gpio_isr_handler_remove_x(int gpio);
#define gpio_set_intr_type_x(gpio, type) do { if (gpio < GPIO_NUM_MAX) gpio_set_intr_type(gpio, type); } while (0)
#define gpio_intr_enable_x(gpio) do { if (gpio < GPIO_NUM_MAX) gpio_intr_enable(gpio); } while (0)
#define gpio_pad_select_gpio_x(gpio) do { if (gpio < GPIO_NUM_MAX) gpio_pad_select_gpio(gpio); } while (0)
#define gpio_pad_select_gpio_x(gpio) do { if (gpio < GPIO_NUM_MAX) esp_rom_gpio_pad_select_gpio(gpio); } while (0)

View File

@@ -450,7 +450,7 @@ err:
*/
bool infrared_receive(RingbufHandle_t rb, infrared_handler handler) {
size_t rx_size = 0;
rmt_item32_t* item = (rmt_item32_t*) xRingbufferReceive(rb, &rx_size, 10 / portTICK_RATE_MS);
rmt_item32_t* item = (rmt_item32_t*) xRingbufferReceive(rb, &rx_size, 10 / portTICK_PERIOD_MS);
bool decoded = false;
if (item) {

View File

@@ -130,7 +130,7 @@ static void vCallbackFunction(TimerHandle_t xTimer) {
// regular blinking
xTimerChangePeriod(
xTimer, (led->on ? led->ontime : led->offtime) / portTICK_RATE_MS, BLOCKTIME);
xTimer, (led->on ? led->ontime : led->offtime) / portTICK_PERIOD_MS, BLOCKTIME);
}
/****************************************************************************************
@@ -170,7 +170,7 @@ bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
} else {
if (!leds[idx].timer) {
ESP_LOGD(TAG, "led %d, Creating timer", idx);
leds[idx].timer = xTimerCreate("ledTimer", ontime / portTICK_RATE_MS, pdFALSE,
leds[idx].timer = xTimerCreate("ledTimer", ontime / portTICK_PERIOD_MS, pdFALSE,
(void*)&leds[idx], vCallbackFunction);
}
leds[idx].on = true;

View File

@@ -2,7 +2,6 @@
*
*/
#include "config.h"
#include "esp_app_trace.h"
#include "esp_attr.h"
#include "stdbool.h"
#include <errno.h>

View File

@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/timers.h"
#include "esp_system.h"
@@ -69,10 +70,10 @@ static void task_stats( cJSON* top ) {
for(int i = 0, n = 0; i < current.n; i++ ) {
for (int j = 0; j < previous.n; j++) {
if (current.tasks[i].xTaskNumber == previous.tasks[j].xTaskNumber) {
n += snprintf(scratch + n, SCRATCH_SIZE - n, "%16s (%u) %2u%% s:%5u", current.tasks[i].pcTaskName,
current.tasks[i].eCurrentState,
100 * (current.tasks[i].ulRunTimeCounter - previous.tasks[j].ulRunTimeCounter) / elapsed,
current.tasks[i].usStackHighWaterMark);
n += snprintf(scratch + n, SCRATCH_SIZE - n, "%16s (%u) %2" PRIu32 "%% s:%5" PRIu32, current.tasks[i].pcTaskName,
(unsigned) current.tasks[i].eCurrentState,
(uint32_t) (100 * (current.tasks[i].ulRunTimeCounter - previous.tasks[j].ulRunTimeCounter) / elapsed),
(uint32_t) current.tasks[i].usStackHighWaterMark);
cJSON * t=cJSON_CreateObject();
cJSON_AddNumberToObject(t,"cpu",100 * (current.tasks[i].ulRunTimeCounter - previous.tasks[j].ulRunTimeCounter) / elapsed);
cJSON_AddNumberToObject(t,"minstk",current.tasks[i].usStackHighWaterMark);
@@ -94,7 +95,7 @@ static void task_stats( cJSON* top ) {
#pragma message("Compiled WITHOUT runtime stats")
for (int i = 0, n = 0; i < current.n; i ++) {
n += sprintf(scratch + n, "%16s s:%5u\t", current.tasks[i].pcTaskName, current.tasks[i].usStackHighWaterMark);
n += sprintf(scratch + n, "%16s s:%5" PRIu32 "\t", current.tasks[i].pcTaskName, (uint32_t) current.tasks[i].usStackHighWaterMark);
cJSON * t=cJSON_CreateObject();
cJSON_AddNumberToObject(t,"minstk",current.tasks[i].usStackHighWaterMark);
cJSON_AddNumberToObject(t,"bprio",current.tasks[i].uxBasePriority);
@@ -233,4 +234,4 @@ void monitor_svc_init(void) {
static EXT_RAM_ATTR StackType_t xStack[PSEUDO_IDLE_STACK_SIZE] __attribute__ ((aligned (4)));
xTaskCreateStatic( (TaskFunction_t) pseudo_idle, "pseudo_idle", PSEUDO_IDLE_STACK_SIZE,
NULL, ESP_TASK_PRIO_MIN, xStack, xTaskBuffer );
}
}

View File

@@ -18,6 +18,7 @@
#include "driver/rmt.h"
#include "driver/rtc_io.h"
#include "esp_log.h"
#include "esp_rom_gpio.h"
#include "esp_sleep.h"
#include "globdefs.h"
#include "gpio_exp.h"
@@ -59,6 +60,11 @@ static EXT_RAM_ATTR struct {
static const char* TAG = "services";
static void deep_sleep_timer_cb(TimerHandle_t timer) {
(void)timer;
esp_deep_sleep_start();
}
bool are_GPIOExp_equal(const sys_exp_config* exp1, const sys_exp_config* exp2) {
if (exp1 == NULL || exp2 == NULL) {
return false; // Safeguard against NULL pointers
@@ -135,7 +141,7 @@ void set_gpio_level(sys_gpio_config* gpio, const char* name, gpio_mode_t mode) {
ESP_LOGW(TAG, "Invalid gpio %d for %s", gpio->pin, name);
return;
}
gpio_pad_select_gpio(gpio->pin);
esp_rom_gpio_pad_select_gpio(gpio->pin);
gpio_set_direction(gpio->pin, mode);
gpio_set_level(gpio->pin, gpio->level);
}
@@ -350,7 +356,7 @@ void services_sleep_activate(sleep_cause_e cause) {
// we need to use a timer in case the same button is used for sleep and wake-up and it's
// "pressed" vs "released" selected
if (cause == SLEEP_ONKEY)
xTimerStart(xTimerCreate("sleepTimer", pdMS_TO_TICKS(1000), pdFALSE, NULL, (void (*)(void*))esp_deep_sleep_start), 0);
xTimerStart(xTimerCreate("sleepTimer", pdMS_TO_TICKS(1000), pdFALSE, NULL, deep_sleep_timer_cb), 0);
else
esp_deep_sleep_start();
}