From 284553f3f8be2ab8d419ec78dc703d1fde971c47 Mon Sep 17 00:00:00 2001 From: localhorst Date: Sat, 17 Jan 2026 23:15:51 +0100 Subject: [PATCH] C3 Demo --- main/config.c | 16 ++++++++-------- main/led.c | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/main/config.c b/main/config.c index b3e47e2..eb118a1 100644 --- a/main/config.c +++ b/main/config.c @@ -22,18 +22,18 @@ static const char *TAG = "CONFIG"; #define HARDCODED_CONFIG #ifdef HARDCODED_CONFIG -#define HARDCODED_CONFIG_LED_STRIP_A_PIN 3U -#define HARDCODED_CONFIG_LED_STRIP_B_PIN 2U -#define HARDCODED_CONFIG_LED_STRIP_A_COUNT 10U -#define HARDCODED_CONFIG_LED_STRIP_B_COUNT 10U +#define HARDCODED_CONFIG_LED_STRIP_A_PIN 2U +#define HARDCODED_CONFIG_LED_STRIP_B_PIN 3U +#define HARDCODED_CONFIG_LED_STRIP_A_COUNT 1U +#define HARDCODED_CONFIG_LED_STRIP_B_COUNT 1U #define HARDCODED_CONFIG_PWM_PIN 1U #if defined(CONFIG_IDF_TARGET_ESP32C3) - #define HARDCODED_CONFIG_LOCALBTN_PIN 9 +#define HARDCODED_CONFIG_LOCALBTN_PIN 9 #elif defined(CONFIG_IDF_TARGET_ESP32) - #define HARDCODED_CONFIG_LOCALBTN_PIN 0 +#define HARDCODED_CONFIG_LOCALBTN_PIN 0 #else - #error "Unsupported target: BOOT button GPIO not defined" +#error "Unsupported target: BOOT button GPIO not defined" #endif #endif @@ -82,7 +82,7 @@ static esp_err_t load_config_from_nvs(void) // We found a valid config break; } - + ESP_LOGI(TAG, "Loaded config from NVS"); ESP_LOGI(TAG, " Strip A: GPIO%d", current_config.led_pin_strip_a); ESP_LOGI(TAG, " Strip B: GPIO%d", current_config.led_pin_strip_b); diff --git a/main/led.c b/main/led.c index 4390080..6139fd7 100644 --- a/main/led.c +++ b/main/led.c @@ -194,7 +194,13 @@ static esp_err_t init_strip(led_strip_t *strip, int8_t pin, uint16_t num_leds) rmt_tx_channel_config_t tx_chan_config = { .clk_src = RMT_CLK_SRC_DEFAULT, .gpio_num = pin, +#if defined(CONFIG_IDF_TARGET_ESP32C3) .mem_block_symbols = 48, +#elif defined(CONFIG_IDF_TARGET_ESP32) + .mem_block_symbols = 64, +#else +#error "Unsupported target: rmt block symbols undefined" +#endif .resolution_hz = 80000000, // 80MHz .trans_queue_depth = 4, };