socket contact state display
This commit is contained in:
parent
f0a9c4f1d0
commit
5887862992
|
@ -16,7 +16,8 @@
|
||||||
#define AIR_PURIFIER_PIN 7
|
#define AIR_PURIFIER_PIN 7
|
||||||
// There are one power relay for the mosquito zapper
|
// There are one power relay for the mosquito zapper
|
||||||
#define MOSQUITO_ZAPPER_PIN 8
|
#define MOSQUITO_ZAPPER_PIN 8
|
||||||
|
// There are one power relay for the socket
|
||||||
|
#define SOCKET_CONTACTOR_PIN 9
|
||||||
/***********************************************
|
/***********************************************
|
||||||
* Air Conditioner *
|
* Air Conditioner *
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
|
@ -236,6 +236,13 @@ void CUDDisplay::handle_output_change(uint8_t pin, bool state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if it's the socket contactor
|
||||||
|
if (pin == this->conf->socket_contactor_pin)
|
||||||
|
{
|
||||||
|
this->refresh_display_socket();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through each to check if the pin is a light
|
// Loop through each to check if the pin is a light
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -657,6 +664,7 @@ void CUDDisplay::refresh_display()
|
||||||
}
|
}
|
||||||
refresh_display_ac();
|
refresh_display_ac();
|
||||||
refresh_display_allsystem();
|
refresh_display_allsystem();
|
||||||
|
refresh_display_socket();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUDDisplay::refresh_display_ac()
|
void CUDDisplay::refresh_display_ac()
|
||||||
|
@ -749,6 +757,13 @@ void CUDDisplay::refresh_display_allsystem()
|
||||||
this->giveSerialMutex();
|
this->giveSerialMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CUDDisplay::refresh_display_socket() {
|
||||||
|
this->takeSerialMutex();
|
||||||
|
this->displayAdapter->printf("%s.pic=%d", LCD_DASHBOARD_ELEMENT_NAME_SOCKET_POWER, this->cards.outputCard->getState(this->conf->socket_contactor_pin) ? LCD_DASHBOARD_PIC_SOCKET_POWER_ON: LCD_DASHBOARD_PIC_SOCKET_POWER_OFF);
|
||||||
|
this->sendStopBytes();
|
||||||
|
this->giveSerialMutex();
|
||||||
|
}
|
||||||
|
|
||||||
bool CUDDisplay::get_system_state()
|
bool CUDDisplay::get_system_state()
|
||||||
{
|
{
|
||||||
// The system state is defined to be on when any of the lights, fans, air purifier, mosquito zapper or AC is on
|
// The system state is defined to be on when any of the lights, fans, air purifier, mosquito zapper or AC is on
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct cud_display_conf_t
|
||||||
uint8_t fan_pins[3];
|
uint8_t fan_pins[3];
|
||||||
uint8_t air_purifier_pin;
|
uint8_t air_purifier_pin;
|
||||||
uint8_t mosquito_zapper_pin;
|
uint8_t mosquito_zapper_pin;
|
||||||
|
uint8_t socket_contactor_pin;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cud_display_cards_t
|
struct cud_display_cards_t
|
||||||
|
@ -98,6 +99,7 @@ private:
|
||||||
void refresh_display();
|
void refresh_display();
|
||||||
void refresh_display_ac();
|
void refresh_display_ac();
|
||||||
void refresh_display_allsystem();
|
void refresh_display_allsystem();
|
||||||
|
void refresh_display_socket();
|
||||||
// Helper Functions
|
// Helper Functions
|
||||||
bool get_system_state();
|
bool get_system_state();
|
||||||
void system_toggle();
|
void system_toggle();
|
||||||
|
|
|
@ -28,7 +28,8 @@ cud_display_conf_t cud_display_conf = {
|
||||||
.light_pins = {LIGHT_ROW_1_PIN, LIGHT_ROW_2_PIN, LIGHT_ROW_3_PIN, LIGHT_ROW_4_PIN},
|
.light_pins = {LIGHT_ROW_1_PIN, LIGHT_ROW_2_PIN, LIGHT_ROW_3_PIN, LIGHT_ROW_4_PIN},
|
||||||
.fan_pins = {FAN_ROW_1_PIN, FAN_ROW_2_PIN, FAN_ROW_3_PIN},
|
.fan_pins = {FAN_ROW_1_PIN, FAN_ROW_2_PIN, FAN_ROW_3_PIN},
|
||||||
.air_purifier_pin = AIR_PURIFIER_PIN,
|
.air_purifier_pin = AIR_PURIFIER_PIN,
|
||||||
.mosquito_zapper_pin = MOSQUITO_ZAPPER_PIN};
|
.mosquito_zapper_pin = MOSQUITO_ZAPPER_PIN,
|
||||||
|
.socket_contactor_pin = SOCKET_CONTACTOR_PIN};
|
||||||
|
|
||||||
CUDDisplay cudDisplay = CUDDisplay(&cud_display_conf);
|
CUDDisplay cudDisplay = CUDDisplay(&cud_display_conf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue