wip:
This commit is contained in:
@@ -12,17 +12,17 @@ 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 bool _is_initialized = false;
|
||||
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 bool _is_initialized = false;
|
||||
|
||||
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;
|
||||
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);
|
||||
@@ -44,7 +44,6 @@ void app_main(void)
|
||||
_zh_webserver_init();
|
||||
_zh_encoder_init();
|
||||
_zh_ac_dimmer_init();
|
||||
gpio_set_level(TRIAC_GPIO, LOW);
|
||||
_zh_pcf8574_init();
|
||||
// zh_pcf8574_write_gpio(&led_handle, TS_LED_GREEN, LED_ON);
|
||||
// zh_pcf8574_write_gpio(&led_handle, RET_LED_BLUE, LED_ON);
|
||||
@@ -177,8 +176,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
_is_fix_enabled = false;
|
||||
}
|
||||
break;
|
||||
case NUM1_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL1) == 0)
|
||||
case NUM_1_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_1) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -188,8 +187,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
{
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM1_LED_BLUE, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM1_LED_GREEN, LED_ON);
|
||||
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);
|
||||
}
|
||||
else
|
||||
@@ -199,14 +198,14 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
_is_num_1_fixed = true;
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM1_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM1_LED_GREEN, LED_OFF);
|
||||
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);
|
||||
_is_num_1_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM2_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL2) == 0)
|
||||
case NUM_2_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_2) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -216,8 +215,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
{
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM2_LED_BLUE, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM2_LED_GREEN, LED_ON);
|
||||
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);
|
||||
}
|
||||
else
|
||||
@@ -227,14 +226,14 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
_is_num_2_fixed = true;
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM2_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM2_LED_GREEN, LED_OFF);
|
||||
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);
|
||||
_is_num_2_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM3_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL3) == 0)
|
||||
case NUM_3_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_3) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -244,8 +243,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
{
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM3_LED_BLUE, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM3_LED_GREEN, LED_ON);
|
||||
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);
|
||||
}
|
||||
else
|
||||
@@ -255,14 +254,14 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
_is_num_3_fixed = true;
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM3_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM3_LED_GREEN, LED_OFF);
|
||||
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);
|
||||
_is_num_3_fixed = false;
|
||||
}
|
||||
break;
|
||||
case NUM4_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL4) == 0)
|
||||
case NUM_4_BUTTON:
|
||||
if ((_permitted_channels & CHANNEL_4) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -272,8 +271,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
{
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM4_LED_BLUE, LED_OFF);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM4_LED_GREEN, LED_ON);
|
||||
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);
|
||||
}
|
||||
else
|
||||
@@ -283,8 +282,8 @@ static void _zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, in
|
||||
_is_num_4_fixed = true;
|
||||
break;
|
||||
}
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM4_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM4_LED_GREEN, LED_OFF);
|
||||
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);
|
||||
_is_num_4_fixed = false;
|
||||
}
|
||||
@@ -328,21 +327,21 @@ static void _zh_component_select(uint8_t component)
|
||||
// zh_avr_160x_print_char(&lcd_handle, text_buffer);
|
||||
// zh_avr_pcf8574_write(&led1_handle, is_dmm == true ? 0xF9 : 0xFA);
|
||||
// zh_avr_pcf8574_write(&led2_handle, 0x0F);
|
||||
if ((_permitted_channels & CHANNEL1) == CHANNEL1)
|
||||
if ((_permitted_channels & CHANNEL_1) == CHANNEL_1)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM1_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM_1_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL2) == CHANNEL2)
|
||||
if ((_permitted_channels & CHANNEL_2) == CHANNEL_2)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM2_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_1_handle, NUM_2_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL3) == CHANNEL3)
|
||||
if ((_permitted_channels & CHANNEL_3) == CHANNEL_3)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM3_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM_3_LED_BLUE, LED_ON);
|
||||
}
|
||||
if ((_permitted_channels & CHANNEL4) == CHANNEL4)
|
||||
if ((_permitted_channels & CHANNEL_4) == CHANNEL_4)
|
||||
{
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM4_LED_BLUE, LED_ON);
|
||||
zh_pcf8574_write_gpio(&_led_2_handle, NUM_4_LED_BLUE, LED_ON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#define RELAY_OFF LOW
|
||||
#define RELAY_ON HIGH
|
||||
|
||||
#define TRIAC_GPIO GPIO_NUM_4
|
||||
|
||||
#define WIFI_SSID "ATE0003"
|
||||
#define WIFI_PASS "repairlab"
|
||||
#define WIFI_CHANNEL 1
|
||||
@@ -44,46 +42,30 @@
|
||||
#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 NUM1_BUTTON 0x02 /*!< Connector BT3. BT3-2 on U5. */
|
||||
#define NUM2_BUTTON 0x03 /*!< Connector BT4. BT4-3 on U5. */
|
||||
#define NUM3_BUTTON 0x04 /*!< Connector BT5. BT5-4 on U5. */
|
||||
#define NUM4_BUTTON 0x05 /*!< Connector BT6. BT6-5 on U5. */
|
||||
#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 NUM1_LED_BLUE 0x04 /*!< Connector LE3. 2 PIN. L3-4 pin on U6. */
|
||||
#define NUM1_LED_GREEN 0x05 /*!< Connector LE3. 1 PIN. L3-5 pin on U6. */
|
||||
#define NUM2_LED_BLUE 0x06 /*!< Connector LE4. 2 PIN. L4-6 pin on U6. */
|
||||
#define NUM2_LED_GREEN 0x07 /*!< Connector LE4. 1 PIN. L4-7 pin on U6. */
|
||||
#define NUM3_LED_BLUE 0x00 /*!< Connector LE5. 2 PIN. L5-0 pin on U7. */
|
||||
#define NUM3_LED_GREEN 0x01 /*!< Connector LE5. 1 PIN. L5-1 pin on U7. */
|
||||
#define NUM4_LED_BLUE 0x02 /*!< Connector LE6. 2 PIN. L6-2 pin on U7. */
|
||||
#define NUM4_LED_GREEN 0x03 /*!< Connector LE6. 1 PIN. L6-3 pin on U7. */
|
||||
#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 CHANNEL1 0x08
|
||||
#define CHANNEL2 0x04
|
||||
#define CHANNEL3 0x02
|
||||
#define CHANNEL4 0x01
|
||||
|
||||
// #define GROUND_RELAY 0x00 /*!< Relay K1. RL1 pin on U5. */
|
||||
// #define TS_RELAY 0x03 /*!< Relay K4. RL4 pin on U5. */
|
||||
// #define RET_RELAY 0x02 /*!< Relay K3. RL3 pin on U5. */
|
||||
// #define EXT_RELAY 0x01 /*!< Relay K2. RL2 pin on U5. */
|
||||
|
||||
// #define TS_BUTTON 0x00 /*!< Connector BT1. B1-0 on U7. */
|
||||
// #define RET_BUTTON 0x01 /*!< Connector BT2. B2-1 on U7. */
|
||||
// #define EXT_BUTTON 0x02 /*!< Connector BT3. B3-2 on U7. */
|
||||
|
||||
// #define TS_LED_RED 0x00 /*!< Connector LE1. 2 PIN. L1-0 pin on U6. */
|
||||
// #define TS_LED_GREEN 0x01 /*!< Connector LE1. 1 PIN. L1-1 pin on U6. */
|
||||
// #define RET_LED_BLUE 0x02 /*!< Connector LE2. 2 PIN. L2-2 pin on U6. */
|
||||
// #define RET_LED_GREEN 0x03 /*!< Connector LE2. 1 PIN. L2-3 pin on U6. */
|
||||
// #define EXT_LED_BLUE 0x04 /*!< Connector LE3. 2 PIN. L3-4 pin on U6. */
|
||||
// #define EXT_LED_GREEN 0x05 /*!< Connector LE3. 1 PIN. L3-5 pin on U6. */
|
||||
#define CHANNEL_1 0x08
|
||||
#define CHANNEL_2 0x04
|
||||
#define CHANNEL_3 0x02
|
||||
#define CHANNEL_4 0x01
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
Reference in New Issue
Block a user