diff --git a/display/cud_display_v3.HMI b/display/cud_display_v3.HMI index 819e677..1066b18 100644 Binary files a/display/cud_display_v3.HMI and b/display/cud_display_v3.HMI differ diff --git a/src/display.hpp b/src/display.hpp index 0fc9f59..b4a5441 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -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 diff --git a/src/main.cpp b/src/main.cpp index 5b7c1a6..3215d72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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"); diff --git a/src/main.hpp b/src/main.hpp index 9887a32..859c4b5 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -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 *