1 Commits

Author SHA1 Message Date
b4224641db feat!: changed support for AC frequency to 400 Hz only 2025-12-10 09:47:51 +03:00
3 changed files with 5 additions and 10 deletions

View File

@@ -1,17 +1,13 @@
# ESP32 ESP-IDF component for AC dimmer
# ESP32 ESP-IDF component for AC dimmer 115V/400Hz
## 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
For correct operation, please enable the following settings in the menuconfig:
1. Supports frequency 400Hz only.
2. For correct operation, please enable the following settings in the menuconfig:
```text
GPIO_CTRL_FUNC_IN_IRAM
@@ -47,7 +43,6 @@ 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 @@
1.3.0
2.0.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) //-V2008
static esp_err_t _zh_ac_dimmer_validate_config(const zh_ac_dimmer_init_config_t *config)
{
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.");