it fucking builds!

This commit is contained in:
reaw55 2024-01-31 00:09:40 +07:00
parent f2c0eb6bf1
commit e5ecd5f3a0
5 changed files with 162 additions and 272 deletions

View file

@ -42,22 +42,27 @@
//standby page picture id
#define COMPONENT_BACKGROUND_PIC 44
#define COMPONENT_BACKGROUND_REFERENCE_PIC 45
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF 46
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF_PRESSED 47
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_ON 48
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_ON_PRESSED 49
#define COMPONENT_STANDBY_AC_PIC_OFF 50
#define COMPONENT_STANDBY_AC_PIC_OFF_PRESSED 51
#define COMPONENT_STANDBY_AC_PIC_ON 52
#define COMPONENT_STANDBY_AC_PIC_ON_PRESSED 53
#define COMPONENT_STANDBY_LIGHT_PIC_OFF 54
#define COMPONENT_STANDBY_LIGHT_PIC_OFF_PRESSED 55
#define COMPONENT_STANDBY_LIGHT_PIC_ON 56
#define COMPONENT_STANDBY_LIGHT_PIC_ON_PRESSED 57
#define COMPONENT_STANDBY_PM_PIC_OFF 58
#define COMPONENT_STANDBY_PM_PIC_OFF_PRESSED 59
#define COMPONENT_STANDBY_PM_PIC_ON 60
#define COMPONENT_STANDBY_PM_PIC_ON_PRESSED 61
#define COMPONENT_REFERENCE_BACKGROUND_PIC 62
@ -112,6 +117,7 @@
#define COMPONENT_DASHBOARD_DATE_TXT 38
#define COMPONENT_DASHBOARD_OUTSIDE_TEMP_TXT 39
//dashboard page picture id
#define COMPONENT_DASHBOARD_REFERENCE_BACKGROUND_PIC 0
@ -144,7 +150,7 @@
#define COMPONENT_AC_MODE_FAN_PIC 23
#define COMPONENT_AC_MODE_FAN_PIC_PRESSED 24
//pm; air purifier
#define COMPONENT_PM_TOGGLE_PIC_OFF 25
#define COMPONENT_PM_TOGGLE_PIC_OFF_PRESSED 26
#define COMPONENT_PM_TOGGLE_PIC_ON 27
@ -155,14 +161,17 @@
#define COMPONENT_PM_FAN_SPEED_INCREASE_PIC 31
#define COMPONENT_PM_FAN_SPEED_INCREASE_PIC_PRESSED 32
//AC status indicator
#define COMPONENT_AC_STATUS_OFF 33
#define COMPONENT_AC_STATUS_ON 34
//light master
#define COMPONENT_LIGHT_MASTER_OFF 35
#define COMPONENT_LIGHT_MASTER_OFF_PRESSED 36
#define COMPONENT_LIGHT_MASTER_ON 37
#define COMPONENT_LIGHT_MASTER_ON_PRESSED 38
//light level component
#define COMPONENT_LIGHT_LEVEL_1 39
#define COMPONENT_LIGHT_LEVEL_2 40
#define COMPONENT_LIGHT_LEVEL_3 41
@ -178,33 +187,66 @@
*
* Made for ISE building 2 room 303/2.
*/
//need to toggle 4 row of light independently and have one master switch that can control all
//need to toggle AC on/off, fan speed, mode, and temperature
//need to toggle air purifier on/off and fan speed
//display pm2.5 both outside and inside
//need to display time, date, and outside temperature for standby and dashbaord page in separate value
// Function to update date and time on screen-> void updateDateTimeText();
// Function to receieve touch input -> void handleTouch(uint8_t page, uint8_t component, uint8_t touch_type);
// Touch input will call a function that update the light at its respective row -> void setLightLevel(uint8_t row, uint8_t level);
// Function to React to change in light, contactor -> void handlePWMChange(uint8_t pin, bool state, uint16_t value);
// Function to Set AC state -> void setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_temperature);
// Function to Set Air Purifier -> setPMstate(bool is_pm_on, uint8_t pm_fan_speed);
// Function to update pm2.5 inside on screen -> void updatePMinside(); // get internal info from HA's air purifier sensor
// Function to update pm2.5 outside on screen -> void updatePMoutside(); // call API
// Function to get weather forcast and outside temperature and update screen -> void handleWeatherCallback();
class ISEDisplay : public ESPMegaDisplay {
public:
ISEDisplay(HardwareSerial* adapter);
void begin(std::function<rtctime_t()> getTime, DigitalInputCard* inputCard, DigitalOutputCard* outputCard, ClimateCard* climateCard);
void handleTouch(uint8_t page, uint8_t component, uint8_t event);
void handlePWMChange(uint8_t pin, uint8_t value);
void handleACChange(uint8_t mode, uint8_t fan_speed, uint8_t temperature);
void handlePayload(uint8_t payload_type, uint8_t* payload, uint8_t length);
void sendClock();
void setACControlEnabled(bool enabled);
bool getACControlEnabled();
void begin(DigitalInputCard* inputCard, DigitalOutputCard* outputCard, ClimateCard* climateCard);
void updateDateTimeText(rtctime_t time);
void updateWeather(uint8_t weather_code, float outside_temp);
void updatePMoutside(float pm25_outside);
void updatePMinside(float pm25_inside);
private:
bool ac_control_enabled = true;
std::function<rtctime_t()> getTime;
void handleTouch(uint8_t page, uint8_t component, uint8_t touch_type);
void handlePWMChange(uint8_t pin, bool state, uint16_t value);
void setPMstate(bool is_pm_on, uint8_t pm_fan_speed);
void setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_temperature);
void setLightLevel(uint8_t row, uint8_t level);
DigitalInputCard* inputCard;
DigitalOutputCard* outputCard;
DigitalOutputCard *outputCard;
ClimateCard *climateCard;
uint8_t outputCallbackHandle;
ClimateCard* climateCard;
uint8_t climateCallbackHandle;
bool calculateLightGroupState();
bool calculateFanGroupState();
void setLightGrouptState(bool state);
void setFanGroupState(bool state);
void toggleLightGroupState();
void toggleFanGroupState();
void updateLightGroupState();
void updateFanGroupState();
void updateAirPurifierState();
void updateACState();
};