🚀 SomnoTrace v4.1.0-beta8
🚨 Important — please update from beta7 immediately
This hotfix release resolves a critical regression introduced in v4.1.0-beta7. If you are running beta7 and use direct BLE connection to an AirSense 11, update as soon as possible: beta7 could reboot mid-therapy and lose portions of the night's data. Users on beta5 or earlier, or running exclusively via SomnoBridge, were not affected.
🐛 Fixes
- 🔴 Fixed mid-therapy panic reboots (beta7 regression): the storage task's 8 KiB stack was too small for the new SNTv4 gzip compression path added in beta7 — the ESP32-S3 ROM compressor alone nests ~8 KB of stack frames, so the first interrupt arriving during a 30-second commit tripped the stack watchpoint (
PANIC (4)) and rebooted the device, repeating every few minutes for the rest of the night. The storage task now runs with a 24 KiB PSRAM stack (~3× worst-case headroom), matching the other SNTv4 writer tasks. - 🔵 Fixed AirSense 11 reconnect attempts being burned by oximeter scans: the oximeter driver's 4-second background scan (every 15 s) could grab the BLE radio exactly when an AS11 reconnect attempt fired, failing it instantly with
BLE_HS_EBUSY. Oximeter scans are now deferred while any AS11 connect/reconnect is active (including backoff between attempts), the AS11 connect path cancels competing scans first, waits for in-progress connects to clear, retries once onEBUSY, and connect failures now log the real NimBLE status/rc codes (connect start failed (rc=N),connection failed (status=N)) instead of unhelpful generic messages. - 🛡️ Latent stability fix: the SNTv4 gzip compressor mutex was heap-allocated inside a critical section on first use; it is now statically allocated, eliminating a potential memory-corruption hazard under memory pressure.
💡 Notes
- No changes to the BLE protocol, file formats, or upload pipelines — safe to update over the air.
- If your AirSense 11 still refuses connections after updating, power-cycle it once (or toggle airplane mode): its single BLE slot may still be held from an unclean disconnect caused by the beta7 crashes.
✨ Highlights
- 📦 SNTv4 Stream Format & Project S Support: Introduced the new SNTv4 binary stream container for CPAP (
_overview.snt,_flow.snt) and oximetry (vitals.snt,raw_ppg_*.snt), with multi-member gzip support, robust trailer parsing, and strict SNTv4 validation for Project S uploads. - ⚡ Much Faster Web Portal & APIs: Added PSRAM caching with background refresh for
/api/daysand/api/oximetry/days, O(1) date-hinted oximetry lookups, and build-time gzipped web assets withETag(304 Not Modified) caching — cutting multi-second page and day-list loads down to milliseconds. - 🎯 Rock-Solid 1 Hz Live PPG & Accurate Sleep Staging: Fixed Gen1 1 Hz polling drift and BLE interval negotiation (
15–20 ms, adaptive0x1Cdrain budget), added a drain deadline to Gen2 polled fallback, and smoothed single-second jitter slips — eliminating the ~22–25% scattered 1-second dropouts that caused SomnoStage to misclassify sleep as mostly Wake with missing REM. - 🚶 Seamless Toilet-Break & Edge-of-Range Recovery: Gen1 no longer hits a 130 s reconnect curfew while resuming a paused live night or closes/reopens SD files on a single transient BLE packet error; Gen2 now applies the full 12 s off-finger debounce on reconnect, attempts an auto-stream re-arm on 5 s stalls before falling back to polling, and both drivers preserve the first half of the night if a resume open fails.
- 💓 Clean Perfusion Index (PI%) Graphs: Switched
pi_pctto use the O2 ring's own 1 Hzpi_rawreading directly instead of unfiltered raw-IR calculations, eliminating false 50–100% motion/AGC spikes (with a UI spike guard for older recordings too).
🐛 Fixes & Polish
- 🩺 Accurate Oximetry Diagnostics: Fixed the lingering
"1 downloaded but awaiting conversion"banner by scoping diagnostics to the selected night and automatically reconciling staleindex.jsonconversion flags. - ☁️ Smarter BreathingRoom & Upload Progress: Oximetry snippets rejected by BreathingRoom as
"recording too short"are now cleanly skipped instead of retrying every 24 hours, and backends with only parked/skipped items now showUp to date (N skipped) ✓rather than misleadingpendingcounts. - 🛡️ Stability & CI Hardening: Added channel bounds checks during SNTv4 EDF import flushing, cleaned up background cache refresh handling, and resolved static-analysis (
cppcheck) and mutation-test findings.