update icons order
This commit is contained in:
parent
0e6ef77af6
commit
f0e1dea7ac
|
@ -19,8 +19,7 @@ NexButton fan_auto_btn = NexButton(1, 11, "fan_auto_btn");
|
||||||
NexButton fan_1_btn = NexButton(1, 12, "fan_1_btn");
|
NexButton fan_1_btn = NexButton(1, 12, "fan_1_btn");
|
||||||
NexButton fan_2_btn = NexButton(1, 13, "fan_2_btn");
|
NexButton fan_2_btn = NexButton(1, 13, "fan_2_btn");
|
||||||
NexButton fan_3_btn = NexButton(1, 14, "fan_3_btn");
|
NexButton fan_3_btn = NexButton(1, 14, "fan_3_btn");
|
||||||
NexText temperature_txt = NexText(1, 15, "temperature");
|
NexText temp_txt = NexText(1, 15, "temp_txt");
|
||||||
NexPage dashboard_page = NexPage(1, 0, "dashboard");
|
|
||||||
|
|
||||||
// List of Component ID Message to listen to
|
// List of Component ID Message to listen to
|
||||||
NexTouch *nex_listen_list[] =
|
NexTouch *nex_listen_list[] =
|
||||||
|
@ -70,15 +69,15 @@ void user_init()
|
||||||
lt_bt.attachPop(lt_btn_cb, <_bt);
|
lt_bt.attachPop(lt_btn_cb, <_bt);
|
||||||
fan_bt.attachPop(fan_btn_cb, &fan_bt);
|
fan_bt.attachPop(fan_btn_cb, &fan_bt);
|
||||||
puri_bt.attachPop(puri_btn_cb, &puri_bt);
|
puri_bt.attachPop(puri_btn_cb, &puri_bt);
|
||||||
up_bt.attachPop(ac_temp_adj_btn_cb, &up_bt);
|
up_bt.attachPop(temp_up_btn_cb, &up_bt);
|
||||||
down_bt.attachPop(ac_temp_adj_btn_cb, &down_bt);
|
down_bt.attachPop(temp_down_btn_cb, &down_bt);
|
||||||
mode_off_btn.attachPop(ac_mode_adj_btn_cb, &mode_off_btn);
|
mode_off_btn.attachPop(mode_off_btn_cb, &mode_off_btn);
|
||||||
mode_fan_btn.attachPop(ac_mode_adj_btn_cb, &mode_fan_btn);
|
mode_fan_btn.attachPop(mode_fan_btn_cb, &mode_fan_btn);
|
||||||
mode_cool_btn.attachPop(ac_mode_adj_btn_cb, &mode_cool_btn);
|
mode_cool_btn.attachPop(mode_cool_btn_cb, &mode_cool_btn);
|
||||||
fan_auto_btn.attachPop(ac_fan_adj_btn_cb, &fan_auto_btn);
|
fan_auto_btn.attachPop(fan_auto_btn_cb, &fan_auto_btn);
|
||||||
fan_1_btn.attachPop(ac_fan_adj_btn_cb, &fan_1_btn);
|
fan_1_btn.attachPop(fan_1_btn_cb, &fan_1_btn);
|
||||||
fan_2_btn.attachPop(ac_fan_adj_btn_cb, &fan_2_btn);
|
fan_2_btn.attachPop(fan_2_btn_cb, &fan_2_btn);
|
||||||
fan_3_btn.attachPop(ac_fan_adj_btn_cb, &fan_3_btn);
|
fan_3_btn.attachPop(fan_3_btn_cb, &fan_3_btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -94,7 +93,8 @@ This code will run when an input pin changed state
|
||||||
*/
|
*/
|
||||||
void virtual_interrupt_user_callback(int pin, int state)
|
void virtual_interrupt_user_callback(int pin, int state)
|
||||||
{
|
{
|
||||||
if (pin>=0&pin<=7){
|
if (pin >= 0 & pin <= 7)
|
||||||
|
{
|
||||||
pwm_toggle(pin);
|
pwm_toggle(pin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,43 +138,66 @@ void puri_btn_cb(void *comp)
|
||||||
{
|
{
|
||||||
pwm_toggle(AIR_PURIFIER_PIN);
|
pwm_toggle(AIR_PURIFIER_PIN);
|
||||||
}
|
}
|
||||||
void ac_temp_adj_btn_cb(void *comp)
|
void temp_up_btn_cb(void *comp)
|
||||||
{
|
{
|
||||||
if (!ac_lock)
|
if (!ac_lock)
|
||||||
{
|
{
|
||||||
uint8_t new_temp = ac_get_temperature();
|
uint8_t new_temp = ac_get_temperature();
|
||||||
if (comp == &up_bt)
|
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature() + 1, ac_get_fan_speed());
|
ac_set_state(ac_get_mode(), ac_get_temperature() + 1, ac_get_fan_speed());
|
||||||
else if (comp == &down_bt)
|
}
|
||||||
|
}
|
||||||
|
void temp_down_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
{
|
||||||
|
uint8_t new_temp = ac_get_temperature();
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature() - 1, ac_get_fan_speed());
|
ac_set_state(ac_get_mode(), ac_get_temperature() - 1, ac_get_fan_speed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ac_mode_adj_btn_cb(void *comp)
|
void mode_cool_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
ac_set_state(1, ac_get_temperature(), ac_get_fan_speed());
|
||||||
|
}
|
||||||
|
void mode_fan_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
ac_set_state(2, ac_get_temperature(), ac_get_fan_speed());
|
||||||
|
}
|
||||||
|
void mode_off_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
ac_set_state(0, ac_get_temperature(), ac_get_fan_speed());
|
||||||
|
}
|
||||||
|
|
||||||
|
void fan_auto_btn_cb(void *comp)
|
||||||
{
|
{
|
||||||
if (!ac_lock)
|
if (!ac_lock)
|
||||||
{
|
{
|
||||||
if (comp == &mode_off_btn)
|
ac_set_state(ac_get_mode(), ac_get_temperature(), 0);
|
||||||
ac_set_state(0, ac_get_temperature(), ac_get_fan_speed());
|
|
||||||
else if (comp == &mode_fan_btn)
|
|
||||||
ac_set_state(1, ac_get_temperature(), ac_get_fan_speed());
|
|
||||||
else if (comp == &mode_cool_btn)
|
|
||||||
ac_set_state(2, ac_get_temperature(), ac_get_fan_speed());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ac_fan_adj_btn_cb(void *comp)
|
void fan_1_btn_cb(void *comp)
|
||||||
{
|
{
|
||||||
if (!ac_lock)
|
if (!ac_lock)
|
||||||
{
|
{
|
||||||
if (comp == &fan_auto_btn)
|
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature(), 0);
|
|
||||||
else if (comp == &fan_1_btn)
|
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature(), 1);
|
|
||||||
else if (comp == &fan_2_btn)
|
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature(), 2);
|
|
||||||
else if (comp == &fan_3_btn)
|
|
||||||
ac_set_state(ac_get_mode(), ac_get_temperature(), 3);
|
ac_set_state(ac_get_mode(), ac_get_temperature(), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void fan_2_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
{
|
||||||
|
ac_set_state(ac_get_mode(), ac_get_temperature(), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void fan_3_btn_cb(void *comp)
|
||||||
|
{
|
||||||
|
if (!ac_lock)
|
||||||
|
{
|
||||||
|
ac_set_state(ac_get_mode(), ac_get_temperature(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cud_light_toggle()
|
void cud_light_toggle()
|
||||||
{
|
{
|
||||||
|
@ -202,15 +225,16 @@ bool cud_fan_group_state()
|
||||||
|
|
||||||
void ac_changed_user_callback(int mode, int temperature, int fan_speed)
|
void ac_changed_user_callback(int mode, int temperature, int fan_speed)
|
||||||
{
|
{
|
||||||
char temp_text[3] = {(temperature - temperature % 10) + '0', (temperature % 10) + '0', 'C'};
|
char temp_text[3];
|
||||||
temperature_txt.setText(temp_text);
|
sprintf(temp_text, "%dC", temperature);
|
||||||
mode_off_btn.Set_background_image_pic(mode == 0 ? 1 : 0);
|
temp_txt.setText(temp_text);
|
||||||
mode_fan_btn.Set_background_image_pic(mode == 1 ? 1 : 0);
|
mode_off_btn.Set_background_image_pic(mode == 0 ? 14 : 13);
|
||||||
mode_cool_btn.Set_background_image_pic(mode == 2 ? 1 : 0);
|
mode_fan_btn.Set_background_image_pic(mode == 2 ? 16 : 15);
|
||||||
fan_auto_btn.Set_background_image_pic(fan_speed == 0 ? 1 : 0);
|
mode_cool_btn.Set_background_image_pic(mode == 1 ? 18 : 17);
|
||||||
fan_1_btn.Set_background_image_pic(fan_speed == 1 ? 1 : 0);
|
fan_auto_btn.Set_background_image_pic(fan_speed == 0 ? 20 : 19);
|
||||||
fan_2_btn.Set_background_image_pic(fan_speed == 2 ? 1 : 0);
|
fan_1_btn.Set_background_image_pic(fan_speed == 3 ? 22 : 21);
|
||||||
fan_3_btn.Set_background_image_pic(fan_speed == 3 ? 1 : 0);
|
fan_2_btn.Set_background_image_pic(fan_speed == 2 ? 24 : 23);
|
||||||
|
fan_3_btn.Set_background_image_pic(fan_speed == 1 ? 26 : 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ac_lock_callback(String topic, String payload)
|
void ac_lock_callback(String topic, String payload)
|
||||||
|
|
|
@ -52,9 +52,15 @@ void timer_tick_callback();
|
||||||
void lt_btn_cb(void *comp);
|
void lt_btn_cb(void *comp);
|
||||||
void fan_btn_cb(void *comp);
|
void fan_btn_cb(void *comp);
|
||||||
void puri_btn_cb(void *comp);
|
void puri_btn_cb(void *comp);
|
||||||
void ac_temp_adj_btn_cb(void *comp);
|
void temp_up_btn_cb(void *comp);
|
||||||
void ac_mode_adj_btn_cb(void *comp);
|
void temp_down_btn_cb(void *comp);
|
||||||
void ac_fan_adj_btn_cb(void *comp);
|
void mode_off_btn_cb(void *comp);
|
||||||
|
void mode_fan_btn_cb(void *comp);
|
||||||
|
void mode_cool_btn_cb(void *comp);
|
||||||
|
void fan_auto_btn_cb(void *comp);
|
||||||
|
void fan_1_btn_cb(void *comp);
|
||||||
|
void fan_2_btn_cb(void *comp);
|
||||||
|
void fan_3_btn_cb(void *comp);
|
||||||
void cud_light_toggle();
|
void cud_light_toggle();
|
||||||
bool cud_light_group_state();
|
bool cud_light_group_state();
|
||||||
void cud_fan_toggle();
|
void cud_fan_toggle();
|
||||||
|
|
Loading…
Reference in New Issue