display update

This commit is contained in:
Siwat Sirichai 2024-03-23 11:08:33 +07:00
parent c72a0d48df
commit 0a93b99021
4 changed files with 8 additions and 5 deletions

Binary file not shown.

View File

@ -63,6 +63,8 @@ class CUDDisplay : public ESPMegaDisplay
CUDDisplay(cud_display_conf_t *conf);
void begin(cud_display_cards_t cards);
void display_init();
void set_ac_lock(bool state);
bool get_ac_lock();
private:
// States Calculation
bool get_lights_state();
@ -87,8 +89,6 @@ class CUDDisplay : public ESPMegaDisplay
// Helper Functions
void system_toggle();
// AC Functions and Variables
void set_ac_lock(bool state);
bool get_ac_lock();
bool ac_locked;
uint8_t previous_mode; // Used to store mode prior to turning off
// Local Variables

View File

@ -81,6 +81,9 @@ void setup()
ESP_LOGV("CUD IoT OS", "Initializing Air Conditioner");
espmega.installCard(2, &ac);
ac.bindFRAM(&espmega.fram, AC_FRAM_ADDR);
ac.loadStateFromFRAM();
ac.setFRAMAutoSave(true);
ESP_LOGD("CUD IoT OS", "Loaded Air Conditioner State from FRAM, Temperature: %d, Mode: %d, Fan Speed: %d", ac.getTemperature(), ac.getMode(), ac.getFanSpeed());
espmega.display->bindClimateCard(&ac); // Show our climate card on the display
// Register all cards with iot
ESP_LOGV("CUD IoT OS", "Registering Cards with IoT");

View File

@ -64,9 +64,9 @@
/***********************************************
* Persistent Storage Configuration *
***********************************************/
#define AC_FRAM_ADDR 5000 // 2 bytes
#define AC_LOCK_FRAM_ADDR 5002 // 1 byte
#define AC_DISPLAY_MODE_FRAM_ADDR 5003 // 1 byte
#define AC_FRAM_ADDR 10000 // 3 bytes
#define AC_LOCK_FRAM_ADDR 10005 // 1 byte
#define AC_DISPLAY_MODE_FRAM_ADDR 10010 // 1 byte
/***********************************************
* Remote Variables *