The panel's wall clock: whether it holds a real date, whether a file's stamp says anything, the time zones SETUP offers, the one NTP (Network Time Protocol) request a join makes, and the slow clock's console line.
More...
|
|
#define | WALL_VALID_FLOOR_S 1767225600LL |
| | The first second the clock is taken to hold a real date: 2026-01-01 00:00:00 UTC, in seconds since 1970-01-01 UTC. An unset clock counts uptime from 1970 and stays below it for 56 years of uptime.
|
|
#define | WALL_STAMP_FLOOR_S 347198400LL |
| | The first file stamp taken as known: 1981-01-01 12:00:00 UTC. FAT (File Allocation Table) dates start in 1980, and FatFs stamps any time before 1980 as 1980. Read back through mktime() in a zone from UTC-12 to UTC+14, every 1980 stamp is below this and every stamp from 1981-01-03 on is above it.
|
|
#define | WALL_NTP_TIMEOUT_MS 30000u |
| | How long a join waits for an NTP answer: 30000ms.
|
|
#define | WALL_NTP_SERVER "pool.ntp.org" |
| | The NTP server a join asks.
|
|
#define | WALL_ZONE_DEFAULT 2 |
| | The time zone a panel starts with: Berlin (CET/CEST).
|
|
#define | WALL_ZONE_COUNT 10 |
| | The number of time zones SETUP offers.
|
|
| bool | wall_valid (int64_t unix_s) |
| | Whether a clock reading holds a real date.
|
| bool | wall_stamp_known (int64_t mtime) |
| | Whether a file's stamp says when it was written: false for a stamp FatFs made from an unset clock (any time in 1980) and for none at all.
|
| const char * | wall_zone_posix (int index) |
| | Time zone index as a POSIX TZ string, for setenv("TZ") and tzset(). The order is the SETUP row's (UI_OPTIONS(time_zone) in ui_text.def): UTC, London, Berlin, Helsinki, New York, Chicago, Denver, Los Angeles, Tokyo, Sydney.
|
| int64_t | wall_local_s (int64_t unix_s) |
| | A time moved by the zone in force (TZ, tzset()) at that time, so a UTC civil reading of the result shows the local date and time: what FILES INFO, the Wi-Fi page and the ZIP file write. The file stamps FatFs writes are local; mktime() turns them into true seconds since 1970, and this turns them back.
|
| char * | wall_utc_text (char *out, size_t n, int64_t unix_s) |
| | A UTC time as "YYYY-MM-DD HH:MM:SS UTC".
|
| char * | wall_ntp_line (char *out, size_t n, const char *server, int64_t new_us, int64_t old_us) |
| | The console line of an NTP answer: the server, the time set and how far it moved the clock, e.g. "ntp: pool.ntp.org set 2026-10-24 14:03:12 UTC, offset
+1792739352.345s from the old clock".
|
| wall_ntp_do_t | wall_ntp_step (wall_ntp_t *n, bool joined, bool answered, uint32_t now_ms) |
| | Move the request on. Joined: one START, then SET on an answer or GAVE_UP after WALL_NTP_TIMEOUT_MS. A join that ends while it asks: STOP. The next join asks again.
|
| bool | wall_ntp_holds (const wall_ntp_t *n, bool lingers, uint32_t now_ms) |
| | Whether the radio stays up past its session's end for this request: the session lingers (wa_lingers() in wa_session.h) and the request asks, less than WALL_NTP_TIMEOUT_MS after its START. An answer at 29.9s ends the hold with it; the time-out at 30s ends it unanswered.
|
| wall_ntp_do_t | wall_ntp_hold_step (wall_ntp_t *n, bool joined, bool lingers, bool answered, uint32_t now_ms) |
| | wall_ntp_step() across a session's end that lingers: a request that asks counts the lingering station as joined, so it ends with its answer (SET) or after WALL_NTP_TIMEOUT_MS (GAVE_UP), not with the session (STOP). A lingering station starts no request.
|
| uint64_t | wall_slow_mhz (uint32_t cal) |
| | A slow clock's frequency from ESP-IDF's calibration value: the period in microseconds with 19 fractional bits (esp_clk_slowclk_cal_get(), RTC_CLK_CAL_FRACT), measured against the 40MHz main crystal at start-up.
|
| char * | wall_slow_clock_line (char *out, size_t n, wall_slow_src_t src, bool crystal, uint32_t cal) |
| | The console line of the slow clock at start, after the tag "clock": the source, its calibrated frequency, and whether the 32.768kHz crystal the build asks for failed to start, e.g. "rtc slow clock 32k crystal, 32768.012Hz calibrated" or "rtc slow clock internal RC, 136000.000Hz calibrated: the 32k
crystal did not start".
|
| bool | wall_slow_fell_back (wall_slow_src_t src, bool crystal) |
| | Whether the slow clock fell back from the crystal: the build asks for it and another source runs.
|
The panel's wall clock: whether it holds a real date, whether a file's stamp says anything, the time zones SETUP offers, the one NTP (Network Time Protocol) request a join makes, and the slow clock's console line.
The panel board (Waveshare ESP32-P4-WIFI6-Touch-LCD-7B) carries no RTC (real-time clock) chip. The ESP32-P4's own RTC timer keeps the system time across a software restart, counting the 32.768kHz crystal Y3 or, when that does not start, the internal RC oscillator; a power-on starts it at 1970-01-01 00:00:00 UTC (coordinated universal time). An NTP answer on the home network sets it. Until then the clock is uptime since 1970, and FatFs clamps such a stamp to 1980 (ESP-IDF's get_fattime()).
Nothing here reads a clock, a network or a card: every time is the caller's, so the host suite holds every rule. wall_local_s() reads the C library's time zone, which the panel sets from SETUP. The panel's end is firmware/panel/components/wifi_access/wifi_ntp.c and firmware/panel/main/panel_settings.c.
C and the C library's localtime_r(), no ESP-IDF (Espressif Internet-of-Things Development Framework).
SPDX-License-Identifier: MIT
| const char * wall_zone_posix |
( |
int | index | ) |
|
Time zone index as a POSIX TZ string, for setenv("TZ") and tzset(). The order is the SETUP row's (UI_OPTIONS(time_zone) in ui_text.def): UTC, London, Berlin, Helsinki, New York, Chicago, Denver, Los Angeles, Tokyo, Sydney.
- Parameters
-
| index | 0 to WALL_ZONE_COUNT - 1. |
- Returns
- The TZ string; Berlin's for an index out of range.