Repository navigation
Conversation
Until now a clock could only be updated with a USB install from nsclock.app, which also replaced all settings. The settings page now installs firmware itself: the Firmware card offers the version published on nsclock.app (release or debug), a file from the phone or computer, and going back to the version the last update replaced. The browser downloads the file and uploads it, so the clock never downloads firmware on its own. scripts/ota.sh installs a local build the same way. The flash now has two firmware slots and a small partition for the settings. An update stops the data source and frees its connections, shows UPDATE, and writes the upload into the slot that is not running. It shows SUCCESS and restarts on the new firmware, or shows FAILED and restarts on the old one when the upload is refused, incomplete, stalls, or fails its image check. Only files that carry NSClock's update marker are accepted, which also keeps out versions made for the old layout. A new firmware that does not survive its first minute makes the bootloader return to the previous one, which is then not offered again. Settings live as one JSON entry in NVS instead of a LittleFS file, and are laid over the firmware's factory settings at boot, so they survive updates and going back. The web UI is embedded in the firmware, which replaces the filesystem image; every firmware build therefore builds the web assets and the clock preview, and needs Emscripten. Clocks need one more USB install with the new partition table; updates come from the settings page after that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
@nishanm, @adamecker could you please have a look at this PR? Thank you |
The site deploy now leaves the LittleFS image out of the installer only when the release it serves has none, so merging this keeps installing 1.3.5 with its filesystem until a release with firmware updates exists. A settings read that fails, for lack of memory for example, no longer counts as "nothing saved", which replaced the saved settings, WiFi included, with the factory ones. The settings page reads them at any time, while free memory can be low. The firmware upload sets its data time before it is marked as started, so the main loop cannot compare a stale time and declare a fresh upload stalled. After a successful installation or going back, the Firmware card keeps its actions disabled until the page is reloaded, because it still describes the firmware that ran before. scripts/ota.sh sends the login through stdin, so the password does not show in curl's arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a settings namespace or entry that does not exist counts as nothing saved now. The settings are read with the NVS calls themselves, because Preferences reports every error as "not there", and any other failure no longer leads to the factory settings replacing the saved ones. Laying the saved settings over the factory ones also fails as a whole when it runs out of memory, instead of returning settings with values missing. The read buffer has room for the terminator that String copies. A data source that shows a fatal error keeps the main loop on that error for minutes, so an update started meanwhile never got past stopping the source. The error screen now hands over to an update once one starts, and the update ends with a restart as usual. When the answer to an upload is lost, the settings page checks which firmware the clock runs after its restart, and reports the update as installed when the clock now runs the uploaded build. A local file that cannot be read, or is too big for the clock, gets a message instead of leaving the Firmware card disabled. scripts/ota.sh is executable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What changed
scripts/ota.shinstalls a local build over WiFi, with--password/NSCLOCK_PASSWORDwhen the web password is on.src/FirmwareUpdateManager.*):partitions.csv): two 1984 KB firmware slots and a 64 KBconfigNVS partition; LittleFS is gone.src/ConfigStore.*) and laid over the factory settings at boot (src/SettingsOverlay.h), so they survive updates and going back.board_build.embed_files), served with CRC ETags. Every firmware build now builds the web assets and the clock preview, so it needs Emscripten.upload.shwritesboot_app0so a USB install after an over-the-air update boots the USB firmware;--fsis removed; CI, the release workflow, the site manifests and the docs are updated.Why
Updating meant a USB install from nsclock.app that also replaced all settings. Now an update keeps the settings and needs only the phone.
Every clock needs one more USB install (
scripts/upload.sh --all, or the nsclock.app installer) because the partition table changes.How it was tested
On a real Ulanzi clock:
ota.shwith no password, a wrong one and the right onesetup(), and no rollback on a restart in the first minutetest/run_tests.shpasses, including new tests for the offer logic and the marker.Screenshots
The Firmware card on the WiFi & system tab:
🤖 Generated with Claude Code