Repository navigation
Conversation
The RX8130CE encodes the day of the week one-hot, Sunday = 01h through Saturday = 40h (Epson ETM50E-10, 14.1.2, Table 15, p. 27), and "do not set '1' to more than one day at the same time". setTime() wrote bin2bcd(tm_wday), so no day was stored correctly: Sunday wrote no day, and Wednesday, Friday and Saturday wrote two. getTime() decoded it the same way. The date and time are unaffected, as mktime() ignores tm_wday. Write 1 << tm_wday (gmtime() gives 0-6), and read back the position of the lowest set bit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 4, 2026
Open
There was a problem hiding this comment.
Copilot review overview
馃煝 Approval recommended
The reviewed weekday encoding and decoding changes are complete.
Review effort: Lite
Findings: None
What changed in this PR
Fixes RX8130CE weekday handling to match the chip鈥檚 one-hot WEEK register format.
Changes:
- Writes weekdays as
1 << tm_wday. - Decodes the lowest set weekday bit when reading.
| File | Description |
|---|---|
src/鈥媓elpers/鈥婻TC_RX8130CE.cpp |
Corrects WEEK register encoding and decoding. |
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 4, 2026
Merged
ptr727
added a commit
to ptr727/liquidraver-ZephCore
that referenced
this pull request
Oct 5, 2026
rtc_time_block() wrote the weekday as a number 0-6 (Sunday 0) for every RTC. The RX8130CE's WEEK register (13h) is one-hot: Epson ETM50E-10 14.1.2, Table 15, p. 27, Sunday 01h to Saturday 40h, with no more than one bit set. So each sync wrote Sunday as no day, Monday as Sunday, and Wednesday, Friday and Saturday as two days at once. ZephCore never reads the weekday back, so its time and date were unaffected. A new boolean descriptor property, weekday-one-hot, is set on the RX8130CE node in rtc-i2c.dtsi, and rtc_time_block() writes BIT(dow) where it is set. That is the encoding of Zephyr's rtc_rx8130ce.c. The DS3231, PCF8563 and RV3028 keep 0-6, as Zephyr's drivers for them write it. The binding and comments no longer call the whole block BCD. meshtracker_x1's YSN8900 sets it too. The board already uses the RX8900 register map for it, and the RX8900's WEEK register (03h) is one-hot: Epson ETM45E-11 8.2.2, Table 15, p. 16. The YSN8900's own data sheet has no register map, and its programming guide is not available. The same defect and fix as meshcore-dev/MeshCore#3550. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
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.
References:
dev3e3150c88c9c9772The defect
The RX8130CE's WEEK register (13h) is one-hot: Sunday = 01h through Saturday = 40h (搂14.1.2 "Week counter", Table 15, p. 27). The manual says "Do not set '1' to more than one day at the same time".
setTime()L98 wrotebin2bcd(t->tm_wday) & 0x07, so no day was stored correctly:00h, no day at all.getTime()L144 decoded it the same wrong way.The fix
1 << t->tm_wday. Its only caller,adjust(), passesgmtime()output, which is 0-6.adjust()rewrites the register.Impact and notes
now()andunixtime()go throughmktime(), which ignorestm_wday, so the date and time MeshCore uses never depended on this. Only the chip's own week counter was wrong. That affects a weekday alarm, which MeshCore doesn't use, or any other firmware reading the chip.tm_wdayand register 13h are used nowhere else insrc/,examples/orvariants/.begin()neither checks VLF nor initialises the time registers after power-up, which the manual requires.stop()rewrites all of 1Eh, not just the STOP bit.bin2bcd(tm_year - 100)is wrong outside 2000-2099.Testing
R1Neo_repeaterbuilds, the only board using this driver (Muzi R1 Neo), as doRAK_4631_repeater,heltec_v4_repeaterandRAK_11310_repeater.The same defect was found independently in ZephCore: ptr727/liquidraver-ZephCore#39.
Fixes #3549
Iteration history and review: ptr727/meshcore-dev-MeshCore#16.
馃 Generated with Claude Code