mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-07-15 07:12:14 +02:00
Save upMidTime/downMidTime/descendTime/upSlatTime to backup file
The four non-linear calibration fields were persisted to NVS and returned via the JSON API but were missing from the binary config file (ShadeConfigFile). Bump SHADE_HDR_VER to 25 and SHADE_REC_SIZE to 320, add read/write for the four fields. Old backups (version ≤ 24) load cleanly with defaults of 0 (linear behaviour). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9883dbec5e
commit
510af3bd15
3 changed files with 14 additions and 4 deletions
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
extern Preferences pref;
|
extern Preferences pref;
|
||||||
|
|
||||||
#define SHADE_HDR_VER 24
|
#define SHADE_HDR_VER 25
|
||||||
#define SHADE_HDR_SIZE 76
|
#define SHADE_HDR_SIZE 76
|
||||||
#define SHADE_REC_SIZE 276
|
#define SHADE_REC_SIZE 320
|
||||||
#define GROUP_REC_SIZE 200
|
#define GROUP_REC_SIZE 200
|
||||||
#define TRANS_REC_SIZE 74
|
#define TRANS_REC_SIZE 74
|
||||||
#define ROOM_REC_SIZE 29
|
#define ROOM_REC_SIZE 29
|
||||||
|
|
@ -861,6 +861,12 @@ bool ShadeConfigFile::readShadeRecord(SomfyShade *shade) {
|
||||||
if(shade->proto == radio_proto::GP_Remote)
|
if(shade->proto == radio_proto::GP_Remote)
|
||||||
pinMode(shade->gpioMy, OUTPUT);
|
pinMode(shade->gpioMy, OUTPUT);
|
||||||
if(this->header.version >= 19) shade->roomId = this->readUInt8(0);
|
if(this->header.version >= 19) shade->roomId = this->readUInt8(0);
|
||||||
|
if(this->header.version >= 25) {
|
||||||
|
shade->upMidTime = this->readUInt32(0);
|
||||||
|
shade->downMidTime = this->readUInt32(0);
|
||||||
|
shade->descendTime = this->readUInt32(0);
|
||||||
|
shade->upSlatTime = this->readUInt32(0);
|
||||||
|
}
|
||||||
if(this->file.position() != startPos + this->header.shadeRecordSize) {
|
if(this->file.position() != startPos + this->header.shadeRecordSize) {
|
||||||
Serial.println("Reading to end of shade record");
|
Serial.println("Reading to end of shade record");
|
||||||
this->seekChar(CFG_REC_END);
|
this->seekChar(CFG_REC_END);
|
||||||
|
|
@ -997,7 +1003,11 @@ bool ShadeConfigFile::writeShadeRecord(SomfyShade *shade) {
|
||||||
this->writeUInt8(shade->gpioDown);
|
this->writeUInt8(shade->gpioDown);
|
||||||
this->writeUInt8(shade->gpioMy);
|
this->writeUInt8(shade->gpioMy);
|
||||||
this->writeUInt8(shade->gpioFlags);
|
this->writeUInt8(shade->gpioFlags);
|
||||||
this->writeUInt8(shade->roomId, CFG_REC_END);
|
this->writeUInt8(shade->roomId);
|
||||||
|
this->writeUInt32(shade->upMidTime);
|
||||||
|
this->writeUInt32(shade->downMidTime);
|
||||||
|
this->writeUInt32(shade->descendTime);
|
||||||
|
this->writeUInt32(shade->upSlatTime, CFG_REC_END);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool ShadeConfigFile::writeSettingsRecord() {
|
bool ShadeConfigFile::writeSettingsRecord() {
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
SomfyController.ino.esp32s3.littlefs.bin
Normal file
BIN
SomfyController.ino.esp32s3.littlefs.bin
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue