Skip to content

perf(battery): increase gauge sleep measurement intervals to 60 seconds - #291

Merged
TobiasRoeddiger merged 1 commit into
2.2.10from
codex/gauge-sleep-measurement-60s
Sep 29, 2026
Merged

TobiasRoeddiger merged 1 commit into
2.2.10from
codex/gauge-sleep-measurement-60s

Conversation

@TobiasRoeddiger

@TobiasRoeddiger TobiasRoeddiger commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

The BQ27220 periodically measures while the earable is off. Set its SLEEP voltage/temperature and current measurement intervals to 60 seconds instead of the 20-second defaults, reducing the measured average off-state current by about 1.6–1.9 µA (4–5%).

This adds only the two adjacent one-byte settings at 0x921E and 0x921F to the existing gauge setup transaction. Normal-mode measurement timing is unchanged. Sleep readings update less frequently, so changes detected through those measurements can take longer to appear. The standard FOTA configuration applies gauge setup when confirming a new image.

Power validation

Rechecked the archived raw PPK2 captures and their SHA-256 hashes before creating this PR:

Comparison 20-second intervals 60-second intervals Saving
Matched 240-second windows 38.055 µA 36.180 µA 1.874 µA (4.93%)
Repeat, matched 120-second windows 38.085 µA 36.476 µA 1.609 µA (4.22%)

The sequence was 60 s → restored 20 s → repeated 60 s. Same Main v2.7 device, PPK2 source at 3.7 V replacing the battery, device USB disconnected, 100 ksample/s and matching filter settings. All samples, including measurement pulses, contribute to the means. The MCU entered OFF without an active debugger; retained journals were complete and recorded no spontaneous application wakes. Full captures were saved before endpoint debug access.

These measurements used the P0.6-fixed diagnostic reference firmware with the interval bytes changed in gauge RAM and read back. They establish the saving from the settings; they are not measurements of this PR's firmware binary. The P0.6 change is released separately as 2.2.9 in #294 (original fix: #290). No other gauge configuration changes are included here.

Registers and sleep sampling behavior: TI BQ27220 technical reference manual, data-memory table and §§4.9.54–4.9.55.

Build validation

  • Clean FOTA sysbuild passed for openearable_v2/nrf5340/cpuapp using nRF Connect SDK 3.0.1 (-DFILE_SUFFIX=fota, explicit worktree BOARD_ROOT).
  • Compiled driver inspection confirms a two-byte 3c 3c write at 0x921E.
  • git diff --check passed.

This PR now targets 2.2.10; it remains limited to the same six added driver lines. Historical build and power results above predate the release-branch reorganization.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

✅ Unit tests passed

2 passed, 0 failed/error, 0 skipped — view workflow run

Test scenario Platform Result
sensor_component/openearable.unit.sensor_component native_sim/native/64 ✅ passed
ring_buffer/openearable.unit.ring_buffer native_sim/native/64 ✅ passed

Download the unit-test-results artifact for full Twister reports and logs.

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Compiler warnings

The extended-warning build completed successfully.

Application compiler warnings

None.

View this workflow run

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

CodeChecker static analysis (advisory)

Note

This report is informational. It does not block merging and does not change code.

At a glance

Scope Result
Findings on lines changed by this PR 0
Findings in the complete codebase 2
Analyzer invocations completed 162
Analyzer invocations failed 0

Findings on changed lines

No non-style findings were reported on lines changed by this PR.

Analyzer coverage

Analyzer Completed Failed
clangsa 81 0
cppcheck 81 0

Complete-codebase summary

Severity: 2 high
Reported by analyzer: clangsa: 2

Complete-codebase findings

Each finding includes source context. The > line and carets identify the expression reported by the analyzer.

Show detailed findings with source context (2 of 2)
HIGH — src/SensorManager/BMX160/bosch/bmi160.c:2507 — The left operand of '&' is a garbage value
  2506 |             /* Set the FOC config for gyro */
> 2507 |             data = BMI160_SET_BITS(data, BMI160_GYRO_FOC_EN, foc_conf->foc_gyr_en);
       |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2508 | 
HIGH — src/SensorManager/BMX160/bosch/bmi160.c:5492 — The left operand of '&' is a garbage value
  5491 |     rslt |= bmi160_get_regs(addr, data, 2, dev);
> 5492 |     data[1] = data[1] & BMI160_FIFO_BYTE_COUNTER_MASK;
       |               ^^^^^^^
  5493 | 

Open the workflow run and download the complete CodeChecker report for a detailed view. Check out codechecker.html/index.html.

@TobiasRoeddiger TobiasRoeddiger mentioned this pull request Sep 28, 2026
@TobiasRoeddiger
TobiasRoeddiger changed the base branch from main to 2.2.10 September 28, 2026 05:18
@TobiasRoeddiger
TobiasRoeddiger force-pushed the codex/gauge-sleep-measurement-60s branch from 64d27d0 to 020ef51 Compare September 28, 2026 05:19
@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@TobiasRoeddiger
TobiasRoeddiger merged commit 88b343d into 2.2.10 Sep 29, 2026
4 checks passed
@TobiasRoeddiger
TobiasRoeddiger deleted the codex/gauge-sleep-measurement-60s branch September 29, 2026 09:16
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