|
@ -107,8 +107,9 @@ int16_t znrf_adc_channel_read_val(uint16_t channel) { |
|
|
/******************************************************************************* |
|
|
/******************************************************************************* |
|
|
* RTC * |
|
|
* RTC * |
|
|
*******************************************************************************/ |
|
|
*******************************************************************************/ |
|
|
|
|
|
#define DEFAULT_TIME (1704038400 + 8 * 60 * 60) // 2024/01/01/00:00:00 |
|
|
volatile uint32_t g_timestamp = 0; |
|
|
volatile uint32_t g_timestamp = 0; |
|
|
volatile uint32_t g_power_on_rtc = 1704038400; // 2024/01/01/00:00:00 |
|
|
|
|
|
|
|
|
volatile uint32_t g_power_on_rtc = (DEFAULT_TIME); |
|
|
// static uint8_t s_timeCount1second = 0; |
|
|
// static uint8_t s_timeCount1second = 0; |
|
|
|
|
|
|
|
|
uint32_t znordic_getpower_on_ms() { |
|
|
uint32_t znordic_getpower_on_ms() { |
|
@ -153,7 +154,7 @@ void znordic_rtc_settime(uint16_t year, uint8_t month, uint8_t day, uint8_t |
|
|
uint32_t nowtimestamp = mktime(&s_tm); |
|
|
uint32_t nowtimestamp = mktime(&s_tm); |
|
|
uint32_t tosettime = nowtimestamp - znordic_getpower_on_s(); |
|
|
uint32_t tosettime = nowtimestamp - znordic_getpower_on_s(); |
|
|
|
|
|
|
|
|
if (tosettime > 1704038400) { // 2024/01/01/00:00:00 |
|
|
|
|
|
|
|
|
if (tosettime > DEFAULT_TIME) { // 2024/01/01/00:00:00 |
|
|
g_power_on_rtc = tosettime; |
|
|
g_power_on_rtc = tosettime; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|