feat: add silent NTP time sync on boot via saved WiFi credentials

New "Auto Sync on Boot" toggle in Clock Settings. When enabled, a
background FreeRTOS task scans for saved WiFi networks at boot,
connects, syncs time via NTP, then tears down WiFi — all without
blocking boot or requiring user interaction. If no saved network is
found after two scan attempts (with a 3-second retry gap), it bails
silently.

Conflict guards (BootNtpSync::cancel()) added to all WiFi-using
activities so the background task cleans up before any user-initiated
WiFi flow. Also fixes clock not appearing in the header until a button
press by detecting the invalid→valid time transition after NTP sync.

Made-with: Cursor
This commit is contained in:
cottongin
2026-02-26 18:21:13 -05:00
parent 2eae521b6a
commit 19b6ad047b
22 changed files with 227 additions and 2 deletions

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Text stavového řádku"
STR_INDEXING_STATUS_ICON: "Ikona stavového řádku"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -364,6 +364,7 @@ STR_INDEXING_STATUS_TEXT: "Status Bar Text"
STR_INDEXING_STATUS_ICON: "Status Bar Icon"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"
STR_MANAGE_BOOK: "Manage Book"
STR_ARCHIVE_BOOK: "Archive Book"
STR_UNARCHIVE_BOOK: "Unarchive Book"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Texte barre d'état"
STR_INDEXING_STATUS_ICON: "Icône barre d'état"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Statusleistentext"
STR_INDEXING_STATUS_ICON: "Statusleistensymbol"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Texto da barra"
STR_INDEXING_STATUS_ICON: "Ícone da barra"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -318,3 +318,4 @@ STR_EMBEDDED_STYLE: "Stil încorporat"
STR_OPDS_SERVER_URL: "URL server OPDS"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Текст в строке"
STR_INDEXING_STATUS_ICON: "Иконка в строке"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Texto barra estado"
STR_INDEXING_STATUS_ICON: "Icono barra estado"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"

View File

@@ -343,3 +343,4 @@ STR_INDEXING_STATUS_TEXT: "Statusfältstext"
STR_INDEXING_STATUS_ICON: "Statusfältsikon"
STR_SYNC_CLOCK: "Sync Clock"
STR_TIME_SYNCED: "Time synced!"
STR_AUTO_NTP_SYNC: "Auto Sync on Boot"