feat: initial
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.vscode
|
||||
.DS_Store
|
||||
build
|
||||
sdkconfig.old
|
||||
18
.gitmodules
vendored
Normal file
18
.gitmodules
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
[submodule "components/zh_ota_server"]
|
||||
path = components/zh_ota_server
|
||||
url = http://git.zh.com.ru/esp_components/zh_ota_server
|
||||
[submodule "components/zh_pcf8574"]
|
||||
path = components/zh_pcf8574
|
||||
url = http://git.zh.com.ru/esp_components/zh_pcf8574
|
||||
[submodule "components/zh_ac_dimmer"]
|
||||
path = components/zh_ac_dimmer
|
||||
url = http://git.zh.com.ru/esp_components/zh_ac_dimmer
|
||||
[submodule "components/zh_encoder"]
|
||||
path = components/zh_encoder
|
||||
url = http://git.zh.com.ru/esp_components/zh_encoder
|
||||
[submodule "components/zh_160x_i2c"]
|
||||
path = components/zh_160x_i2c
|
||||
url = http://git.zh.com.ru/esp_components/zh_160x_i2c
|
||||
[submodule "components/zh_vector"]
|
||||
path = components/zh_vector
|
||||
url = http://git.zh.com.ru/esp_components/zh_vector
|
||||
3
CMakeLists.txt
Normal file
3
CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(ate0003)
|
||||
17
README.md
17
README.md
@@ -1,2 +1,17 @@
|
||||
# ate0003.000.000
|
||||
# Universal Phase-Controlled Aircraft Light Activation Box
|
||||
|
||||
## Tested on
|
||||
|
||||
1. [ESP32 ESP-IDF v5.5.1](https://docs.espressif.com/projects/esp-idf/en/v5.5.1/esp32/index.html)
|
||||
|
||||
## Build and flash
|
||||
|
||||
Run the following command to firmware build and flash module:
|
||||
|
||||
```text
|
||||
cd your_projects_folder
|
||||
git clone --recurse-submodules http://git.zh.com.ru/aerotech/ate0003
|
||||
cd ate0003
|
||||
idf.py build
|
||||
idf.py flash
|
||||
```
|
||||
|
||||
1
components/zh_160x_i2c
Submodule
1
components/zh_160x_i2c
Submodule
Submodule components/zh_160x_i2c added at f1ce1febc8
1
components/zh_ac_dimmer
Submodule
1
components/zh_ac_dimmer
Submodule
Submodule components/zh_ac_dimmer added at b4224641db
1
components/zh_encoder
Submodule
1
components/zh_encoder
Submodule
Submodule components/zh_encoder added at b4c8220284
1
components/zh_ota_server
Submodule
1
components/zh_ota_server
Submodule
Submodule components/zh_ota_server added at c61e1eec45
1
components/zh_pcf8574
Submodule
1
components/zh_pcf8574
Submodule
Submodule components/zh_pcf8574 added at 1a8f4711e8
1
components/zh_vector
Submodule
1
components/zh_vector
Submodule
Submodule components/zh_vector added at b487617d3a
BIN
doc/ATE0003 Руководство по эксплуатации.docx
Normal file
BIN
doc/ATE0003 Руководство по эксплуатации.docx
Normal file
Binary file not shown.
BIN
doc/Счет-договор № 15803420 от 01.09.2025.pdf
Normal file
BIN
doc/Счет-договор № 15803420 от 01.09.2025.pdf
Normal file
Binary file not shown.
BIN
doc/Счет-договор № 16037717 от 14.10.2025.pdf
Normal file
BIN
doc/Счет-договор № 16037717 от 14.10.2025.pdf
Normal file
Binary file not shown.
BIN
doc/Счет-договор № 19875 от 23.10.2025.pdf
Normal file
BIN
doc/Счет-договор № 19875 от 23.10.2025.pdf
Normal file
Binary file not shown.
1
main/CMakeLists.txt
Normal file
1
main/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
idf_component_register(SRCS "ate0003.c" INCLUDE_DIRS "" REQUIRES zh_160x_i2c zh_ac_dimmer zh_encoder esp_wifi nvs_flash zh_ota_server)
|
||||
440
main/ate0003.c
Normal file
440
main/ate0003.c
Normal file
@@ -0,0 +1,440 @@
|
||||
#include "ate0003.h"
|
||||
|
||||
static i2c_master_bus_handle_t _i2c_bus_handle = NULL;
|
||||
static httpd_handle_t _webserver_handle = NULL;
|
||||
|
||||
static zh_pcf8574_handle_t _button_handle = {0};
|
||||
static zh_pcf8574_handle_t _led_1_handle = {0};
|
||||
static zh_pcf8574_handle_t _led_2_handle = {0};
|
||||
static zh_pcf8574_handle_t _relay_handle = {0};
|
||||
static zh_pcf8574_handle_t _lcd_handle = {0};
|
||||
|
||||
static zh_encoder_handle_t _power_encoder_handle = {0};
|
||||
static zh_encoder_handle_t _component_encoder_handle = {0};
|
||||
|
||||
volatile static bool _is_work = false;
|
||||
volatile static bool _is_dmm_enabled = false;
|
||||
volatile static bool _is_fix_enabled = false;
|
||||
volatile static uint8_t _permitted_channels = 0;
|
||||
volatile static uint8_t _used_channels = 0;
|
||||
volatile static uint8_t _current_component = 0;
|
||||
|
||||
volatile static bool _is_num_1_fixed = false;
|
||||
volatile static bool _is_num_2_fixed = false;
|
||||
volatile static bool _is_num_3_fixed = false;
|
||||
volatile static bool _is_num_4_fixed = false;
|
||||
|
||||
static void _zh_wifi_softap_init(void);
|
||||
static void _zh_webserver_init(void);
|
||||
static void _zh_encoder_init(void);
|
||||
static void _zh_ac_dimmer_init(void);
|
||||
static void _zh_pcf8574_init(void);
|
||||
static void _zh_system_load(void);
|
||||
static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
static void _zh_encoder_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
|
||||
static void _zh_component_select(uint8_t component);
|
||||
static void _zh_relay_on(uint8_t relay_number);
|
||||
static void _zh_relay_off(uint8_t relay_number);
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
nvs_flash_init();
|
||||
esp_event_loop_create_default();
|
||||
_zh_wifi_softap_init();
|
||||
_zh_webserver_init();
|
||||
_zh_pcf8574_init();
|
||||
_zh_system_load();
|
||||
_zh_encoder_init();
|
||||
_zh_ac_dimmer_init();
|
||||
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_component_select(0);
|
||||
}
|
||||
|
||||
static void _zh_wifi_softap_init(void)
|
||||
{
|
||||
esp_netif_init();
|
||||
esp_netif_create_default_wifi_ap();
|
||||
wifi_init_config_t wifi_config = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_wifi_init(&wifi_config);
|
||||
wifi_config_t ap_config = {
|
||||
.ap = {
|
||||
.ssid = WIFI_SSID,
|
||||
.password = WIFI_PASS,
|
||||
.max_connection = 4,
|
||||
.authmode = WIFI_AUTH_WPA2_PSK,
|
||||
},
|
||||
};
|
||||
esp_wifi_set_mode(WIFI_MODE_AP);
|
||||
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
||||
esp_wifi_start();
|
||||
}
|
||||
|
||||
static void _zh_webserver_init(void)
|
||||
{
|
||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||
httpd_start(&_webserver_handle, &config);
|
||||
zh_ota_server_init(_webserver_handle);
|
||||
}
|
||||
|
||||
static void _zh_encoder_init(void)
|
||||
{
|
||||
esp_event_handler_instance_register(ZH_ENCODER, ESP_EVENT_ANY_ID, &_zh_encoder_event_handler, NULL, NULL);
|
||||
zh_encoder_init_config_t config = ZH_ENCODER_INIT_CONFIG_DEFAULT();
|
||||
config.a_gpio_number = GPIO_NUM_27;
|
||||
config.b_gpio_number = GPIO_NUM_26;
|
||||
config.encoder_min_value = 0;
|
||||
config.encoder_max_value = 100;
|
||||
config.encoder_step = 1;
|
||||
config.encoder_number = POWER_ENCODER;
|
||||
zh_encoder_init(&config, &_power_encoder_handle);
|
||||
zh_encoder_set(&_power_encoder_handle, 100);
|
||||
config.a_gpio_number = GPIO_NUM_18;
|
||||
config.b_gpio_number = GPIO_NUM_19;
|
||||
config.encoder_min_value = 0;
|
||||
config.encoder_max_value = (sizeof(_component) / sizeof(_component[0])) - 1;
|
||||
config.encoder_step = 1;
|
||||
config.encoder_number = COMPONENT_ENCODER;
|
||||
zh_encoder_init(&config, &_component_encoder_handle);
|
||||
zh_encoder_set(&_component_encoder_handle, 0);
|
||||
}
|
||||
|
||||
static void _zh_ac_dimmer_init(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_4;
|
||||
zh_ac_dimmer_init(&config);
|
||||
zh_ac_dimmer_set(100);
|
||||
}
|
||||
|
||||
static void _zh_pcf8574_init(void)
|
||||
{
|
||||
i2c_master_bus_config_t i2c_bus_config = {
|
||||
.clk_source = I2C_CLK_SRC_DEFAULT,
|
||||
.scl_io_num = GPIO_NUM_22,
|
||||
.sda_io_num = GPIO_NUM_21,
|
||||
.glitch_ignore_cnt = 7,
|
||||
};
|
||||
i2c_new_master_bus(&i2c_bus_config, &_i2c_bus_handle);
|
||||
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.i2c_address = LED_1_I2C_ADDRESS;
|
||||
zh_pcf8574_init(&config, &_led_1_handle);
|
||||
config.i2c_address = LED_2_I2C_ADDRESS;
|
||||
zh_pcf8574_init(&config, &_led_2_handle);
|
||||
config.i2c_address = RELAY_I2C_ADDRESS;
|
||||
zh_pcf8574_init(&config, &_relay_handle);
|
||||
config.i2c_address = LCD_I2C_ADDRESS;
|
||||
zh_pcf8574_init(&config, &_lcd_handle);
|
||||
zh_160x_init(&_lcd_handle, ZH_LCD_16X4);
|
||||
config.p0_gpio_work_mode = true;
|
||||
config.p1_gpio_work_mode = true;
|
||||
config.p2_gpio_work_mode = true;
|
||||
config.p3_gpio_work_mode = true;
|
||||
config.p4_gpio_work_mode = true;
|
||||
config.p5_gpio_work_mode = true;
|
||||
config.interrupt_gpio = GPIO_NUM_17;
|
||||
config.i2c_address = BUTTON_I2C_ADDRESS;
|
||||
zh_pcf8574_init(&config, &_button_handle);
|
||||
}
|
||||
|
||||
static void _zh_system_load(void)
|
||||
{
|
||||
zh_160x_set_cursor(&_lcd_handle, 0, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "LLC AEROTECH");
|
||||
zh_160x_set_cursor(&_lcd_handle, 1, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "ATE0003");
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "Firmware v1.0.0");
|
||||
for (uint8_t i = 0; i <= 100; i += 10)
|
||||
{
|
||||
zh_160x_print_progress_bar(&_lcd_handle, 3, i);
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
}
|
||||
zh_160x_lcd_clear(&_lcd_handle);
|
||||
zh_160x_set_cursor(&_lcd_handle, 0, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "P/N:");
|
||||
zh_160x_set_cursor(&_lcd_handle, 1, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "P:100%");
|
||||
zh_160x_set_cursor(&_lcd_handle, 1, 8);
|
||||
zh_160x_print_char(&_lcd_handle, "C:");
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "1: 2: ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 3, 0);
|
||||
zh_160x_print_char(&_lcd_handle, "3: 4: ");
|
||||
}
|
||||
|
||||
static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
||||
{
|
||||
zh_pcf8574_event_on_isr_t *event = event_data;
|
||||
switch (event->gpio_number)
|
||||
{
|
||||
case DMM_BUTTON:
|
||||
if (event->gpio_level == LOW && _is_work == false)
|
||||
{
|
||||
if (_is_dmm_enabled == true)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_RED, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_GREEN, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, DMM_RELAY, RELAY_ON);
|
||||
_is_dmm_enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_RED, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, DMM_LED_GREEN, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, DMM_RELAY, RELAY_OFF);
|
||||
_is_dmm_enabled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FIX_BUTTON:
|
||||
if (event->gpio_level == LOW)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_BLUE, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_GREEN, LED_ON);
|
||||
_is_fix_enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, FIX_LED_GREEN, LED_OFF);
|
||||
_is_fix_enabled = false;
|
||||
}
|
||||
break;
|
||||
case NUM_1_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_1) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (event->gpio_level == LOW)
|
||||
{
|
||||
if (_is_num_1_fixed == true)
|
||||
{
|
||||
break;
|
||||
}
|
||||
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(L_1_RELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_is_fix_enabled == true)
|
||||
{
|
||||
_is_num_1_fixed = true;
|
||||
break;
|
||||
}
|
||||
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(L_1_RELAY);
|
||||
_is_num_1_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM_2_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_2) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (event->gpio_level == LOW)
|
||||
{
|
||||
if (_is_num_2_fixed == true)
|
||||
{
|
||||
break;
|
||||
}
|
||||
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(L_2_RELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_is_fix_enabled == true)
|
||||
{
|
||||
_is_num_2_fixed = true;
|
||||
break;
|
||||
}
|
||||
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(L_2_RELAY);
|
||||
_is_num_2_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM_3_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_3) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (event->gpio_level == LOW)
|
||||
{
|
||||
if (_is_num_3_fixed == true)
|
||||
{
|
||||
break;
|
||||
}
|
||||
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(L_3_RELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_is_fix_enabled == true)
|
||||
{
|
||||
_is_num_3_fixed = true;
|
||||
break;
|
||||
}
|
||||
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(L_3_RELAY);
|
||||
_is_num_3_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM_4_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_4) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (event->gpio_level == LOW)
|
||||
{
|
||||
if (_is_num_4_fixed == true)
|
||||
{
|
||||
break;
|
||||
}
|
||||
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(L_4_RELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_is_fix_enabled == true)
|
||||
{
|
||||
_is_num_4_fixed = true;
|
||||
break;
|
||||
}
|
||||
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(L_4_RELAY);
|
||||
_is_num_4_fixed = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _zh_encoder_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
||||
{
|
||||
zh_encoder_event_on_isr_t *event = event_data;
|
||||
switch (event->encoder_number)
|
||||
{
|
||||
case POWER_ENCODER:
|
||||
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((uint8_t)event->encoder_position);
|
||||
break;
|
||||
case COMPONENT_ENCODER:
|
||||
if (_is_work == true)
|
||||
{
|
||||
zh_encoder_set(&_component_encoder_handle, _current_component);
|
||||
break;
|
||||
}
|
||||
if ((uint8_t)event->encoder_position == 0)
|
||||
{
|
||||
zh_encoder_set(&_component_encoder_handle, 1);
|
||||
break;
|
||||
}
|
||||
_zh_component_select((uint8_t)event->encoder_position);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _zh_component_select(uint8_t component)
|
||||
{
|
||||
_current_component = component;
|
||||
_component_t temp = _component[component];
|
||||
_permitted_channels = temp._used_channel;
|
||||
zh_160x_set_cursor(&_lcd_handle, 0, 4);
|
||||
zh_160x_print_char(&_lcd_handle, " ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 0, 4);
|
||||
zh_160x_print_char(&_lcd_handle, temp._pn);
|
||||
zh_160x_set_cursor(&_lcd_handle, 1, 10);
|
||||
zh_160x_print_char(&_lcd_handle, temp._doc);
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 2);
|
||||
zh_160x_print_char(&_lcd_handle, " ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 2);
|
||||
zh_160x_print_char(&_lcd_handle, temp._channel_1);
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 10);
|
||||
zh_160x_print_char(&_lcd_handle, " ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 2, 10);
|
||||
zh_160x_print_char(&_lcd_handle, temp._channel_2);
|
||||
zh_160x_set_cursor(&_lcd_handle, 3, 2);
|
||||
zh_160x_print_char(&_lcd_handle, " ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 3, 2);
|
||||
zh_160x_print_char(&_lcd_handle, temp._channel_3);
|
||||
zh_160x_set_cursor(&_lcd_handle, 3, 10);
|
||||
zh_160x_print_char(&_lcd_handle, " ");
|
||||
zh_160x_set_cursor(&_lcd_handle, 3, 10);
|
||||
zh_160x_print_char(&_lcd_handle, temp._channel_4);
|
||||
zh_pcf8574_write(&_led_1_handle, _is_dmm_enabled == true ? 0x06 : 0x05);
|
||||
zh_pcf8574_write(&_led_2_handle, 0x00);
|
||||
if ((_permitted_channels & CHANNEL_1) == CHANNEL_1)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL_2) == CHANNEL_2)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL_3) == CHANNEL_3)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL_4) == CHANNEL_4)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_BLUE, LED_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void _zh_relay_on(uint8_t relay_number)
|
||||
{
|
||||
if (++_used_channels > 1)
|
||||
{
|
||||
zh_ac_dimmer_stop();
|
||||
vTaskDelay(5);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, relay_number, RELAY_ON);
|
||||
vTaskDelay(20);
|
||||
zh_ac_dimmer_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_is_work = true;
|
||||
zh_pcf8574_write_gpio(&_relay_handle, relay_number, RELAY_ON);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, GROUND_RELAY, RELAY_ON);
|
||||
vTaskDelay(20);
|
||||
zh_ac_dimmer_start();
|
||||
}
|
||||
}
|
||||
|
||||
static void _zh_relay_off(uint8_t relay_number)
|
||||
{
|
||||
if (--_used_channels > 0)
|
||||
{
|
||||
zh_ac_dimmer_stop();
|
||||
vTaskDelay(5);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, relay_number, RELAY_OFF);
|
||||
vTaskDelay(20);
|
||||
zh_ac_dimmer_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
zh_ac_dimmer_stop();
|
||||
vTaskDelay(5);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, relay_number, RELAY_OFF);
|
||||
zh_pcf8574_write_gpio(&_relay_handle, GROUND_RELAY, RELAY_OFF);
|
||||
_is_work = false;
|
||||
}
|
||||
}
|
||||
102
main/ate0003.h
Normal file
102
main/ate0003.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @file ate0003.h
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "zh_160x_i2c.h"
|
||||
#include "zh_ac_dimmer.h"
|
||||
#include "zh_encoder.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "zh_ota_server.h"
|
||||
|
||||
#define HIGH true
|
||||
#define LOW false
|
||||
|
||||
#define LED_OFF LOW
|
||||
#define LED_ON HIGH
|
||||
|
||||
#define RELAY_OFF LOW
|
||||
#define RELAY_ON HIGH
|
||||
|
||||
#define WIFI_SSID "ATE0003"
|
||||
#define WIFI_PASS "repairlab"
|
||||
#define WIFI_CHANNEL 1
|
||||
#define MAX_STA_CONNECTION 4
|
||||
|
||||
#define LCD_I2C_ADDRESS 0x20 /*!< U4. */
|
||||
#define BUTTON_I2C_ADDRESS 0x24 /*!< U5. */
|
||||
#define LED_1_I2C_ADDRESS 0x22 /*!< U6. */
|
||||
#define LED_2_I2C_ADDRESS 0x21 /*!< U7. */
|
||||
#define RELAY_I2C_ADDRESS 0x23 /*!< U8. */
|
||||
|
||||
#define GROUND_RELAY 0x00 /*!< Relay K1. RL1 pin on U8. */
|
||||
#define DMM_RELAY 0x01 /*!< Relay K2. RL2 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. */
|
||||
#define COMPONENT_ENCODER 0x02 /*!< Connector EN1. */
|
||||
|
||||
#define DMM_BUTTON 0x00 /*!< Connector BT1. BT1-0 on U5. */
|
||||
#define FIX_BUTTON 0x01 /*!< Connector BT2. BT2-1 on U5. */
|
||||
#define NUM_1_BUTTON 0x02 /*!< Connector BT3. BT3-2 on U5. */
|
||||
#define NUM_2_BUTTON 0x03 /*!< Connector BT4. BT4-3 on U5. */
|
||||
#define NUM_3_BUTTON 0x04 /*!< Connector BT5. BT5-4 on U5. */
|
||||
#define NUM_4_BUTTON 0x05 /*!< Connector BT6. BT6-5 on U5. */
|
||||
|
||||
#define DMM_LED_RED 0x00 /*!< Connector LE1. 2 PIN. L1-0 pin on U6. */
|
||||
#define DMM_LED_GREEN 0x01 /*!< Connector LE1. 1 PIN. L1-1 pin on U6. */
|
||||
#define FIX_LED_BLUE 0x02 /*!< Connector LE2. 2 PIN. L2-2 pin on U6. */
|
||||
#define FIX_LED_GREEN 0x03 /*!< Connector LE2. 1 PIN. L2-3 pin on U6. */
|
||||
#define NUM_1_LED_BLUE 0x04 /*!< Connector LE3. 2 PIN. L3-4 pin on U6. */
|
||||
#define NUM_1_LED_GREEN 0x05 /*!< Connector LE3. 1 PIN. L3-5 pin on U6. */
|
||||
#define NUM_2_LED_BLUE 0x06 /*!< Connector LE4. 2 PIN. L4-6 pin on U6. */
|
||||
#define NUM_2_LED_GREEN 0x07 /*!< Connector LE4. 1 PIN. L4-7 pin on U6. */
|
||||
#define NUM_3_LED_BLUE 0x00 /*!< Connector LE5. 2 PIN. L5-0 pin on U7. */
|
||||
#define NUM_3_LED_GREEN 0x01 /*!< Connector LE5. 1 PIN. L5-1 pin on U7. */
|
||||
#define NUM_4_LED_BLUE 0x02 /*!< Connector LE6. 2 PIN. L6-2 pin on U7. */
|
||||
#define NUM_4_LED_GREEN 0x03 /*!< Connector LE6. 1 PIN. L6-3 pin on U7. */
|
||||
|
||||
#define CHANNEL_1 0x08
|
||||
#define CHANNEL_2 0x04
|
||||
#define CHANNEL_3 0x02
|
||||
#define CHANNEL_4 0x01
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *_pn;
|
||||
char *_doc;
|
||||
char *_channel_1;
|
||||
char *_channel_2;
|
||||
char *_channel_3;
|
||||
char *_channel_4;
|
||||
uint8_t _used_channel;
|
||||
|
||||
} _component_t;
|
||||
|
||||
const _component_t _component[] =
|
||||
{
|
||||
{"SELECT P/N", "N/A", "N/A", "N/A", "N/A", "N/A", 0x00},
|
||||
{"30-2581-3", "334230", "LOGO", "N/A", "N/A", "N/A", 0x08},
|
||||
{"4298117", "334612", "400W", "600W", "N/A", "N/A", 0x0C},
|
||||
{"4236534", "334303", "RUNW", "N/A", "N/A", "N/A", 0x08},
|
||||
{"8000306Y00", "334303", "RUNW", "N/A", "N/A", "N/A", 0x08},
|
||||
{"8000281Y00", "334303", "RUNW", "N/A", "N/A", "N/A", 0x08},
|
||||
{"4292491", "334711", "LOGO", "N/A", "N/A", "N/A", 0x08},
|
||||
{"4328733", "334711", "LOGO", "N/A", "N/A", "N/A", 0x08},
|
||||
{"4358532", "334711", "LOGO", "N/A", "N/A", "N/A", 0x08},
|
||||
{"ANY", "ANY ", "RED", "GRN", "ORG", "WHT", 0x0F}};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
BIN
pcb/BOM_ATE0003.000.001_v.3.xlsx
Normal file
BIN
pcb/BOM_ATE0003.000.001_v.3.xlsx
Normal file
Binary file not shown.
BIN
pcb/Gerber_ATE0003.000.001_v.3.zip
Normal file
BIN
pcb/Gerber_ATE0003.000.001_v.3.zip
Normal file
Binary file not shown.
BIN
pcb/PCB.jpeg
Normal file
BIN
pcb/PCB.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
46102
pcb/SCH_ATE0003.000.001_v.3.pdf
Normal file
46102
pcb/SCH_ATE0003.000.001_v.3.pdf
Normal file
File diff suppressed because it is too large
Load Diff
1
version.txt
Normal file
1
version.txt
Normal file
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
Reference in New Issue
Block a user