Repository navigation
set RTC via progcom - #8
Merged
Merged
Conversation
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.
The companion cm_mcu change adds an RTC set word on the Control page (0x7f, offset 0x04), advertised by capability bit 10 (
RTC_WRITE) at map minor 4. This addsMCU.set_rtc(), which writes the host's local wall-clock time as seconds since 1970-01-01 of that clock. This is not Unix time: the RTC has no time zone, so a DST change only takes effect the next time the clock is set. The client and the firmware both refuse times before 2026-01-01, andset_rtc()checks the capability bit first, so older firmware getsMcuCapabilityUnavailablerather than a bare address error. The newmcu_set_rtc.pyscript sets the clock from the host, reads it back, and fails if the read-back is more than--toleranceseconds off (default 2). The RTC set is not serialised against the CLItime setcommand; MCU_REGISTER_MAP.md documents this. New unit tests cover the encoding and the gate, and new wire-contract tests check the offset, capability bit and lower bound against MCU_Reg.h. Like the other wire-contract tests, they are skipped in CI and fail locally until the cm_mcu change is merged. Tested on hardware: the RTC was set with a -1.0 s read-back offset, the CLItimeagreed, and the firmware rejected pre-2026 values withinvalid MCU value.