Repository navigation
fix: stop the 5 s boot wait, tell the client about a bad restore - #69
Merged
Merged
Conversation
NTPSettings::apply() waited up to 5 s in getLocalTime() for a clock that can't be set before the network is up, then returned before it set TZ. Every cold boot was 5 s slower and ran without its time zone. It now calls configTzTime(), which sets the zone and starts SNTP without waiting, and save() goes through apply(). /setgeneral checked ntpServer twice, so a request that changed only the zone was ignored. A restore ignored the result of ShadeConfigFile::restore() and rebooted either way, so a bad file failed with no word to the user. The /restore reply now validates the file and answers 400, which the restore dialog shows, and an incomplete upload gets a 400 instead of no reply. A failed restore changes nothing, so loop() no longer reboots after one. /shades.tmp, a full copy of the backup with its rolling codes, is deleted after every restore and after /updateShadeConfig. The 6 extra bytes in the 2026-10-18 backup: TRANS_REC_SIZE stayed 74 when noiseDetection was added to the 80-byte transceiver record, so every backup since declares it short. It is 80 now. The size check stays a warning so those backups still restore, and the sum moves to expectedFileBytes() with tests. The repeater record length is checked as a warning only, since validate() also runs on shades.cfg at boot. Commands for an unknown shade, tilt or group now log a warning, and a socket that never pinged says so. KNOWN_ISSUES.md is updated, including the real cause of the ~365 ms loop stall (radio_tx busy-waits each frame on loop()'s core). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes from the issues in the 2026-10-18/19 serial logs (#68).
Boot clock. Each cold boot waited 5 s and then skipped the time zone.
Restore. Today a bad file still reboots the device, and nobody is told.
Backup header. The 6 extra bytes in that backup came from
TRANS_REC_SIZE. It stayed at 74 whennoiseDetectionwas added to the transceiver record, which is 80 bytes. So every backup since then has understated that record by 6 bytes.The checks stay warnings on purpose. A strict size check would reject every existing backup.
validate()also runs onshades.cfgat boot, and failing it there would start the device with no shades.Logs. Commands for an unknown shade, tilt or group now log
... not found. The socket disconnect line saysnever pingedinstead oflast ping 0ms ago.Docs.
KNOWN_ISSUES.mdmarks these issues fixed, and corrects the "365 ms loop" entry with the real cause. Theradio_txtask busy-waits each frame at priority 5 onloop()'s core; the fix would be sending with RMT.Evidence
test_configheader, using the real backup's header:File system mountedandLaunching web server.shades.tmpis gone.shades.tmpin the boot file list.shadeCommandwithshadeId=99:not foundwarning in the log.Merge Danger
Door: two-way
Every change reverts cleanly. New backups declare an 80-byte transceiver record. Older firmware reads that record field by field and then skips to the record end, so a new backup still restores on older firmware.
Blast Radius: boot, restore
NTPSettings::apply()runs on every boot.validate()runs onshades.cfgat every boot, but nothing that used to pass validation can fail it now.index.jschange only reaches the device with a new file-system image.🤖 Generated with Claude Code