refactor(companion): shared shutdown steps, SD channel key by secret, fetch race, small UI fixes

- UITaskBase holds what both UIs' shutdown() and low-battery check share:
  the saves before the goodbye sound, the power-down (GPS through its
  provider) and the battery EMA and threshold.
- L2 SD archive: a channel's file is keyed by its secret only, so renaming
  keeps the history; old files are renamed once at boot.
- L2 fetch: abandoning a request and the task finishing it are one critical
  section (it could stay DONE for good); TileCache gets the read-side barrier.
- Text from a repeater or sensor no longer rings on the device (nothing to
  open); a settings switch reads any non-zero value as on; the message
  toast never cuts a letter in half; ui-new's GPS helpers ask UiCore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-12 18:08:31 +02:00
co-authored by Claude Opus 5.5
parent 28d8291e33
commit 01a068be7d
8 changed files with 82 additions and 65 deletions
@@ -73,6 +73,9 @@ public:
struct Done { int z; int32_t x, y; TileProvider* src; bool overlay_missed; };
bool poll(Done& done) {
if (_job_state != JOB_DONE) return false;
#if defined(ESP32)
__sync_synchronize(); // pairs with runJob()'s: the state before the results it covers
#endif
done = { _job.z, _job.x, _job.y, _job.src, _job.overlay_missed };
bool keep = !_job_stale;
if (keep && !_job.present) { // remember the miss without holding a buffer slot