fixed climate card fram bug
This commit is contained in:
parent
091dc183fe
commit
c635427d64
8 changed files with 112 additions and 44 deletions
|
@ -86,10 +86,9 @@ void ClimateCard::setFRAMAutoSave(bool autoSave)
|
|||
|
||||
void ClimateCard::saveStateToFRAM()
|
||||
{
|
||||
// fram->write8(fram_address, state.ac_temperature);
|
||||
// fram->write8(fram_address + 1, state.ac_mode);
|
||||
// fram->write8(fram_address + 2, state.ac_fan_speed);
|
||||
fram->writeObject(fram_address, state);
|
||||
fram->write8(fram_address, state.ac_temperature);
|
||||
fram->write8(fram_address + 1, state.ac_mode);
|
||||
fram->write8(fram_address + 2, state.ac_fan_speed);
|
||||
Serial.println("Saved state to FRAM");
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
|
@ -98,10 +97,24 @@ void ClimateCard::saveStateToFRAM()
|
|||
|
||||
void ClimateCard::loadStateFromFRAM()
|
||||
{
|
||||
// state.ac_temperature = fram->read8(fram_address);
|
||||
// state.ac_mode = fram->read8(fram_address + 1);
|
||||
// state.ac_fan_speed = fram->read8(fram_address + 2);
|
||||
fram->readObject(fram_address, state);
|
||||
Serial.print("Loading temperature from FRAM at address ");
|
||||
Serial.print(fram_address);
|
||||
Serial.print(": ");
|
||||
Serial.println(fram->read8(fram_address));
|
||||
state.ac_temperature = fram->read8(fram_address);
|
||||
Serial.print("Loading mode from FRAM at address ");
|
||||
Serial.print(fram_address + 1);
|
||||
Serial.print(": ");
|
||||
Serial.println(fram->read8(fram_address + 1));
|
||||
state.ac_mode = fram->read8(fram_address + 1);
|
||||
Serial.print("Loading fan speed from FRAM at address ");
|
||||
Serial.print(fram_address + 2);
|
||||
Serial.print(": ");
|
||||
Serial.println(fram->read8(fram_address + 2));
|
||||
state.ac_fan_speed = fram->read8(fram_address + 2);
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
// if (state.ac_temperature > ac.max_temperature)
|
||||
// state.ac_temperature = ac.max_temperature;
|
||||
// else if (state.ac_temperature < ac.min_temperature)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue