-
Notifications
You must be signed in to change notification settings - Fork 387
DS3231 RTC driver embedded in "local clock" (PR#1729) #1792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
use original obk_config.h - only renaming functions - to see filesizes
…pp into Split_NTP_new
…GetArgInteger(0) for epoch Change user_main.c to use xticks as uptime for g_secondsElapsed
…pp into Split_NTP_new
…y with g_secondsElapesd++ here ...
remove additional defines for W800 used for testing
Seems much better, 30 seconds difference in one day (used to be over 10 minutes off in 12 hours)
…ad of new "#define ENABLE_CLOCK_SUNRISE_SUNSET") fix RDA5981 (as already done in branch Split_NTP_new)
@MaxineMuster share any comments so we can all test this better and maybe implement is project wide if possible. Any info is welcome and thanks. |
This PR is mainly a demonstration on how PR#1729 can be used. A list of all commands introduced:
Two additional areas for changes before getting to the actual RTC driver ;-) Especially on BL602 the images increased quite a lot when using time.h functions. Since increasing g_secondsElapsed only in OnEverySecond, time will differ soon, depending on the chip for some seconds in a minute! And now, on top of the base to use a clock independent from NTP, there's the simple driver for the DS3231:
So a simple call to set the RTC from another device: The main thread for all around this is |
Tomorrow I should be receiving my RTC module and will test more and report back with findings. |
A word of caution regarding the cheap modules: they often are delivered with a regular cell battery, but hardware setup is for a rechargeable battery. So if powered, the battery is "charging" against the rules. |
thanks. mine didn't come with cell, but I also dont have any rechargeables |
You can simply check if battery + is connected to VCC via the diode and resistor. If it is, you shouldn't use a non rechargeable battery without modification. |
Driver enabled for W800 ATM.
enabling driver with
#define ENABLE_DRIVER_DS3231
starting driver with
startdriver DS3231 <CLK-Pin> <DATA-Pin> <optional: sync clock>
optional last argument "sync clock":
0: do nothing
1: on driver start set device clock to RTC
2: set device clock regularly to RTC - so RTC is "clock master"