mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
refactor: hold shade settings in ShadeSettings and RemoteSettings
The shade behaviour module (SHADE_BEHAVIOUR_PLAN.md, PR B) reads its settings through read-only structs, so they get one home each: RemoteSettings (flipCommands, bitLength, repeats) under SomfyRemote, shared with groups, and ShadeSettings (types, travel times, step size, flipPosition, simMy, sunSensor) under SomfyShade. Both are base structs, so shade->upTime and group->repeats keep working. A shade's flags byte is split by owner: simMy and sunSensor are settings, light is a field, and the sun flag, sunny, windy, demo mode and lighted bits are stateFlags. getFlags()/setFlags() put the byte together and take it apart for the config file, JSON, MQTT, events and group flags, so nothing saved or sent changes. Groups keep their own flags byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8a13e0c3a9
commit
fa7aaf0d49
13 changed files with 207 additions and 67 deletions
|
|
@ -827,7 +827,7 @@ bool ShadeConfigFile::readShadeRecord(SomfyShade *shade) {
|
|||
if(this->header.version < 5 && j == 4) break; // Prior to version 5 we only supported 5 linked remotes.
|
||||
}
|
||||
shade->lastRollingCode = this->readUInt16(0);
|
||||
if(this->header.version > 7) shade->flags = this->readUInt8(0);
|
||||
if(this->header.version > 7) shade->setFlags(this->readUInt8(0));
|
||||
if(shade->getRemoteAddress() != 0) {
|
||||
// If the last rolling code stored on the nvs is less than the rc we currently have
|
||||
// then we need to set it.
|
||||
|
|
@ -995,7 +995,7 @@ bool ShadeConfigFile::writeShadeRecord(SomfyShade *shade) {
|
|||
}
|
||||
this->writeUInt16(shade->lastRollingCode);
|
||||
if(shade->getShadeId() != 255) {
|
||||
this->writeUInt8(shade->flags & 0xFF);
|
||||
this->writeUInt8(shade->getFlags());
|
||||
this->writeFloat(shade->myPos, 5);
|
||||
this->writeFloat(shade->myTiltPos, 5);
|
||||
this->writeFloat(shade->currentPos, 5);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue