From fe4bd11a2185cb36c13cb812de7b0872d211ae31 Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Fri, 6 Feb 2026 22:30:48 +0100 Subject: [PATCH] preparation for switch to C6 MCU (but also compatible with S3) Signed-off-by: Peter Siegmund --- .../components/api-server/src/api_handlers.c | 12 ++ .../components/led-manager/src/led_status.c | 19 ++- .../led-manager/src/led_strip_ws2812.c | 12 +- firmware/main/Kconfig.projbuild | 116 ++++++------------ firmware/main/include/common.h | 14 ++- firmware/main/include/hal/u8g2_esp32_hal.h | 3 +- firmware/main/src/hal/u8g2_esp32_hal.c | 88 ++++++++----- firmware/main/src/i2c_checker.c | 59 ++++----- firmware/sdkconfig.defaults | 5 + firmware/sdkconfig.defaults.esp32c6 | 18 +++ 10 files changed, 180 insertions(+), 166 deletions(-) diff --git a/firmware/components/api-server/src/api_handlers.c b/firmware/components/api-server/src/api_handlers.c index d358fc0..32aacd2 100644 --- a/firmware/components/api-server/src/api_handlers.c +++ b/firmware/components/api-server/src/api_handlers.c @@ -137,6 +137,7 @@ static bool is_valid(const cJSON *string) esp_err_t api_wifi_config_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/wifi/config"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[256]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -250,6 +251,7 @@ esp_err_t api_wifi_status_handler(httpd_req_t *req) esp_err_t api_light_power_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/light/power"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[64]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -303,6 +305,7 @@ esp_err_t api_light_thunder_handler(httpd_req_t *req) esp_err_t api_light_mode_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/light/mode"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[64]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -352,6 +355,7 @@ esp_err_t api_light_mode_handler(httpd_req_t *req) esp_err_t api_light_schema_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/light/schema"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[128]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -444,6 +448,7 @@ esp_err_t api_wled_config_get_handler(httpd_req_t *req) esp_err_t api_wled_config_post_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/wled/config"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char *buf = heap_caps_malloc(MAX_BODY_SIZE, MALLOC_CAP_DEFAULT); if (!buf) @@ -583,6 +588,7 @@ esp_err_t api_schema_get_handler(httpd_req_t *req) esp_err_t api_schema_post_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/schema/*"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); // Extract filename from URI if (!req) @@ -676,6 +682,7 @@ esp_err_t api_devices_scan_handler(httpd_req_t *req) esp_err_t api_devices_pair_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/devices/pair"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[256]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -706,6 +713,7 @@ esp_err_t api_devices_paired_handler(httpd_req_t *req) esp_err_t api_devices_update_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/devices/update"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[256]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -725,6 +733,7 @@ esp_err_t api_devices_update_handler(httpd_req_t *req) esp_err_t api_devices_unpair_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/devices/unpair"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[128]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -744,6 +753,7 @@ esp_err_t api_devices_unpair_handler(httpd_req_t *req) esp_err_t api_devices_toggle_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/devices/toggle"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[128]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -796,6 +806,7 @@ esp_err_t api_scenes_get_handler(httpd_req_t *req) esp_err_t api_scenes_post_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/scenes"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[512]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); @@ -834,6 +845,7 @@ esp_err_t api_scenes_delete_handler(httpd_req_t *req) esp_err_t api_scenes_activate_handler(httpd_req_t *req) { ESP_LOGI(TAG, "POST /api/scenes/activate"); + ESP_LOGI(TAG, "Request content length: %d", req->content_len); char buf[128]; int ret = httpd_req_recv(req, buf, sizeof(buf) - 1); diff --git a/firmware/components/led-manager/src/led_status.c b/firmware/components/led-manager/src/led_status.c index d4ef475..542e685 100644 --- a/firmware/components/led-manager/src/led_status.c +++ b/firmware/components/led-manager/src/led_status.c @@ -97,22 +97,21 @@ esp_err_t led_status_init(int gpio_num) .max_leds = STATUS_LED_COUNT, .led_model = LED_MODEL_WS2812, .color_component_format = LED_STRIP_COLOR_COMPONENT_FMT_GRBW, - .flags = - { - .invert_out = false, - }, + .flags = {.invert_out = 0}, }; led_strip_rmt_config_t rmt_config = { .clk_src = RMT_CLK_SRC_DEFAULT, .resolution_hz = 10 * 1000 * 1000, // 10MHz .mem_block_symbols = 0, - .flags = - { - .with_dma = false, - }, + .flags = {.with_dma = 0}, }; - ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip)); - ESP_LOGI(TAG, "LED strip initialized."); + esp_err_t ret = led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "Failed to init status LED: %s", esp_err_to_name(ret)); + return ret; + } + ESP_LOGI(TAG, "Status LED initialized."); // Create mutex mutex = xSemaphoreCreateMutex(); diff --git a/firmware/components/led-manager/src/led_strip_ws2812.c b/firmware/components/led-manager/src/led_strip_ws2812.c index f7586f6..e43db31 100644 --- a/firmware/components/led-manager/src/led_strip_ws2812.c +++ b/firmware/components/led-manager/src/led_strip_ws2812.c @@ -72,17 +72,21 @@ esp_err_t led_strip_init(void) .max_leds = MAX_LEDS, .led_model = LED_MODEL_WS2812, .color_component_format = LED_STRIP_COLOR_COMPONENT_FMT_GRB, - .flags = {.invert_out = false}, + .flags = {.invert_out = 0}, }; led_strip_rmt_config_t rmt_config = { .clk_src = RMT_CLK_SRC_DEFAULT, .resolution_hz = 0, .mem_block_symbols = 0, - .flags = {.with_dma = true}, + .flags = {.with_dma = 0}, }; - - ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip)); + esp_err_t ret = led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "Failed to init main LED strip: %s", esp_err_to_name(ret)); + return ret; + } led_command_queue = xQueueCreate(5, sizeof(led_command_t)); if (led_command_queue == NULL) diff --git a/firmware/main/Kconfig.projbuild b/firmware/main/Kconfig.projbuild index e7d0a3c..2605acb 100644 --- a/firmware/main/Kconfig.projbuild +++ b/firmware/main/Kconfig.projbuild @@ -6,84 +6,6 @@ menu "System Control" help Enable or disable WiFi connectivity. - config WIFI_NETWORK_COUNT - depends on WIFI_ENABLED - int "Number of WiFi Networks" - default 1 - range 1 5 - help - Number of WiFi networks to configure (1-5). - - config WIFI_SSID_1 - depends on WIFI_ENABLED - string "WiFi SSID 1" - default "YourSSID1" - help - The SSID of the first WiFi network. - - config WIFI_PASSWORD_1 - depends on WIFI_ENABLED - string "WiFi Password 1" - default "YourPassword1" - help - The password of the first WiFi network. - - config WIFI_SSID_2 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 2 - string "WiFi SSID 2" - default "" - help - The SSID of the second WiFi network. - - config WIFI_PASSWORD_2 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 2 - string "WiFi Password 2" - default "" - help - The password of the second WiFi network. - - config WIFI_SSID_3 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 3 - string "WiFi SSID 3" - default "" - help - The SSID of the third WiFi network. - - config WIFI_PASSWORD_3 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 3 - string "WiFi Password 3" - default "" - help - The password of the third WiFi network. - - config WIFI_SSID_4 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 4 - string "WiFi SSID 4" - default "" - help - The SSID of the fourth WiFi network. - - config WIFI_PASSWORD_4 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 4 - string "WiFi Password 4" - default "" - help - The password of the fourth WiFi network. - - config WIFI_SSID_5 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 5 - string "WiFi SSID 5" - default "" - help - The SSID of the fifth WiFi network. - - config WIFI_PASSWORD_5 - depends on WIFI_ENABLED && WIFI_NETWORK_COUNT >= 5 - string "WiFi Password 5" - default "" - help - The password of the fifth WiFi network. - config WIFI_CONNECT_RETRIES depends on WIFI_ENABLED int "WiFi Connection Retry Attempts per Network" @@ -105,4 +27,42 @@ menu "System Control" help GPIO pin number for the SCL line of the display. endmenu + + menu "Button Configuration" + config BUTTON_UP + int "Button UP GPIO Pin" + default 1 + help + GPIO pin number for the up button. + + config BUTTON_DOWN + int "Button DOWN GPIO Pin" + default 6 + help + GPIO pin number for the down button. + + config BUTTON_LEFT + int "Button LEFT GPIO Pin" + default 3 + help + GPIO pin number for the left button. + + config BUTTON_RIGHT + int "Button RIGHT GPIO Pin" + default 5 + help + GPIO pin number for the right button. + + config BUTTON_SELECT + int "Button SELECT GPIO Pin" + default 18 + help + GPIO pin number for the select button. + + config BUTTON_BACK + int "Button BACK GPIO Pin" + default 16 + help + GPIO pin number for the back button. + endmenu endmenu diff --git a/firmware/main/include/common.h b/firmware/main/include/common.h index 70635a4..02f209c 100644 --- a/firmware/main/include/common.h +++ b/firmware/main/include/common.h @@ -1,8 +1,10 @@ #pragma once -#define BUTTON_UP GPIO_NUM_1 -#define BUTTON_DOWN GPIO_NUM_6 -#define BUTTON_LEFT GPIO_NUM_3 -#define BUTTON_RIGHT GPIO_NUM_5 -#define BUTTON_SELECT GPIO_NUM_18 -#define BUTTON_BACK GPIO_NUM_16 \ No newline at end of file +#include "driver/gpio.h" + +#define BUTTON_UP ((gpio_num_t)CONFIG_BUTTON_UP) +#define BUTTON_DOWN ((gpio_num_t)CONFIG_BUTTON_DOWN) +#define BUTTON_LEFT ((gpio_num_t)CONFIG_BUTTON_LEFT) +#define BUTTON_RIGHT ((gpio_num_t)CONFIG_BUTTON_RIGHT) +#define BUTTON_SELECT ((gpio_num_t)CONFIG_BUTTON_SELECT) +#define BUTTON_BACK ((gpio_num_t)CONFIG_BUTTON_BACK) diff --git a/firmware/main/include/hal/u8g2_esp32_hal.h b/firmware/main/include/hal/u8g2_esp32_hal.h index 14bed50..82742a2 100644 --- a/firmware/main/include/hal/u8g2_esp32_hal.h +++ b/firmware/main/include/hal/u8g2_esp32_hal.h @@ -13,10 +13,11 @@ #include "u8g2.h" #include "driver/gpio.h" -#include "driver/i2c.h" #include "driver/spi_master.h" #include "hal/i2c_types.h" +#include "driver/i2c_master.h" + #define U8G2_ESP32_HAL_UNDEFINED GPIO_NUM_NC #define I2C_MASTER_NUM I2C_NUM_0 // I2C port number for master dev diff --git a/firmware/main/src/hal/u8g2_esp32_hal.c b/firmware/main/src/hal/u8g2_esp32_hal.c index 09de770..80b4f1e 100644 --- a/firmware/main/src/hal/u8g2_esp32_hal.c +++ b/firmware/main/src/hal/u8g2_esp32_hal.c @@ -13,7 +13,11 @@ static const char *TAG = "u8g2_hal"; static const unsigned int I2C_TIMEOUT_MS = 1000; static spi_device_handle_t handle_spi; // SPI handle. -static i2c_cmd_handle_t handle_i2c; // I2C handle. +static i2c_master_bus_handle_t i2c_bus; // I2C bus handle (new driver). +static i2c_master_dev_handle_t i2c_dev; // I2C device handle (new driver). +static uint8_t i2c_tx_buf[256]; // Buffer for one I2C transaction. +static size_t i2c_tx_len; // Current length in buffer. +static uint8_t current_i2c_addr7; // Current 7-bit device address. static u8g2_esp32_hal_t u8g2_esp32_hal; // HAL state data. static bool i2c_transfer_failed = false; // Flag to track I2C transfer errors @@ -148,21 +152,23 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void break; } - i2c_config_t conf = {0}; - conf.mode = I2C_MODE_MASTER; - ESP_LOGI(TAG, "sda_io_num %d", u8g2_esp32_hal.bus.i2c.sda); - conf.sda_io_num = u8g2_esp32_hal.bus.i2c.sda; - conf.sda_pullup_en = GPIO_PULLUP_ENABLE; - ESP_LOGI(TAG, "scl_io_num %d", u8g2_esp32_hal.bus.i2c.scl); - conf.scl_io_num = u8g2_esp32_hal.bus.i2c.scl; - conf.scl_pullup_en = GPIO_PULLUP_ENABLE; - ESP_LOGI(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); - conf.master.clk_speed = I2C_MASTER_FREQ_HZ; - ESP_LOGI(TAG, "i2c_param_config %d", conf.mode); - ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf)); - ESP_LOGI(TAG, "i2c_driver_install %d", I2C_MASTER_NUM); - ESP_ERROR_CHECK( - i2c_driver_install(I2C_MASTER_NUM, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0)); + // Neue I2C-Master-API: Bus einmalig anlegen + if (i2c_bus == NULL) + { + i2c_master_bus_config_t bus_cfg = { + .i2c_port = I2C_MASTER_NUM, + .scl_io_num = u8g2_esp32_hal.bus.i2c.scl, + .sda_io_num = u8g2_esp32_hal.bus.i2c.sda, + .clk_source = I2C_CLK_SRC_DEFAULT, + .flags = {.enable_internal_pullup = true}, + }; + + ESP_LOGI(TAG, "sda_io_num %d", u8g2_esp32_hal.bus.i2c.sda); + ESP_LOGI(TAG, "scl_io_num %d", u8g2_esp32_hal.bus.i2c.scl); + ESP_LOGI(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + ESP_LOGI(TAG, "i2c_new_master_bus %d", I2C_MASTER_NUM); + ESP_ERROR_CHECK(i2c_new_master_bus(&bus_cfg, &i2c_bus)); + } break; } @@ -174,37 +180,55 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void uint8_t *data_ptr = (uint8_t *)arg_ptr; ESP_LOG_BUFFER_HEXDUMP(TAG, data_ptr, arg_int, ESP_LOG_VERBOSE); - while (arg_int > 0) + // Bytes in lokalen Puffer sammeln, tatsächliche Übertragung bei END_TRANSFER + if (i2c_tx_len + (size_t)arg_int > sizeof(i2c_tx_buf)) { - I2C_ERROR_CHECK(i2c_master_write_byte(handle_i2c, *data_ptr, ACK_CHECK_EN)); - if (i2c_transfer_failed) - { - break; - } - data_ptr++; - arg_int--; + ESP_LOGW(TAG, "I2C tx buffer overflow (%zu + %d)", i2c_tx_len, arg_int); + i2c_transfer_failed = true; + break; } + memcpy(&i2c_tx_buf[i2c_tx_len], data_ptr, arg_int); + i2c_tx_len += (size_t)arg_int; break; } case U8X8_MSG_BYTE_START_TRANSFER: { uint8_t i2c_address = u8x8_GetI2CAddress(u8x8); - handle_i2c = i2c_cmd_link_create(); - i2c_transfer_failed = false; // Reset error flag at start of transfer ESP_LOGD(TAG, "Start I2C transfer to %02X.", i2c_address >> 1); - I2C_ERROR_CHECK(i2c_master_start(handle_i2c)); - I2C_ERROR_CHECK(i2c_master_write_byte(handle_i2c, i2c_address | I2C_MASTER_WRITE, ACK_CHECK_EN)); + i2c_transfer_failed = false; // Reset error flag at start of transfer + + // Für neuen Treiber: Device-Handle für diese 7-Bit-Adresse anlegen (oder wiederverwenden) + uint8_t addr7 = i2c_address >> 1; + if (i2c_dev == NULL || addr7 != current_i2c_addr7) + { + if (i2c_dev) + { + i2c_master_bus_rm_device(i2c_dev); + i2c_dev = NULL; + } + + i2c_device_config_t dev_cfg = { + .device_address = addr7, + .scl_speed_hz = I2C_MASTER_FREQ_HZ, + }; + ESP_ERROR_CHECK(i2c_master_bus_add_device(i2c_bus, &dev_cfg, &i2c_dev)); + current_i2c_addr7 = addr7; + } + i2c_tx_len = 0; break; } case U8X8_MSG_BYTE_END_TRANSFER: { ESP_LOGD(TAG, "End I2C transfer."); - if (!i2c_transfer_failed) + if (!i2c_transfer_failed && i2c_dev != NULL && i2c_tx_len > 0) { - I2C_ERROR_CHECK(i2c_master_stop(handle_i2c)); - I2C_ERROR_CHECK(i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, pdMS_TO_TICKS(I2C_TIMEOUT_MS))); + esp_err_t rc = i2c_master_transmit(i2c_dev, i2c_tx_buf, i2c_tx_len, I2C_TIMEOUT_MS); + if (rc != ESP_OK) + { + ESP_LOGW(TAG, "I2C error: i2c_master_transmit = %d", rc); + i2c_transfer_failed = true; + } } - i2c_cmd_link_delete(handle_i2c); break; } } diff --git a/firmware/main/src/i2c_checker.c b/firmware/main/src/i2c_checker.c index d5ad4ca..9f2519e 100644 --- a/firmware/main/src/i2c_checker.c +++ b/firmware/main/src/i2c_checker.c @@ -1,56 +1,41 @@ #include "i2c_checker.h" -#include "driver/i2c.h" +#include "driver/i2c_master.h" #include "esp_insights.h" #include "esp_log.h" #include "hal/u8g2_esp32_hal.h" static const char *TAG = "i2c_checker"; -esp_err_t i2c_device_check(i2c_port_t i2c_port, uint8_t device_address) +static esp_err_t i2c_device_check(i2c_master_bus_handle_t i2c_bus, uint8_t device_address) { - i2c_cmd_handle_t cmd = i2c_cmd_link_create(); - i2c_master_start(cmd); - // Send the device address with the write bit (LSB = 0) - i2c_master_write_byte(cmd, (device_address << 1) | I2C_MASTER_WRITE, true); - i2c_master_stop(cmd); - - esp_err_t ret = i2c_master_cmd_begin(i2c_port, cmd, pdMS_TO_TICKS(100)); - - i2c_cmd_link_delete(cmd); - - return ret; + // Use the new I2C master driver to probe for the device. + return i2c_master_probe(i2c_bus, device_address, 100); } esp_err_t i2c_bus_scan_and_check(void) { - // 1. Configure and install I2C bus - i2c_config_t conf = { - .mode = I2C_MODE_MASTER, - .sda_io_num = I2C_MASTER_SDA_PIN, + // 1. Configure and create I2C master bus using the new driver API + i2c_master_bus_handle_t i2c_bus = NULL; + i2c_master_bus_config_t bus_cfg = { + .i2c_port = I2C_MASTER_NUM, .scl_io_num = I2C_MASTER_SCL_PIN, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = I2C_MASTER_FREQ_HZ, + .sda_io_num = I2C_MASTER_SDA_PIN, + .clk_source = I2C_CLK_SRC_DEFAULT, + .flags = {.enable_internal_pullup = true}, }; - esp_err_t err = i2c_param_config(I2C_MASTER_NUM, &conf); + + esp_err_t err = i2c_new_master_bus(&bus_cfg, &i2c_bus); if (err != ESP_OK) { - ESP_LOGE(TAG, "I2C parameter configuration failed: %s", esp_err_to_name(err)); + ESP_LOGE(TAG, "I2C bus creation failed: %s", esp_err_to_name(err)); return err; } - err = i2c_driver_install(I2C_MASTER_NUM, conf.mode, 0, 0, 0); - if (err != ESP_OK) - { - ESP_LOGE(TAG, "I2C driver installation failed: %s", esp_err_to_name(err)); - return err; - } + ESP_LOGI(TAG, "I2C master bus initialized. Searching for device..."); - ESP_LOGI(TAG, "I2C driver initialized. Searching for device..."); - - // 2. Check if the device is present - err = i2c_device_check(I2C_MASTER_NUM, DISPLAY_I2C_ADDRESS); + // 2. Check if the device is present using the new API + err = i2c_device_check(i2c_bus, DISPLAY_I2C_ADDRESS); if (err == ESP_OK) { @@ -66,9 +51,13 @@ esp_err_t i2c_bus_scan_and_check(void) ESP_LOGE(TAG, "Error communicating with address 0x%02X: %s", DISPLAY_I2C_ADDRESS, esp_err_to_name(err)); } - // 3. Uninstall I2C driver if it is no longer needed - i2c_driver_delete(I2C_MASTER_NUM); - ESP_DIAG_EVENT(TAG, "I2C driver uninstalled."); + // 3. Delete I2C master bus if it is no longer needed + esp_err_t del_err = i2c_del_master_bus(i2c_bus); + if (del_err != ESP_OK) + { + ESP_LOGW(TAG, "Failed to delete I2C master bus: %s", esp_err_to_name(del_err)); + } + ESP_DIAG_EVENT(TAG, "I2C master bus deleted."); return err; } diff --git a/firmware/sdkconfig.defaults b/firmware/sdkconfig.defaults index e70ad99..1a31473 100755 --- a/firmware/sdkconfig.defaults +++ b/firmware/sdkconfig.defaults @@ -45,3 +45,8 @@ CONFIG_SPIRAM_USE_CAPS_ALLOC=y # HTTP Server WebSocket Support CONFIG_HTTPD_WS_SUPPORT=y + +# MQTT +CONFIG_MQTT_CLIENT_BROKER_URL="mqtts://mqtt.mars3142.dev:8883" +CONFIG_MQTT_CLIENT_USERNAME="mars3142" +CONFIG_MQTT_CLIENT_PASSWORD="KPkEyzs9aur3Y7LfEybnd8PsxWd94ouQZGNGJ24y" diff --git a/firmware/sdkconfig.defaults.esp32c6 b/firmware/sdkconfig.defaults.esp32c6 index a7b537a..c5e08d6 100644 --- a/firmware/sdkconfig.defaults.esp32c6 +++ b/firmware/sdkconfig.defaults.esp32c6 @@ -1,2 +1,20 @@ # default ESP target CONFIG_IDF_TARGET="esp32c6" + +# +# Display Settings +# +CONFIG_DISPLAY_SDA_PIN=9 +CONFIG_DISPLAY_SCL_PIN=8 +# end of Display Settings + +# +# Button Configuration +# +CONFIG_BUTTON_UP=7 +CONFIG_BUTTON_DOWN=4 +CONFIG_BUTTON_LEFT=6 +CONFIG_BUTTON_RIGHT=5 +CONFIG_BUTTON_SELECT=19 +CONFIG_BUTTON_BACK=20 +# end of Button Configuration