8 Commits

Author SHA1 Message Date
77ba8e58b9 wip: 2025-12-08 13:10:43 +03:00
8fb0fd3f09 wip: 2025-12-08 13:10:28 +03:00
9c3aaa2863 wip: 2025-12-08 12:59:18 +03:00
e7cb9f76d6 wip: 2025-12-08 11:27:58 +03:00
d73c64a2a5 wip: 2025-12-08 09:46:40 +03:00
d6193d7192 wip: 2025-12-07 11:00:40 +03:00
c29b702a7c wip: 2025-12-07 10:42:38 +03:00
80b1f0bf23 wip: 2025-12-06 10:21:15 +03:00
3 changed files with 10 additions and 5 deletions

View File

@@ -1,13 +1,17 @@
# ESP32 ESP-IDF component for AC dimmer 115V/400Hz
# ESP32 ESP-IDF component for AC dimmer
## Tested on
1. [ESP32 ESP-IDF v5.5.1](https://docs.espressif.com/projects/esp-idf/en/v5.5.1/esp32/index.html)
## Features
1. Supports frequency up to 400 Hz.
2. Automatic frequency detection.
## Attention
1. Supports frequency 400Hz only.
2. For correct operation, please enable the following settings in the menuconfig:
For correct operation, please enable the following settings in the menuconfig:
```text
GPIO_CTRL_FUNC_IN_IRAM
@@ -43,6 +47,7 @@ void app_main(void)
zh_ac_dimmer_init_config_t config = ZH_AC_DIMMER_INIT_CONFIG_DEFAULT();
config.zero_cross_gpio = GPIO_NUM_16;
config.triac_gpio = GPIO_NUM_17;
config.ac_frequency = 50;
zh_ac_dimmer_init(&config);
zh_ac_dimmer_start();
uint8_t value = 0;

View File

@@ -1 +1 @@
2.0.0
1.3.0

View File

@@ -113,7 +113,7 @@ esp_err_t zh_ac_dimmer_get(uint8_t *value)
return ESP_OK;
}
static esp_err_t _zh_ac_dimmer_validate_config(const zh_ac_dimmer_init_config_t *config)
static esp_err_t _zh_ac_dimmer_validate_config(const zh_ac_dimmer_init_config_t *config) //-V2008
{
ZH_ERROR_CHECK(config != NULL, ESP_ERR_INVALID_ARG, NULL, "Initial config is NULL.");
ZH_ERROR_CHECK((config->zero_cross_gpio >= GPIO_NUM_0 && config->zero_cross_gpio < GPIO_NUM_MAX), ESP_ERR_INVALID_ARG, NULL, "Zero cross GPIO invalid.");