Skip to content

Releases

v0.1.4

v0.1.4 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 21 Sep 10:00

Release 0.1.4 (pre-release)

Overview

Targeted follow-up to v0.1.3 for one field bug: after the rapid-click
power-off freeze fix in v0.1.3, the confirming button release was still
occasionally not recognized
— the device stayed on the POWER OFF screen with
all buttons dead. This release closes the actual root cause in the button
driver, adds a recovery path, and fixes an adjacent threshold-boundary race.

Changes

Power-off release occasionally not recognized (root cause)

After the 3 s max-level long press fires, the driver breaks out of its
polling loop and parks its thread on the GPIO-edge semaphore, still holding
long_press_triggered until the physical release emits the confirming
BUTTON_RELEASE. Any edge that arrived during the hold (contact bounce,
the 1 s haptic motor's mechanical/EMI coupling — the same noise still faintly
audible in the mics) leaves a stale semaphore behind: the thread wakes
immediately, re-polls, sees the pin still pressed, and took the "new press"
branch — which clears long_press_triggered. The real release was then
classified as an ordinary click, BUTTON_RELEASE never fired, and the app's
power-off latch ate all further input: stuck on the power-off screen, dead
buttons, only recoverable by reboot.

v0.1.3's semaphore drain could not close this: the drain runs once at wake-up
entry, so edges arriving during the 3 s hold survive it and become exactly
these stale wakes.

Fix: while long_press_triggered is set (the "fired, waiting for the
confirming release" state), the driver no longer registers a new press on a
wake that sees the pin pressed — it just keeps polling. State-machine
invariant: the flag can now only be cleared by emitting BUTTON_RELEASE, so
the confirming release cannot be swallowed regardless of glitch source.

Stuck power-off screen: 3 s hold retries instead of bricking input

Defense in depth in the app's input gate: if the confirming RELEASE is ever
lost by some unforeseen path, the power-off latch previously ignored all
button input forever. A fresh max-level long press (LEVEL 1–3) is now allowed
through as a retry — re-arming the power-off confirmation instead of leaving
the device dead. Re-posting POWER_OFF_SHOW is idempotent.

3 s threshold-boundary race: hold-for-power-off could start a recording

The driver polls the button every 30 ms. A release landing in the poll gap
right after the 3 s mark (before the auto-fire poll caught it) was handled by
the level-0 deferred path and emitted BUTTON_RELEASE with the power-off
never triggered — so a deliberate 3 s power-off hold occasionally started a
recording
instead. The level-0 release path now fires the max-level
callback first when the held duration already crossed the max threshold, then
emits the release: the app sees the power-off level and the confirm in the
correct order.

Upgrade notes

  • App-only update over v0.1.x via BLE OTA or USB serial DFU as usual
    (mcumgr / nrfutil); see docs/usb_dfu.md.
  • After updating, verify the version string (0.1.4) via AT+INFO or the
    companion app.

Pre-release — published automatically by CI; promote to a full release
after verification.

v0.1.3

v0.1.3 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Sep 10:24

Release 0.1.3 (pre-release)

Overview

Accumulated fix round since v0.1.0, covering interaction latency, fuel-gauge
accuracy, display integrity, boot robustness, OTA input gating, and the
power-off flow — plus per-device identities in the test firmware, a Python
API sync, and a full documentation overhaul.

Interaction (button/AT):

  • Stopping a recording from the button confirms instantly (haptic +
    screen) instead of after the SD flush; the button driver no longer
    blocks on the event handler, which had frozen its 30 ms press-timer
    during the flush and could push an accumulated hold past the 3 s
    threshold into an unintended power-off. AT+STOP no longer plays a
    redundant third buzz; recording start no longer captures the haptic
    motor (capture waits for the motor to finish).

Fuel gauge:

  • Idle SoC no longer over-counts (~1%/20 min phantom at a 0.4 mA real
    draw): known idle current is fed during low-activity periods, the
    stale-state heal now actually discards a phantom-drained coulomb
    counter (it previously ran after the library had consumed the
    restored state), and the WiFi unseen-load compensation stays
    calibrated two-tier (AP idle 59 mA / transfer 99 mA). State persists
    every ~10 min under the battery mutex.
  • Charger-plug SoC jumps are gone (time-based display rate limit +
    transient hold), and unplugging a full charge holds 100% briefly
    instead of dropping to 99% within one poll. A 0%-at-healthy-voltage
    seed heals at boot.

Pre-release — published automatically by CI; promote to a full release
after verification.

Changes

Button stop-recording: instant feedback, no more mis-triggered power-off

Two related fixes to the long-press stop path:

  • Feedback now posts before the flush. The STOP handler previously ran
    the file flush (fs_sync on the SD card) before the confirmation buzz
    and screen update — on a busy card (e.g. transferring while recording)
    the buzz came hundreds of ms late and the stop felt laggy. The handler now
    fires the haptic pattern and UI update first; the flush completes behind
    them, hidden inside the ~300 ms double-buzz window.
  • The button driver no longer blocks on the event handler. STOP was
    posted synchronously from the button driver's 30 ms polling thread, so
    during the flush the press-duration accounting froze while wall-clock time
    kept running. On unblock, the accumulated hold time could jump past the
    3 s LEVEL_1 threshold and trigger an unintended power-off when the
    user pressed the button during the flush window. STOP is now posted
    asynchronously — the driver thread never blocks.
  • Haptic patterns moved to a dedicated low-priority thread (patterns are
    100–500 ms of k_sleep); every caller now returns immediately, so neither
    the event thread nor the button driver is ever held by the motor timing.
  • AT+STOP no longer plays a redundant third buzz: the AT handler used to
    add its own HAPTIC_SHORT after the event handler's HAPTIC_DOUBLE —
    previously masked by the old timing, it became a clearly separated extra
    buzz once feedback moved ahead of the flush. Stop feedback now comes from
    the event handler only (button and AT paths identical).
  • Six boot-banner log lines trimmed to offset the flash cost (the app region
    was at 99.97%); audio.c fixed the same .dt_flags truncation bug class
    as tests/clip (a gpio_dt_spec 16-bit flags field silently dropped
    GPIO_OUTPUT).

Battery: 0% displayed at a healthy voltage

A device left idle could wake up showing 0% while the cell measured
~4.0 V, and idle SoC dropped ~1% per 20 minutes (~7 mA-equivalent) at a
~0.4 mA real draw. Two independent causes, both in the logic around the
nRF Fuel Gauge library (the library usage itself matches Nordic's sample):

  • Idle over-counting: the 60 s poll fed ONE one-shot IBAT snapshot —
    taken while the CPU was running the poll itself (mA-level, and quantized
    at ~1.09 mA/LSB so true idle reads 0) — to the gauge as a constant for
    the whole 60 s. Nordic's guidance for low-power periods is that the idle
    current is known ahead of time: when not charging/recording/transferring,
    the configured CLIP_BATTERY_IDLE_CURRENT_UA (default 400 µA) is fed
    instead (and mirrored into nrf_fuel_gauge_idle_set()). Active periods
    keep using the real measurement.
  • Stuck-at-0 display: a phantom-drained seed plus the display's
    directional latch (anti-churn while discharging) locked the wrong value
    in until the next charge. Now (a) the boot heal discards a restored
    coulomb-counter state whose persisted seed is ≥20% below the boot-time
    voltage estimate — run BEFORE nrf_fuel_gauge_init() so the discard
    actually takes effect — and (b) while discharging, a ≥20% upward gap to
    the gauge catches up at the normal 3%/poll rate instead of being held.
  • WiFi unseen-load compensation stays two-tier and calibrated
    (AP up 59 mA / active transfer 99 mA): both are real current the NPM1300
    IBAT cannot see (nRF7002 is powered upstream of the sense resistor).
  • Fuel-gauge state is now also persisted periodically (every ~10 min, under
    the battery mutex) instead of only on displayed-value changes, so a
    reboot loses at most ~10 min of coulomb counting.

Battery display: no more charger-plug jump or post-full 99%

  • Plugging the charger no longer bumps the displayed SoC ~10% in seconds:
    the display rate limit is now TIME-based (3% per 60 s window regardless
    of how many polls fire), and for 2 minutes after the VBUS rising edge
    upward tracking is held while the fuel-gauge model re-anchors on the
    I*R-elevated charging voltage (not real charge).
  • Unplugging a fully charged device no longer drops 100% -> 99% within
    one poll: 100% is held for 10 minutes after unplugging from a completed
    charge (the ~99 is the termination plateau, not real discharge).

OLED: garbled frames, and AT+FACTORY leaving the "unsynced" indicator

  • Garbled screen ("sometimes"): the battery poll (system workqueue) and
    transfer-state updates rendered into the shared display buffer and
    drove I2C directly, racing the display thread. All cross-thread paths
    now only mutate state and post UI_EVENT_STATUS_REFRESH; rendering is
    single-writer on the display thread.
  • AT+FACTORY (and AT+PAIR=reset / AT+FORMAT) silently failed to format
    when the 45 s idle power-gate had unmounted the SD (-ENODEV was
    swallowed and the response still said success — recordings survived
    and the "unsynced audio" indicator returned after reboot).
    storage_format_card() now lazily remounts first, and a failed format
    is reported in the AT response. The FS log backend's open file is also
    released before formatting (debug builds).

Recording start no longer captures the haptic motor

The start-confirmation buzz's mechanical noise couples into the PDM mics
and was recorded at the beginning of AT-initiated sessions (and on fast
button releases / resume). The audio thread now waits for the motor to
finish (plus a short 50 ms ring-down margin) before powering the mics;
AT+START and RESUME buzz BEFORE capture begins.

Power-off rework: dedicated thread, motor guard, full recovery

The power-off path was rebuilt around a dedicated shutdown thread
woken by a direct semaphore (2048-byte stack, top priority) — it never
touches the 8-deep event queue. Rapid button spam used to fill that
queue; the POWER_OFF_EXEC event posted into it was dropped or delayed
behind the backlog while the input lockout was already latched,
freezing the device on the power-off screen with dead buttons
(reproduced 100% by spamming clicks then holding to power off).

  • Ship mode: 3 retries with 100 ms spacing; on total failure the
    device FULLY recovers (failsafe disarmed, input unlocked, UI back
    to the status bar, poweroff:failed BLE notify).
  • 8-second failsafe is a k_timer (not a work item) — fires from the
    clock ISR, no dependency on any thread or workqueue being schedulable.
  • AT+POWEROFF refuses while charging (the PMIC will not enter ship
    mode on VBUS) instead of pretending to shut down.
  • Haptic motor guard: a 1.2 s one-shot timer cuts the motor GPIO
    directly from the clock ISR if the haptic thread stalls or dies
    mid-pattern — the motor can no longer run away until power-off.
    Haptic thread stack 512 -> 1024, priority PREEMPT(10) -> PREEMPT(4),
    queue depth 2 -> 4.
  • Transfer cancel is flag-only (the old bounded wait could deadlock
    against the SD lifecycle mutex); recording stop kept (file integrity).

Boot reliability, OTA input gating

  • SD boot-mount retry: the LDO2 ramp plus card-internal init can
    exceed the 10 ms settle on some cards/temperatures; a failed boot
    mount skipped the one-shot unsynced-audio check, so after a reboot
    the UI sometimes missed existing recordings. storage_init() now
    retries (growing delay, 4 attempts).
  • Buttons now truly dead during OTA: the previous fix checked
    CLIP_STATE_OTA — but the transition table never enters that state
    during an upload, so the guard never fired. Input gating now checks
    the MCUmgr DFU flag (clip_event_ota_in_progress()); the unguarded
    3 s power-off path can no longer abort an update mid-upload/swap,
    and clicks no longer switch the UI away from the progress screen.
  • Power-off flow: shutdown ignores all button input from the
    confirming release (presses used to pop the status bar over the
    power-off screen or race a START before power was cut); the
    confirmation buzz overlaps the cleanup instead of a serial 400 ms
    sleep; transfer-cancel bound tightened to 1 s; and the redundant
    fuel-gauge save is skipped when the POWER_OFF_SHOW-triggered save
    already persisted it (the settings rewrite costs ~1 s and was
    doubling the shutdown delay). Release-to-power-cut is now ~800 ms
    with the POWER OFF screen held until power actually dies.

Test firmware: per-device identity for production jigs

tests/clip derives ...

Read more