make light control UI change more efficient
This commit is contained in:
parent
040fcef814
commit
c014b72532
|
@ -228,53 +228,97 @@ void virtual_interrupt_user_callback(int pin, int state)
|
||||||
|
|
||||||
void update_lcd_row1() {
|
void update_lcd_row1() {
|
||||||
bool master_state = row_is_on(ROW1_LIGHT1,ROW1_LIGHT2);
|
bool master_state = row_is_on(ROW1_LIGHT1,ROW1_LIGHT2);
|
||||||
row1_master.Set_background_image_pic(master_state?9:10);
|
//row1_master.Set_background_image_pic(master_state?9:10);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row1_master.pic=");
|
||||||
|
elcd.print(master_state?9:10);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
|
||||||
|
|
||||||
bool lt1_state = pwm_get_state(ROW1_LIGHT1);
|
bool lt1_state = pwm_get_state(ROW1_LIGHT1);
|
||||||
bool lt2_state = pwm_get_state(ROW1_LIGHT2);
|
bool lt2_state = pwm_get_state(ROW1_LIGHT2);
|
||||||
//also update the light1 and light2 buttons background to reflect the current state
|
//also update the light1 and light2 buttons background to reflect the current state
|
||||||
row1_lv1.Set_background_image_pic(lt1_state?5:6);
|
//row1_lv1.Set_background_image_pic(lt1_state?5:6);
|
||||||
row1_lv2.Set_background_image_pic(lt2_state?7:8);
|
//row1_lv2.Set_background_image_pic(lt2_state?7:8);
|
||||||
|
elcd.print("row1_lv1.pic=");
|
||||||
|
elcd.print(lt1_state?5:6);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row1_lv2.pic=");
|
||||||
|
elcd.print(lt2_state?7:8);
|
||||||
|
elcd_send_stop_bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_lcd_row2() {
|
void update_lcd_row2() {
|
||||||
bool master_state = row_is_on(ROW2_LIGHT1,ROW2_LIGHT2);
|
bool master_state = row_is_on(ROW2_LIGHT1,ROW2_LIGHT2);
|
||||||
row2_master.Set_background_image_pic(master_state?11:12);
|
//row2_master.Set_background_image_pic(master_state?11:12);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row2_master.pic=");
|
||||||
|
elcd.print(master_state?11:12);
|
||||||
|
elcd_send_stop_bit();
|
||||||
bool lt1_state = pwm_get_state(ROW2_LIGHT1);
|
bool lt1_state = pwm_get_state(ROW2_LIGHT1);
|
||||||
bool lt2_state = pwm_get_state(ROW2_LIGHT2);
|
bool lt2_state = pwm_get_state(ROW2_LIGHT2);
|
||||||
//also update the light1 and light2 buttons background to reflect the current state
|
//also update the light1 and light2 buttons background to reflect the current state
|
||||||
row2_lv1.Set_background_image_pic(lt1_state?5:6);
|
//row2_lv1.Set_background_image_pic(lt1_state?5:6);
|
||||||
row2_lv2.Set_background_image_pic(lt2_state?7:8);
|
//row2_lv2.Set_background_image_pic(lt2_state?7:8);
|
||||||
|
elcd.print("row1_lv1.pic=");
|
||||||
|
elcd.print(lt1_state?5:6);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row1_lv2.pic=");
|
||||||
|
elcd.print(lt2_state?7:8);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_lcd_row3() {
|
void update_lcd_row3() {
|
||||||
bool master_state = row_is_on(ROW3_LIGHT1,ROW3_LIGHT2);
|
bool master_state = row_is_on(ROW3_LIGHT1,ROW3_LIGHT2);
|
||||||
row3_master.Set_background_image_pic(master_state?13:14);
|
//row3_master.Set_background_image_pic(master_state?13:14);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row3_master.pic=");
|
||||||
|
elcd.print(master_state?13:14);
|
||||||
|
elcd_send_stop_bit();
|
||||||
bool lt1_state = pwm_get_state(ROW3_LIGHT1);
|
bool lt1_state = pwm_get_state(ROW3_LIGHT1);
|
||||||
bool lt2_state = pwm_get_state(ROW3_LIGHT2);
|
bool lt2_state = pwm_get_state(ROW3_LIGHT2);
|
||||||
//also update the light1 and light2 buttons background to reflect the current state
|
//also update the light1 and light2 buttons background to reflect the current state
|
||||||
row3_lv1.Set_background_image_pic(lt1_state?5:6);
|
//row3_lv1.Set_background_image_pic(lt1_state?5:6);
|
||||||
row3_lv2.Set_background_image_pic(lt2_state?7:8);
|
//row3_lv2.Set_background_image_pic(lt2_state?7:8);
|
||||||
|
elcd.print("row3_lv1.pic=");
|
||||||
|
elcd.print(lt1_state?5:6);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row1_lv2.pic=");
|
||||||
|
elcd.print(lt2_state?7:8);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_lcd_row4() {
|
void update_lcd_row4() {
|
||||||
bool master_state = row_is_on(ROW4_LIGHT1,ROW4_LIGHT2);
|
bool master_state = row_is_on(ROW4_LIGHT1,ROW4_LIGHT2);
|
||||||
row4_master.Set_background_image_pic(master_state?15:16);
|
//row4_master.Set_background_image_pic(master_state?15:16);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row4_master.pic=");
|
||||||
|
elcd.print(master_state?15:16);
|
||||||
|
elcd_send_stop_bit();
|
||||||
bool lt1_state = pwm_get_state(ROW4_LIGHT1);
|
bool lt1_state = pwm_get_state(ROW4_LIGHT1);
|
||||||
bool lt2_state = pwm_get_state(ROW4_LIGHT2);
|
bool lt2_state = pwm_get_state(ROW4_LIGHT2);
|
||||||
//also update the light1 and light2 buttons background to reflect the current state
|
//also update the light1 and light2 buttons background to reflect the current state
|
||||||
row4_lv1.Set_background_image_pic(lt1_state?5:6);
|
//row4_lv1.Set_background_image_pic(lt1_state?5:6);
|
||||||
row4_lv2.Set_background_image_pic(lt2_state?7:8);
|
//row4_lv2.Set_background_image_pic(lt2_state?7:8);
|
||||||
|
elcd.print("row4_lv1.pic=");
|
||||||
|
elcd.print(lt1_state?5:6);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("row4_lv2.pic=");
|
||||||
|
elcd.print(lt2_state?7:8);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_toggle_button() {
|
void update_toggle_button() {
|
||||||
//calcuate the current state of the toggle button
|
//calcuate the current state of the toggle button
|
||||||
bool current_state = row_is_on(ROW1_LIGHT1,ROW1_LIGHT2) || row_is_on(ROW2_LIGHT1,ROW2_LIGHT2) || row_is_on(ROW3_LIGHT1,ROW3_LIGHT2) || row_is_on(ROW4_LIGHT1,ROW4_LIGHT2);
|
bool current_state = row_is_on(ROW1_LIGHT1,ROW1_LIGHT2) || row_is_on(ROW2_LIGHT1,ROW2_LIGHT2) || row_is_on(ROW3_LIGHT1,ROW3_LIGHT2) || row_is_on(ROW4_LIGHT1,ROW4_LIGHT2);
|
||||||
light_toggle.Set_background_image_pic(current_state?3:4);
|
//light_toggle.Set_background_image_pic(current_state?3:4);
|
||||||
|
elcd_send_stop_bit();
|
||||||
|
elcd.print("light_toggle.pic=");
|
||||||
|
elcd.print(current_state?3:4);
|
||||||
|
elcd_send_stop_bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_lcd_ac() {
|
void update_lcd_ac() {
|
||||||
|
|
Loading…
Reference in New Issue