mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-23 07:12:25 +00:00
wire up RTC to out-of-the-box capable nodes
This commit is contained in:
1 parent
9ef6774d6a
commit
01fd56a573
16 files changed
+474
No files matched your search
@@ -6,6 +6,7 @@
|
||||
#include "CommonCLI.h"
|
||||
#include "battery_curve.h"
|
||||
#include <helpers/time_sync.h>
|
||||
#include <adapters/clock/ZephyrRTCDiscover.h>
|
||||
#include <helpers/TxtDataHelpers.h>
|
||||
#include <helpers/AdvertDataHelpers.h>
|
||||
#include <adapters/board/ZephyrBoard.h>
|
||||
@@ -336,6 +337,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
||||
if (sender_timestamp > curr) {
|
||||
getRTCClock()->setCurrentTime(sender_timestamp + 1);
|
||||
time_sync_report(TIME_SYNC_CLI);
|
||||
zephcore_rtc_save(sender_timestamp + 1); /* persist to hardware RTC */
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
time_t t = (time_t)now;
|
||||
struct tm *tm = gmtime(&t);
|
||||
@@ -356,6 +358,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
||||
if (secs > curr) {
|
||||
getRTCClock()->setCurrentTime(secs);
|
||||
time_sync_report(TIME_SYNC_CLI);
|
||||
zephcore_rtc_save(secs); /* persist to hardware RTC */
|
||||
time_t t = (time_t)secs;
|
||||
struct tm *tm = gmtime(&t);
|
||||
snprintf(reply, CLI_REPLY_SIZE, "OK - clock set: %02d:%02d - %d/%d/%d UTC",
|
||||
|
||||
Reference in new issue
Block a user