diff --git a/components/zh_ac_dimmer b/components/zh_ac_dimmer index d395814..77ba8e5 160000 --- a/components/zh_ac_dimmer +++ b/components/zh_ac_dimmer @@ -1 +1 @@ -Subproject commit d395814812536bf4dd4c1eeb260de4562bdd2fdb +Subproject commit 77ba8e58b99440ca1e80be7c1dccb716f8b60685 diff --git a/components/zh_encoder b/components/zh_encoder index e133e5a..d5c9415 160000 --- a/components/zh_encoder +++ b/components/zh_encoder @@ -1 +1 @@ -Subproject commit e133e5a8076dfc47c2796eaf52ff810b93fda34a +Subproject commit d5c94158c2acdf7fe1ab279ca48c79901c7cff57 diff --git a/components/zh_pcf8574 b/components/zh_pcf8574 index 379fae9..1a8f471 160000 --- a/components/zh_pcf8574 +++ b/components/zh_pcf8574 @@ -1 +1 @@ -Subproject commit 379fae940b1ded3ac0a655e4ba48d997e7b1b09f +Subproject commit 1a8f4711e8a1e2005860d8ffaee13bb37af73e58 diff --git a/main/ate0003.c b/main/ate0003.c index 3603d50..c035915 100644 --- a/main/ate0003.c +++ b/main/ate0003.c @@ -47,18 +47,10 @@ void app_main(void) _zh_system_load(); _zh_encoder_init(); _zh_ac_dimmer_init(); - // gpio_set_level(GPIO_NUM_4, 1); - // zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_RED, LED_ON); - // zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_BLUE, LED_ON); + zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_RED, LED_ON); + zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_BLUE, LED_ON); zh_pcf8574_write_gpio(&_relay_handle, DMM_RELAY, RELAY_ON); - zh_pcf8574_write_gpio(&_relay_handle, GROUND_RELAY, RELAY_ON); - zh_pcf8574_write_gpio(&_relay_handle, L1_RELAY, RELAY_ON); - zh_pcf8574_write_gpio(&_relay_handle, L2_RELAY, RELAY_ON); - zh_pcf8574_write_gpio(&_relay_handle, L3_RELAY, RELAY_ON); - zh_pcf8574_write_gpio(&_relay_handle, L4_RELAY, RELAY_ON); - vTaskDelay(20); - zh_ac_dimmer_start(); - // _zh_component_select(0); + _zh_component_select(0); } static void _zh_wifi_softap_init(void) @@ -95,7 +87,7 @@ static void _zh_encoder_init(void) config.b_gpio_number = GPIO_NUM_26; config.encoder_min_value = 0; config.encoder_max_value = 100; - config.encoder_step = 5; + config.encoder_step = 1; config.encoder_number = POWER_ENCODER; zh_encoder_init(&config, &_power_encoder_handle); zh_encoder_set(&_power_encoder_handle, 100); @@ -115,6 +107,7 @@ static void _zh_ac_dimmer_init(void) config.zero_cross_gpio = GPIO_NUM_16; config.triac_gpio = GPIO_NUM_4; zh_ac_dimmer_init(&config); + zh_ac_dimmer_set(100); } static void _zh_pcf8574_init(void) @@ -226,7 +219,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_BLUE, LED_OFF); zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_GREEN, LED_ON); - _zh_relay_on(L1_RELAY); + _zh_relay_on(L_1_RELAY); } else { @@ -237,7 +230,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_BLUE, LED_ON); zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_GREEN, LED_OFF); - _zh_relay_off(L1_RELAY); + _zh_relay_off(L_1_RELAY); _is_num_1_fixed = false; } break; @@ -254,7 +247,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_BLUE, LED_OFF); zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_GREEN, LED_ON); - _zh_relay_on(L2_RELAY); + _zh_relay_on(L_2_RELAY); } else { @@ -265,7 +258,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_BLUE, LED_ON); zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_GREEN, LED_OFF); - _zh_relay_off(L2_RELAY); + _zh_relay_off(L_2_RELAY); _is_num_2_fixed = false; } break; @@ -282,7 +275,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_BLUE, LED_OFF); zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_GREEN, LED_ON); - _zh_relay_on(L3_RELAY); + _zh_relay_on(L_3_RELAY); } else { @@ -293,7 +286,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_BLUE, LED_ON); zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_GREEN, LED_OFF); - _zh_relay_off(L3_RELAY); + _zh_relay_off(L_3_RELAY); _is_num_3_fixed = false; } break; @@ -310,7 +303,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_BLUE, LED_OFF); zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_GREEN, LED_ON); - _zh_relay_on(L4_RELAY); + _zh_relay_on(L_4_RELAY); } else { @@ -321,7 +314,7 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in } zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_BLUE, LED_ON); zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_GREEN, LED_OFF); - _zh_relay_off(L4_RELAY); + _zh_relay_off(L_4_RELAY); _is_num_4_fixed = false; } break; @@ -339,7 +332,7 @@ static void _zh_encoder_event_handler(void *arg, esp_event_base_t event_base, in zh_160x_set_cursor(&_lcd_handle, 1, 2); zh_160x_print_int(&_lcd_handle, (uint8_t)event->encoder_position); zh_160x_print_char(&_lcd_handle, "% "); - zh_ac_dimmer_set(event->encoder_position); + zh_ac_dimmer_set((uint8_t)event->encoder_position); break; case COMPONENT_ENCODER: if (_is_work == true) diff --git a/main/ate0003.h b/main/ate0003.h index 86b7f17..282d804 100644 --- a/main/ate0003.h +++ b/main/ate0003.h @@ -33,10 +33,10 @@ #define GROUND_RELAY 0x00 /*!< Relay K1. RL1 pin on U8. */ #define DMM_RELAY 0x01 /*!< Relay K2. RL2 pin on U8. */ -#define L1_RELAY 0x03 /*!< Relay K4. RL4 pin on U8. */ -#define L2_RELAY 0x04 /*!< Relay K3. RL3 pin on U8. */ -#define L3_RELAY 0x05 /*!< Relay K6. RL6 pin on U8. */ -#define L4_RELAY 0x02 /*!< Relay K5. RL5 pin on U8. */ +#define L_1_RELAY 0x03 /*!< Relay K4. RL4 pin on U8. */ +#define L_2_RELAY 0x04 /*!< Relay K3. RL3 pin on U8. */ +#define L_3_RELAY 0x05 /*!< Relay K6. RL6 pin on U8. */ +#define L_4_RELAY 0x02 /*!< Relay K5. RL5 pin on U8. */ #define L5_RELAY 0x06 /*!< Relay K7. RL7 pin on U8. */ #define POWER_ENCODER 0x01 /*!< Connector EN2. */ diff --git a/pcb/BOM_ATE0003.000.001_v.3.xlsx b/pcb/BOM_ATE0003.000.001_v.3.xlsx index 51f2677..cf59fc0 100644 Binary files a/pcb/BOM_ATE0003.000.001_v.3.xlsx and b/pcb/BOM_ATE0003.000.001_v.3.xlsx differ