fix: skip the room records too when a restore leaves the shades out

A restore without "shades" skipped the shade and group records but not
the room records, which come first, so it read the repeaters and the
settings from room data. The skip is now shadeModelBytes(), in a
ConfigHeader.h the native tests can reach, which counts rooms, shades
and groups. Found during LOOP_QUEUE_PLAN.md's review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-17 22:53:18 +02:00
parent bee6a6d60b
commit 50aa491437
4 changed files with 91 additions and 20 deletions

View file

@ -574,10 +574,8 @@ bool ShadeConfigFile::restoreFile(SomfyShadeController *s, const char *filename,
}
else {
ESP_LOGI(TAG, "Shade data ignored");
// FF past the shades and groups.
this->file.seek(this->file.position()
+ (this->header.shadeRecords * this->header.shadeRecordSize)
+ (this->header.groupRecords * this->header.groupRecordSize), SeekSet); // Start at the beginning of the file after the header.
// FF past the rooms, shades and groups.
this->file.seek(this->file.position() + shadeModelBytes(this->header), SeekSet);
}
if(opts.repeaters) {
ESP_LOGI(TAG, "Restoring Repeaters...");