mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-23 08:44:03 +00:00
peripherals & power: GPS fixes, poweroff/pwrmgt, upstream SensorManager telemetry
- gps: servers honour gps_enabled at boot (was lost on reboot; zc.gps_set upgrades older prefs to on once); sleep lock only while acquiring; gps off works on boards without a power line (UART sleep); UI toggles and fixes handled on the main thread; configure only after a good init; observer parks its GPS; one interval clamp (clampGpsInterval); one nav-mode knob (room servers on Air530Z now stationary); GNSS UARTE from DT - gps: split into ZephyrGPSManager / gps_power / gps_module_cfg (+gps_internal.h); dead driver branches, gps_get_diag, sats_* removed - clock: ZephyrRTCClock writes the hardware RTC itself (clkreboot now resets it); MESH_EVENT_RTC_SAVE gone - power: one power-off path (zephcore_power_off, ZephyrBoard::powerOff), poweroff/shutdown CLI, get pwrmgt.*, crash record kept across reboot, battery reading cached 10 s, fuel gauge on the current API - telemetry: upstream SensorManager + CayenneLPP (rounded to nearest), one builder for all roles; per-sensor channels, MCU temp always, guest gating and inverse mask on servers; sensor list/get/set work; BME280/BMP280 also probed at 0x77 - CLI: gps in upstream's form, get gps detail, gps sync
This commit is contained in:
1 parent
e6d6ecef80
commit
d5bd805710
59 files changed
+3090
-3077
No files matched your search
@@ -3,20 +3,45 @@
|
||||
*/
|
||||
|
||||
#include "ZephyrRTCClock.h"
|
||||
#include "ZephyrRTCDiscover.h"
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/devicetree.h>
|
||||
|
||||
namespace mesh {
|
||||
|
||||
#if DT_HAS_COMPAT_STATUS_OKAY(zephcore_rtc_i2c)
|
||||
/* One clock per build. The work reads the time when it runs, so any number
|
||||
* of sets before it runs are one write, of the latest time. */
|
||||
static ZephyrRTCClock *s_saved_clock;
|
||||
|
||||
static void rtc_save_work_fn(struct k_work *work)
|
||||
{
|
||||
ARG_UNUSED(work);
|
||||
zephcore_rtc_save(s_saved_clock->getCurrentTime());
|
||||
}
|
||||
|
||||
static K_WORK_DEFINE(s_rtc_save_work, rtc_save_work_fn);
|
||||
#endif
|
||||
|
||||
uint32_t ZephyrRTCClock::getCurrentTime()
|
||||
{
|
||||
uint32_t uptime_sec = (uint32_t)(k_uptime_get() / 1000);
|
||||
return epoch_offset + uptime_sec;
|
||||
}
|
||||
|
||||
void ZephyrRTCClock::setCurrentTime(uint32_t time)
|
||||
void ZephyrRTCClock::seedCurrentTime(uint32_t time)
|
||||
{
|
||||
uint32_t uptime_sec = (uint32_t)(k_uptime_get() / 1000);
|
||||
epoch_offset = time - uptime_sec;
|
||||
}
|
||||
|
||||
void ZephyrRTCClock::setCurrentTime(uint32_t time)
|
||||
{
|
||||
seedCurrentTime(time);
|
||||
#if DT_HAS_COMPAT_STATUS_OKAY(zephcore_rtc_i2c)
|
||||
s_saved_clock = this;
|
||||
k_work_submit(&s_rtc_save_work);
|
||||
#endif
|
||||
}
|
||||
|
||||
} /* namespace mesh */
|
||||
@@ -12,7 +12,12 @@ namespace mesh {
|
||||
class ZephyrRTCClock : public RTCClock {
|
||||
public:
|
||||
uint32_t getCurrentTime() override;
|
||||
/* Also written to the board's hardware RTC, if it has one, as upstream's
|
||||
* AutoDiscoverRTCClock does: coalesced on the system work queue, so
|
||||
* callers on any thread pay no I2C. */
|
||||
void setCurrentTime(uint32_t time) override;
|
||||
/* Boot only: the time just read from the hardware RTC, not written back. */
|
||||
void seedCurrentTime(uint32_t time);
|
||||
|
||||
private:
|
||||
uint32_t epoch_offset = 0;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* present fail the probe and are skipped — like the environment sensors.
|
||||
*
|
||||
* If a present chip holds a valid time, zephcore_rtc_restore() returns it so
|
||||
* the soft clock can be seeded at boot (shown tagged "L" — local). On every
|
||||
* authoritative sync (GPS/app/CLI) the caller writes it back via
|
||||
* zephcore_rtc_save() so time survives the next power-off.
|
||||
* the soft clock can be seeded at boot (shown tagged "L" — local). Every
|
||||
* ZephyrRTCClock::setCurrentTime() writes it back via zephcore_rtc_save(), so
|
||||
* time survives the next power-off.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
Reference in new issue
Block a user