This commit is contained in:
2025-11-16 10:38:37 +03:00
parent 80307fc435
commit 5222ee0132
4 changed files with 31 additions and 31 deletions

View File

@@ -19,8 +19,6 @@ static void zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int
void app_main(void)
{
esp_log_level_set("zh_pcf8574", ESP_LOG_NONE);
esp_log_level_set("zh_vector", ESP_LOG_NONE);
nvs_flash_init();
esp_event_loop_create_default();
zh_wifi_softap_init();
@@ -83,6 +81,7 @@ static void zh_io_expander_init(void)
esp_event_handler_instance_register(ZH_PCF8574, ESP_EVENT_ANY_ID, &zh_pcf8574_event_handler, NULL, NULL);
zh_pcf8574_init_config_t config = ZH_PCF8574_INIT_CONFIG_DEFAULT();
config.i2c_handle = i2c_bus_handle;
config.stack_size = 3072;
config.i2c_address = LED_I2C_ADDRESS;
zh_pcf8574_init(&config, &led_handle);
config.i2c_address = RELAY_I2C_ADDRESS;
@@ -107,14 +106,14 @@ static void zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int
{
zh_pcf8574_write_gpio(&led_handle, TS_LED_RED, LED_ON);
zh_pcf8574_write_gpio(&led_handle, TS_LED_GREEN, LED_OFF);
zh_pcf8574_write_gpio(&relay_handle, TS_RELAY, RELAY_OFF);
zh_pcf8574_write_gpio(&relay_handle, TS_RELAY, RELAY_ON);
is_ts = false;
}
else
{
zh_pcf8574_write_gpio(&led_handle, TS_LED_RED, LED_OFF);
zh_pcf8574_write_gpio(&led_handle, TS_LED_GREEN, LED_ON);
zh_pcf8574_write_gpio(&relay_handle, TS_RELAY, RELAY_ON);
zh_pcf8574_write_gpio(&relay_handle, TS_RELAY, RELAY_OFF);
is_ts = true;
}
}