fix: read the rolling code from NVS only until it has been written

Splitting getNextRollingCode into peek and commit opened the ShadeCodes
namespace twice per command.  Once a code has been written for an
address lastRollingCode matches NVS, so peek uses it and only commit
opens NVS.  Changing the address drops back to reading NVS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-12 18:00:51 +02:00
parent a49fa5d953
commit 08d2cd7a0c
2 changed files with 9 additions and 2 deletions

View file

@ -198,6 +198,9 @@ class SomfyRemote {
protected:
char m_remotePrefId[11] = "";
uint32_t m_remoteAddress = 0;
// lastRollingCode is known to match NVS for this address, so the next code
// can be worked out without opening NVS.
bool m_rollingCodeSynced = false;
public:
radio_proto proto = radio_proto::RTS;
uint8_t gpioFlags = 0;