237 lines
7 KiB
C++
237 lines
7 KiB
C++
#pragma once
|
|
|
|
//start definition
|
|
/*
|
|
tentetive pin mapping
|
|
|
|
1-4 Lights
|
|
1: row 1
|
|
2: row 2
|
|
3: row 3
|
|
4: row 4
|
|
(value from 0-3)
|
|
|
|
5: Air Purifier status (on/off)
|
|
6: Air Purifier fan speed (0-20)
|
|
|
|
lights have 4 states
|
|
0: off
|
|
1: low
|
|
2: mid
|
|
3: high
|
|
|
|
*/
|
|
|
|
//
|
|
#define DISPLAY_TIMEOUT 5*60*1000 // 5 minutes
|
|
|
|
// Touch Types
|
|
#define TOUCH_TYPE_PRESS 1
|
|
#define TOUCH_TYPE_RELEASE 0
|
|
|
|
// Page IDs
|
|
#define PAGE_BOOT 0
|
|
#define PAGE_STANDBY 1
|
|
#define PAGE_DASHBOARD 2
|
|
|
|
//boot page
|
|
|
|
//logo gmov boot
|
|
#define COMPONENT_LOGO_BOOT 1
|
|
#define COMPONENT_LOGO_BOOT_VID 1
|
|
|
|
//boot background
|
|
#define COMPONENT_BACKGROUND_BOOT_PIC 43
|
|
|
|
|
|
//standby page object id
|
|
#define COMPONENT_LOGO_STANDBY 1
|
|
#define COMPONENT_LOGO_STANDBY_VID 2
|
|
|
|
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE 2
|
|
#define COMPONENT_STANDBY_LIGHT_TOGGLE 3
|
|
#define COMPONENT_STANDBY_AC_TOGGLE 4
|
|
#define COMPONENT_STANDBY_PM_TOGGLE 5
|
|
|
|
//text
|
|
#define COMPONENT_STANDBY_TIME_TXT 6
|
|
#define COMPONENT_STANDBY_DATE_TXT 7
|
|
#define COMPONENT_STANDBY_OUTSIDE_TEMP_TXT 8
|
|
|
|
#define COMPONENT_STANDBY_TIMER 9
|
|
#define COMPONENT_STANDBY_WEATHER_ICON 10
|
|
|
|
//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
|
|
|
|
|
|
|
|
//dashboard page
|
|
|
|
//dashboard page object id
|
|
#define COMPONENT_AC_TOGGLE_BUTTON 3
|
|
#define COMPONENT_AC_MODE 4
|
|
#define COMPONENT_AC_FAN_SPEED 5
|
|
#define COMPONENT_AC_TEMP_DOWN_BUTTON 6
|
|
#define COMPONENT_AC_TEMP_UP_BUTTON 7
|
|
|
|
#define COMPONENT_PM_TOGGLE_BUTTON 8
|
|
#define COMPONENT_PM_FAN_SPEED_DECREASE 9
|
|
#define COMPONENT_PM_FAN_SPEED_INCREASE 10
|
|
|
|
#define COMPONENT_PM_INSIDE_TXT 11
|
|
#define COMPONENT_PM_OUTSIDE_TXT 12
|
|
|
|
#define COMPONENT_LIGHT_MASTER_BUTTON 13
|
|
#define COMPONENT_LIGHT_ROW1_PIC_PLACEHOLDER 14
|
|
#define COMPONENT_LIGHT_ROW2_PIC_PLACEHOLDER 15
|
|
#define COMPONENT_LIGHT_ROW3_PIC_PLACEHOLDER 16
|
|
#define COMPONENT_LIGHT_ROW4_PIC_PLACEHOLDER 17
|
|
|
|
#define COMPONENT_LIGHT_MASTER_LEVEL1_TOUCHPOINT 18
|
|
#define COMPONENT_LIGHT_MASTER_LEVEL2_TOUCHPOINT 19
|
|
#define COMPONENT_LIGHT_MASTER_LEVEL3_TOUCHPOINT 20
|
|
|
|
#define COMPONENT_DASHBOARD_TIME_TXT 21
|
|
#define COMPONENT_DASHBOARD_DATE_TXT 22
|
|
#define COMPONENT_DASHBOARD_OUTSIDE_TEMP_TXT 23
|
|
|
|
#define COMPONENT_LIGHT_ROW1_SLIDER 24
|
|
#define COMPONENT_LIGHT_ROW2_SLIDER 25
|
|
#define COMPONENT_LIGHT_ROW3_SLIDER 26
|
|
#define COMPONENT_LIGHT_ROW4_SLIDER 27
|
|
|
|
#define COMPONENT_LIGHT_ROW1_SWITCH 28
|
|
#define COMPONENT_LIGHT_ROW2_SWITCH 29
|
|
#define COMPONENT_LIGHT_ROW3_SWITCH 30
|
|
#define COMPONENT_LIGHT_ROW4_SWITCH 31
|
|
|
|
#define COMPONENT_DASHBOARD_WEATHER_ICON 32
|
|
|
|
|
|
//dashboard page picture id
|
|
|
|
#define COMPONENT_DASHBOARD_REFERENCE_BACKGROUND_PIC 0
|
|
#define COMPONENT_DASHBOARD_BACKGROUND_PIC 1
|
|
#define COMPONENT_DASHBOARD_BACKGROUND_VARIANT_PIC 2
|
|
|
|
//AC on/off
|
|
#define COMPONENT_AC_TOGGLE_PIC_OFF 3
|
|
#define COMPONENT_AC_TOGGLE_PIC_OFF_PRESSED 4
|
|
#define COMPONENT_AC_TOGGLE_PIC_ON 5
|
|
#define COMPONENT_AC_TOGGLE_PIC_ON_PRESSED 6
|
|
#define COMPONENT_AC_TEMP_DOWN_PIC 7
|
|
#define COMPONENT_AC_TEMP_DOWN_PIC_PRESSED 8
|
|
#define COMPONENT_AC_TEMP_UP_PIC 9
|
|
#define COMPONENT_AC_TEMP_UP_PIC_PRESSED 10
|
|
|
|
#define COMPONENT_AC_FAN_MODE_AUTO_PIC 11
|
|
#define COMPONENT_AC_FAN_MODE_AUTO_PIC_PRESSED 12
|
|
#define COMPONENT_AC_FAN_MODE_HIGH_PIC 13
|
|
#define COMPONENT_AC_FAN_MODE_HIGH_PIC_PRESSED 14
|
|
#define COMPONENT_AC_FAN_MODE_MID_PIC 15
|
|
#define COMPONENT_AC_FAN_MODE_MID_PIC_PRESSED 16
|
|
#define COMPONENT_AC_FAN_MODE_LOW_PIC 17
|
|
#define COMPONENT_AC_FAN_MODE_LOW_PIC_PRESSED 18
|
|
|
|
#define COMPONENT_AC_MODE_DRY_PIC 19
|
|
#define COMPONENT_AC_MODE_DRY_PIC_PRESSED 20
|
|
#define COMPONENT_AC_MODE_COOL_PIC 21
|
|
#define COMPONENT_AC_MODE_COOL_PIC_PRESSED 22
|
|
#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
|
|
#define COMPONENT_PM_TOGGLE_PIC_ON_PRESSED 28
|
|
|
|
#define COMPONENT_PM_FAN_SPEED_DECREASE_PIC 29
|
|
#define COMPONENT_PM_FAN_SPEED_DECREASE_PIC_PRESSED 30
|
|
#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_0 39
|
|
#define COMPONENT_LIGHT_LEVEL_1 40
|
|
#define COMPONENT_LIGHT_LEVEL_2 41
|
|
#define COMPONENT_LIGHT_LEVEL_3 42
|
|
|
|
|
|
//weather icon legend
|
|
#define COMPONENT_WEATHER_ICON_FAIR_DAY 63
|
|
#define COMPONENT_WEATHER_ICON_FAIR_NIGHT 64
|
|
#define COMPONENT_WEATHER_ICON_CLOUDY 65
|
|
#define COMPONENT_WEATHER_ICON_CLEARSKY_DAY 66
|
|
#define COMPONENT_WEATHER_ICON_CLEARSKY_NIGHT 67
|
|
#define COMPONENT_WEATHER_ICON_PARTLYCLOUDY_DAY 68
|
|
#define COMPONENT_WEATHER_ICON_PARTLYCLOUDY_NIGHT 69
|
|
#define COMPONENT_WEATHER_ICON_HEAVY_RAIN 70
|
|
#define COMPONENT_WEATHER_ICON_HEAVY_RAIN_AND_THUNDER 71
|
|
#define COMPONENT_WEATHER_ICON_RAIN_AND_THUNDER 72
|
|
#define COMPONENT_WEATHER_ICON_RAIN 73
|
|
#define COMPONENT_WEATHER_ICON_LIGHT_RAIN 74
|
|
#define COMPONENT_WEATHER_ICON_FOG 75
|
|
|
|
|
|
//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();
|