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, and read back the position of the lowest set bit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tm_wday comes from gmtime() and is 0-6; a negative value would stay negative under %, so the modulo implied a guard it was not. From review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review comments remain, and the focused change is fully reviewed.
Review effort: Lite
Findings: None
What changed in this PR
Corrects RX8130CE WEEK register handling to use one-hot weekday encoding.
Changes:
- Writes weekdays as
1 << tm_wday. - Decodes the lowest set weekday bit when reading.
| File | Description |
|---|---|
src/helpers/RTC_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.
|
Upstream: PR meshcore-dev#3550 (from |
Iteration branch for #15. Keep it open; never merge it. A clean single-commit branch for upstream is cut from it once it has baked. Upstream takes PRs on
dev.References:
dev3e3150c84cdd5d71The 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.
Refs #15
🤖 Generated with Claude Code