Skip to content

fix(sensors): make CPU temperature single-writer - #125

Open
zjwhitehead wants to merge 2 commits into
masterfrom
codex/cpu-temp-single-writer
Open

zjwhitehead wants to merge 2 commits into
masterfrom
codex/cpu-temp-single-writer

Conversation

@zjwhitehead

Copy link
Copy Markdown
Member

Summary

  • make ctrlSensorTask the sole runtime owner of ESP32 temperature-sensor reads
  • prime the cache during single-threaded startup
  • publish the cached float atomically for cross-core monitor readers
  • keep getCachedCpuTemperature read-only so monitoring can never reconfigure tsens

This is the remaining useful CPU-temperature portion of #114, rebuilt on current master. The SPI/LVGL portions of #114 are already present on master.

Validation

  • ESP32-S3 production target build: PASS
  • native unit tests: 60/60 PASS
  • native screenshot tests: 34/34 PASS
  • cpplint: PASS

Hardware acceptance

  • boot with display, BLE, and monitoring enabled and confirm no tsens reconfiguration errors
  • confirm CPU temperature is plausible and refreshes approximately once per second
  • exercise reboot and OTA paths

PaulDWhite added a commit that referenced this pull request Oct 31, 2026
Keep #125's single-writer CPU temperature in ctrlSensorTask, and feed the
climb-power estimator from the barometer snapshot (a stale or missing
sample is a gap, as before).
PaulDWhite added a commit that referenced this pull request Oct 31, 2026
QC runs before barometerTask and the monitor start, so after #125/#126 its
baro check would read an unpublished snapshot (always FAIL) and its CPU
check the unprimed 0 C cache (always PASS). Sample both directly while
setup() is still single-threaded. Move QC timing onto timeMillis().
Conflict in system_monitors.cpp was only master's millis() ->
timeMillis() rename (5b64992). Keep this branch's prime/refresh/get
split, using timeMillis().

Verified: firmware builds, native-test 56/56.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zjwhitehead added a commit that referenced this pull request Nov 9, 2026
Brings in LVGL 9.6.0 (#136), the patch bumps (#135) and the ESP-IDF
time shim (5b64992).

- system_monitors.cpp, ota_service.cpp: keep this branch's single-writer
  CPU temp (#125) and deferred OTA reboot (#132); conflicts were only
  master's millis() -> timeMillis() rename.
- Remaining millis()/delay() calls added on this branch (OTA, settings
  progress loop, thermal headroom, climb efficiency) use timeMillis()/
  timeDelay(), like the rest of master.
- Fonts: reorder the seven montserrat_hinted_* lv_font_t initializers
  for LVGL 9.6 (dsc/fallback/user_data first; C++ needs declaration
  order). tools/fonts/gen_hinted_fonts.py still emits the old order.
- Screenshot references regenerated from the merged tree; all 34 are
  byte-identical to this branch's previous references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant