Commit Graph

3465 Commits

Author SHA1 Message Date
Jakub
e7e910782c fix(build): tolerate control chars in pio project config JSON dump
get_platform_for_env() in build.sh parses `pio project config
--json-output` with Python's strict json.load(), which rejects literal
control characters inside string values. Depending on the installed
pio version, a build_flags value can embed one there, breaking
env-name lookup with "Invalid control character" before the actual
build even starts. strict=False accepts it, same as a lenient JSON
consumer would for a non-conforming producer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 01:50:28 +02:00
Jakub
4999620fba fix(repeater): close radio-profile bypass paths, dedupe preset/BW logic
CMD_SET_RADIO_PARAMS and the on-device Settings radio editors
(Freq/SF/BW/CR/Preset) called radio_driver.setParams() directly instead
of applyRepeaterRadio(), so editing the companion's own radio params
while relaying on a dedicated profile silently retuned the live radio
off that profile. Both now route through applyRepeaterRadio(), the
single decision point already used at boot and by the on-device
repeater toggle.

Also: overhear-suppression matched queued packets by payload hash
alone, so it could cancel a queued direct-route retransmit that
happened to share a hash with an overheard flood packet — now scoped
to flood-queued entries only. repeaterProfileValid()'s frequency floor
(100 MHz) is raised to 150 MHz to match the radio's actual validated
range. RepeaterScreen's preset-name lookup now uses the same
epsilon-tolerant float comparison as Settings instead of exact ==,
avoiding inconsistent "Custom" labeling between the two screens.

Dedupe: the BW-options table, the value-column x-offset math, and the
default-profile-seeding block had each drifted into two or three
independent copies (RepeaterScreen vs Settings, MyMesh constructor vs
DataStore.cpp upgrade path); factored into shared helpers in
RadioPresets.h / NodePrefs.h.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 01:50:21 +02:00
Jakub
afe7b8a0ca feat(repeater): default network profile, band-matched to companion freq
Enabling the repeater now defaults to a dedicated radio profile rather
than relaying on the companion's current frequency: same-network
repeating isn't the MeshCore community norm. The default profile is
seeded with a frequency in the same legal band as the companion's own
network (433/868/915 MHz, via defaultRepeaterFreqForBand()) rather than
a flat firmware constant, so it can't land outside what's allowed for
the operator's region.

Also fixes a gap where a true first boot (no prefs file yet) never hit
the DataStore.cpp migration fallback and stayed on repeater_use_profile=0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 01:04:35 +02:00
Jakub
aba924bac9 fix(diag): real heap-free via mallinfo, flush-align Errors row
sbrk(0)-high-water counted freed-and-recycled blocks as permanently
used, understating free heap. mallinfo().uordblks reflects bytes
actually outstanding. Also strip the trailing space from the decoded
error-flag string so right-alignment sits flush.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 23:00:40 +02:00
Jakub
11a3799a47 fix(repeater): hide name-bar power readout while APC is suppressed
The name-bar live-power readout was gated on the raw tx_apc pref, so after an
upgrade with Auto pwr previously on, it kept showing a power value while the
repeater was active — looking like APC was running even though it's forced off
and power is pinned to the ceiling. Gate it on apcActive() instead (now public),
matching the "--" lock in Settings. The radio page's TX line still shows the
actual power, as before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 14:53:15 +02:00
Jakub
885662beae feat(repeater): suppress Adaptive Power Control while relaying
A repeater wants full, consistent TX power for relay reach, and APC's feedback
(own ACKs / own flood echoes) never fires on forwarded traffic — so leaving APC
on would relay at whatever reduced power it last trimmed to, or sit inert on a
dedicated repeater network. Force it off whenever client_repeat is on, mirroring
the power-save lock:

- apcActive() = tx_apc && !client_repeat gates every APC control site
  (sample/failure/track).
- applyApc() pins power to the tx_power_dbm ceiling; called at boot, on the
  on-device repeater toggle, and on the app's CMD_SET_RADIO_PARAMS.
- Settings "Auto pwr" shows "--" and blocks the toggle while repeating; the
  user's pref is preserved and restored when the repeater is switched off.

Also refreshes the FEATURES repeater entry (Hold-Enter reset, Errors row, schema
0x10, the radio-setting locks and status indicator).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 14:45:34 +02:00
Jakub
84a76adcf1 feat(repeater): status-bar indicator, power-save lock, diag polish
- Status bar: blinking » indicator while relaying (new ICON_REPEATER), added to
  the 1 s blink cadence alongside the advert/trail markers.
- Power-save lock: a repeater must hear all traffic, so duty-cycle RX is forced
  off whenever client_repeat is on. Effective state = rx_powersave && !repeat,
  applied at boot, in applyPowerSave(), on the on-device toggle, and on the app's
  CMD_SET_RADIO_PARAMS. Settings shows "--" and blocks the toggle while repeating;
  the user's pref is preserved and restored when the repeater is switched off.
- Diagnostics: reset now uses the standard Hold-Enter one-item action menu (Back
  dismisses) instead of an Enter/Cancel popup; new "Errors" row decodes the
  Dispatcher ERR_EVENT_* flags (F/C/R, or OK).
- RepeaterScreen: drop the live stats block (they live on Diagnostics).
- Min-SNR load clamp tightened to the UI's -20..10 range.

Docs updated (settings_screen, tools_screen, FEATURES).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 14:05:00 +02:00
Jakub
0da487729d feat(repeater): dedicated Tools screen + optional radio profile
Move the repeater controls out of Settings > Radio (where the indented sub-item
labels collided with the value column on a 128px OLED) onto their own full-width
Tools > Repeater screen, holding the toggle, the five flood-politeness filters,
and live forwarding stats (Forwarded / Pool free / Queue) together. Toggle text
standardised to ON/OFF throughout.

Adds an optional dedicated radio profile (Network: Current/Custom): enabling the
repeater can switch the radio to a preset/manual freq/bw/sf/cr and disabling
restores the companion's params (revert-on-disable). A profile equal to the
companion = same network; a different one = drop onto a separate repeater
network. MyMesh::applyRepeaterRadio() is the single decision point (boot + every
toggle/edit), gated by repeaterProfileValid(); the profile re-applies after a
reboot left with the repeater on. Persisted behind schema 0xC0DE0010, cleared to
off when an upgraded file yields an invalid config.

Docs updated (settings_screen, tools_screen, README, FEATURES).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 09:20:16 +02:00
Jakub
22ad46257f docs: document repeater politeness knobs and Diagnostics screen
- settings_screen: full Radio section (Preset/Freq/SF/BW/CR/Repeater were
  undocumented), plus the five flood-only politeness sub-items.
- tools_screen: new Diagnostics section (per-type counters, heap/stack, radio,
  pool/queue, Forwarded, reset popup).
- README + FEATURES: mention diagnostics; FEATURES gets a full repeater entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 08:40:53 +02:00
Jakub
d790f7e5cd feat(repeater): overhear suppression — cancel queued retransmit if a peer relays first
When enabled (Settings > Radio > Suppress dup), a received flood packet whose
hash matches one still waiting in the outbound queue cancels that queued
retransmit: another node already relayed it, so this node stays quiet. Cuts
redundant airtime in dense meshes; pairs with Yield (longer delay = wider window
to overhear a peer first).

- Dispatcher: wantsOverhearSuppress() hook (default off) + suppressQueuedDuplicate()
  scan over the outbound queue by packet hash; onRetransmitCancelled() hook.
- Mesh: overrides onRetransmitCancelled() to back out n_forwarded so the count
  reflects what actually goes on air. resetStats() already covered.
- Flood-only and hash-matched (payload hash ignores path for non-TRACE, so our
  copy and the peer's relayed copy hash equal). Own sends can't be overheard
  before their first TX, so suppression only ever cancels forwards.
- New repeat_suppress_dup pref, schema sentinel 0xC0DE000F, stray-byte clamp.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 23:51:01 +02:00
Jakub
e213ff6efb feat(repeater): politeness knobs in Settings (skip-advert, max-hops, yield, min-SNR)
Four opt-in filters, all default off, consulted only when the repeater is on
(MyMesh::allowPacketForward) and shown under Settings > Radio only while it is:
- Skip advert: don't re-flood ADVERT packets (highest-volume flood traffic).
- Max hops: drop a flood packet once it has travelled N hops.
- Yield: scale the FORWARDED flood retransmit delay so a mobile companion
  defers to better-sited fixed repeaters; never touches the node's own sends.
- Min SNR: drop a flood copy received below a dB threshold so marginal fringe
  traffic isn't re-flooded.

All four are flood-only — on a direct route this node is the named next hop, so
dropping there would kill delivery. Persisted behind a new schema sentinel
(0xC0DE000E) with stray-byte clamps; min-SNR uses a -128 "disabled" sentinel so
an upgraded file can't read as "filter at 0 dB".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 23:44:36 +02:00
Jakub
f55b869fbe feat(diag): reset-counters popup; harden repeater loop-detect bounds
- DiagnosticsScreen: Enter opens a confirm popup (defaults to Cancel) that
  zeroes the cumulative counters via Mesh::resetStats().
- Dispatcher::resetStats() made virtual; Mesh overrides it to also clear
  n_forwarded so the reset covers the repeater forward count.
- REPEAT_LOOP_MAX gains a 4-byte-hash entry and isRepeatLooped() bounds-
  checks hash_size, so it can't OOB-read if path_mode 3 is ever accepted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 23:34:06 +02:00
Jakub
d1d64dc612 feat(mesh): track actually-forwarded packet count, show in Diagnostics
allowPacketForward() only gates permission; the packet can still be
dropped afterward (hasSeen(), path-size limit). Add Mesh::n_forwarded,
incremented at the 3 ACTION_RETRANSMIT_DELAYED return sites, so the
Diagnostics screen can confirm a repeater is actually relaying traffic
rather than just being configured to.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 23:20:23 +02:00
Jakub
72bc4ee895 Merge branch 'main' into feature/companion-repeater-presets 2026-06-18 22:54:05 +02:00
Jakub
327e659d51 feat(ui): add on-device diagnostics screen (Tools > Diagnostics)
Shows packet counts by category (RX/TX), radio noise floor/RSSI/SNR,
packet-pool free count and outbound queue length, uptime, and heap/stack
headroom on a single scrollable screen.

Adds generic per-payload-type RX/TX counters to Dispatcher (mesh layer),
plus pool-free/queue-length getters, and a new DeviceDiag helper for
nRF52 heap (linker-symbol + sbrk) and stack (FreeRTOS high-water-mark)
stats — the only platform needed for the 3 in-scope boards (Wio Tracker
L1 OLED/Eink, GAT562 30S), all nRF52840.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:34:52 +02:00
Jakub
601606faa8 feat(companion): digit-by-digit Freq editor, scroll-indicator halo cleanup, channel-unread fix
- New DigitEditor.h: standalone, reusable LEFT/RIGHT-cursor + UP/DOWN-spin
  numeric editor. Replaces Freq's fixed ±0.025MHz nudge, which carried each
  preset's own fractional offset forever, landing on a different unpredictable
  grid depending which preset you started from. Every digit (hundreds down to
  thousandths) is now directly addressable. SF/BW/CR are unchanged (small
  discrete sets, plain left/right cycling is fine there).
- icons.h: drop the scroll-indicator's DARK contrast halo. Every caller
  already keeps its selection bar clear of the indicator column (reserve/
  _reserve), so the halo was never actually needed for contrast — and the
  bottom arrow's halo had no clip symmetric to the top one, so it bled 1px
  into the popup's bottom border.
- QuickMsgScreen.h: updateChannelUnread() now marks everything in the
  rendered visible window as read, not just the highlighted row — a taller
  screen that fits more message boxes at once should mark more read up
  front. Also drops a premature call at CHANNEL_HIST entry that ran before
  the channel's own render() had computed _hist_visible, which could ratchet
  _viewing_max_seen past what was actually shown (that field is shared with
  DM_HIST and stale until this channel's first render).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 20:04:37 +02:00
Jakub
243a11e6bc Merge branch 'main' into feature/companion-repeater-presets 2026-06-18 18:10:48 +02:00
Jakub
99cbe51797 fix(ui): popup selection bar stops before the scroll-indicator gutter
Matches every other list (drawList's row width - reserve): the highlight
shouldn't paint over the indicator's column, just frame it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 18:06:59 +02:00
Jakub
21c4539f39 Merge branch 'main' into feature/companion-repeater-presets 2026-06-18 18:01:33 +02:00
Jakub
2560ec4cef fix(ui): scale compass tape ticks/pointer for e-ink
Tick marks, the scale baseline and the travel-direction pointer triangle
were hardcoded pixel constants, so they shrank to near-invisible slivers
next to the 2x cardinal labels and numeric readout on landscape e-ink.
Same fix pattern as the trail map / keyboard separator: derive sizes from
miniIconScale()/sepH() instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 18:00:14 +02:00
Jakub
b85522b2c2 fix(ui): popup menu uses the shared scroll indicator, not raw ^/v glyphs
PopupMenu drew its own unscaled ^/v text markers instead of the
track+thumb indicator the rest of the UI uses, so it didn't show position/
proportion and looked inconsistent on e-ink. drawScrollIndicator(Px) assumed
a full-width list (anchored to d.width()), which doesn't hold for a centred,
narrower popup box — added a right_x-aware overload so it can anchor to the
box's own edge instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 18:00:06 +02:00
Jakub
46263fe247 feat(companion): delete saved presets, align app-driven repeat with on-device toggle
- Radio Preset popup: "+ Save current..." moved to the top of the list; add
  "- Delete preset..." (shown only when a saved preset exists) which opens a
  sub-list of just the saved presets and clears the picked slot.
- CMD_SET_RADIO_PARAMS no longer requires repeat=1 to land on one of the
  three dedicated repeat_freq_ranges bands — none of the 16 built-in presets
  matched those exactly, so app-driven repeat would either get rejected or
  silently retune away from the user's chosen frequency. Commented out
  (not deleted) so the old behaviour can be restored if needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 17:42:41 +02:00
Jakub
056a786fc8 feat(companion): repeater mode, radio presets, and manual RF tuning in Settings
Settings > Radio gains:
- Repeater toggle — turns on flood forwarding (client_repeat) on the current
  operating frequency, with loop-detection and an 8-hop advert cap ported
  from simple_repeater's allowPacketForward.
- Packet pool bumped 16->32: forwarding's queued retransmits were starving
  Dispatcher::checkRecv()'s allocNew(), silently dropping incoming DMs and
  channel messages while repeating.
- Preset picker (16 community-suggested region presets) plus manual
  Freq/SF/BW/CR fields for fine-tuning. Freq bounds come from the radio
  driver's own RadioLib-validated range (SX1262: 150-960MHz) instead of a
  guessed sanity bound.
- Save current radio settings as a named user preset (4 persisted slots),
  alongside the built-in list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 17:23:30 +02:00
Jakub
1bf90ed2fb fix(ui): drop popup menu's header gap, tighten row tiling
PopupMenu is compact and stands alone (no full-screen header to separate
from), so the gap meant for listStart() just wasted vertical space and let
the selection bar's edges miss the box border by a few px.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 15:33:18 +02:00
Jakub
92643d1721 fix(ui): scale trail-map markers for e-ink, add wrap-around nav
Trail map dots/diamonds/cross/start markers and the north indicator were
drawn as raw unscaled pixels, so they shrank to near-invisible specks on
landscape e-ink's larger font scale; they now route through the mini-icon
framework (icons.h) like the rest of the UI, and the grid intersection dots
scale with it too. The keyboard's preview/grid separator had the same bug
(hardcoded 1px) and now uses display.sepH().

Also makes UP/DOWN (and the keyboard's LEFT/RIGHT/UP/DOWN) wrap top<->bottom
across every list, menu and form selector, matching the behavior PopupMenu
already had.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 09:16:57 +02:00
Jakub
2136e959d4 fix(ui): gap below header separator, one method everywhere
Content drawn under the title separator touched the line on every standard
screen, because listStart() == headerH() (the row right after the separator).
Graphical screens worked around it with a hand-rolled hdr+2.

Bake a 2px breathing gap into listStart() so every list gains it at once, and
switch the screens that hand-rolled the offset (Compass, Nav, Nearby detail) to
listStart() so the content top is computed the same way everywhere.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 21:35:51 +02:00
Jakub
e5ff2de3e4 fix(ui): self-sizing popup menu, scaled for landscape e-ink
The popup menu used fixed pixel constants (box width, item height, text
positions) sized for the OLED 128x64. On landscape e-ink the font is ~2x, so
rows overlapped, text ran past the box edge, and the box never adapted to its
contents.

Rebuild render() from live font metrics: box width fits the widest title/item
(clamped to the screen, centred), row height and title bar derive from the line
height, items and title are ellipsized so nothing overflows, and the scroll
arrows live in a reserved gutter. The title separator uses the scaled sepH()
with a 2px gap before the first row so content no longer touches the line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 21:35:40 +02:00
Jakub
fee4182ffa fix(prefs): persist joystick rotation on e-ink builds
The joystick rotation setting never survived a reboot: loadPrefsInt cleared it
on every load. The post-read override guarded on FEAT_JOYSTICK_ROTATION_SETTING
(and JOYSTICK_ROTATION), but DataStore.cpp included neither Features.h nor the
macro's header, so both were undefined — `#if !FEAT_JOYSTICK_ROTATION_SETTING`
was always true and the stored value was forced back to 0 every time.

Include Features.h so the flag resolves per build, and only force the default
when the setting isn't user-editable (OLED). On e-ink the stored value is now
kept; stale values migrated from another build are still corrected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 21:35:30 +02:00
Jakub
7a1f19dd6f ci(solo): attach nRF52 OTA DFU zip to release assets
The solo build already copies firmware.zip (the adafruit-nrfutil DFU package
used for OTA / BLE-DFU updates) into out/, so it was present in the Actions
artifact but never in the tagged GitHub Release. Give it a friendly name
(solo-<ver>-<device>-ota.zip) and include out/*.zip in the release files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
v1.18.1 v1.19
2026-06-16 09:54:58 +02:00
Jakub
8006049e2a fix(ui): pin DM/channel history scrollbar track, stabilize thumb + gutter
Portrait e-ink message history had two scrollbar glitches:

- Track length tracked the last visible box's bottom, so a long message at
  the bottom that left empty space shrank the whole bar. Pin the track to the
  full list area (hist_start_y..cby); only the thumb sizes/moves.
- Thumb size was derived from the per-frame visible-box count, which fluctuates
  with variable-height boxes. Drive it off pixel sums with a constant viewport
  (view_px = track_h) so the thumb stays stable while scrolling one list.
- Gutter reserve used last frame's _hist_visible, so an incoming message briefly
  toggled the gutter and reflowed box widths. Decide it from a whole-list fit
  test at the widest layout instead — stable, no flicker.

Unify both fixes in computeHistScroll() (shared by DM + channel views) and
split drawScrollIndicator into a pixel core (drawScrollIndicatorPx) + an
item-count wrapper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 09:32:09 +02:00
Jakub
f591cddf4f refactor(ui): audit-pass fixes + dead-code/redundancy cleanup
Fixes from a full ui-new audit (OLED + e-ink both build green):
- remove dead DisplayDriver::drawScrollArrows (all lists use drawScrollIndicator)
- SettingsScreen selection bar -> lineStep()-1, matching the drawList screens
- HomeScreen: don't force the 1s blink refresh on the CLOCK page (status icons
  are hidden there anyway)
- FullscreenMsgView: clamp KEY_DOWN scroll to a cached _max_scroll instead of
  over-incrementing and leaning on the next render to clamp
- DataStore: clamp use_lemon_font (>1 -> 0) on load, like the other enum fields
- move the ~1.5KB wrap scratch (trans/lines) off the render stack into shared
  file-scope statics in FullscreenMsgView (single-threaded UI; the fullscreen
  view and history list never lay out in the same frame)

Cleanup:
- drop dead members RingtoneEditorScreen::DUR_VALS and HomeScreen::sensors_scroll
- delete redundant manual scroll-clamps in handleInput across the drawList
  screens (drawList already reclamps each render); remove the now-unused _visible
  from QuickMsgScreen/NearbyScreen/BotScreen and BotScreen::scrollToSel()

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 08:54:11 +02:00
Jakub
da161d49d2 fix(ui): message-history scrollbar reserve stuck behind alert overlay
The DM/channel history views size the scroll-column reserve from the previous
frame's visible count. A new message bumps the count so the reserve briefly
appears until the next frame settles it — normally invisible, but the alert
overlay froze the screen (_next_refresh = _alert_expiry) for the alert's whole
duration, leaving the content shifted as if a scrollbar were needed. Keep the
underlying screen refreshing at its own cadence (capped at the alert expiry);
the display CRC skips unchanged frames so e-ink isn't thrashed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:23:00 +02:00
Jakub
9da730e3b6 refactor(ui): shared drawList + header + key-decode helpers
- drawList(): scrollable list skeleton (visible window, keep-sel-in-view,
  scroll-column reserve, per-row callback, indicator). Migrate Tools, Bot,
  Nearby, Waypoints list and the three QuickMsg lists onto it; centralises the
  scroll-clamp/reserve/indicator that each had open-coded (and inconsistently).
- drawCenteredHeader(): centred title + separator, replacing the duplicated
  two-liner across ~10 screens (incl. QuickMsg, which used width()/2 spacing and
  was missed before); unifies the separator at headerH()-sepH().
- keyIsPrev()/keyIsNext() in UIScreen.h for the LEFT||PREV / RIGHT||NEXT idiom;
  applied to 6 screens, behaviour-preserving. Cancel/context-menu stay
  per-screen (they mean different things on different screens).
- rotLabel() dedups the 0/90/180/270 array in Settings.
- Unify selection-row height to lineStep()-1 (Tools/Bot matched the rest).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:23:00 +02:00
Jakub
98af868e68 refactor(ui): dedup status-bar indicators
- Extract drawBoxedIcon()/drawSlotIcon() in icons.h; collapse the four
  near-identical mute/BT/advert/trail blocks in renderBatteryIndicator.
- Centre the glyph on the actual indicator box (box_h) instead of the text
  line, fixing the 1px vertical offset in Lemon mode.
- Extract blinkOn() for the shared advert/trail blink cadence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 18:17:34 +02:00
Jakub
a0d536cf90 feat(ui): scroll indicator in fullscreen message view
Replace the old ^/v scroll arrows with the proportional scroll indicator
(thumb + triangle caps) used by the list screens. Reserve its right-edge
column and re-wrap the message text to the narrower width so nothing renders
under it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 17:30:43 +02:00
Jakub
353dee5878 feat(ui): status-bar mini-icons + settings fixes
- Replace single-letter M/B/A/G top-bar indicators with scalable mini-icons:
  ICON_MUTE (speaker+cross), ICON_BLUETOOTH (rune), ICON_ADVERT (broadcast
  mast+waves), ICON_TRAIL (map pin). Centred in the cw+2 indicator box;
  disconnected BT shows the plain glyph instead of lowercase b.
- fix(settings): right-side values used display.valCol() without the scrollbar
  reserve, so after expanding a section they rendered under the indicator.
  Route all value cursors through valCol(display) = display.valCol() - _reserve.
- fix(settings): font toggle used ^=1, which on a stale value of 2 (older Hybrid
  build) flips 2<->3 — both nonzero, locking applyFont() on Lemon with no way
  back. Normalise: use_lemon_font = use_lemon_font ? 0 : 1.
- docs(settings): document Messages > Resend setting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 16:45:28 +02:00
MarekZegare4
6e4177f3d6 feat(ui): proportional scrollbar with mini-icon caps; reclaim row space
Replace the text ^/v scroll arrows with a font-scaling indicator drawn in
icons.h: a proportional thumb between fixed up/down triangle mini-icon caps.
drawScrollIndicator() lives in a ~5px right-edge column and scales via
miniIconScale (1x OLED, 2x landscape e-ink).

- Mini-icons: ICON_SCROLL_UP/DOWN; miniIconDrawTop (exact placement) and
  miniIconDrawHalo (shape-hugging 1px DARK halo, clip_top to spare the header
  separator) so caps stay visible on the LIGHT selection bar without a box.
- Thumb is 3*s wide so it centres on the triangle column; caps are static end
  markers (always drawn) so neither vanishes at the extremes.
- scrollIndicatorReserve(): right-edge gutter (0 when the list fits). Content,
  the selection bar and the message-history bubbles are all narrowed by it so
  nothing renders under the scrollbar. Portrait e-ink wrap width subtracts the
  reserve in both the box-height pass and render so wrapped text can't spill.
- Drop the redundant ">" selection marker (the highlight bar already shows
  selection) and shift rows to x=2, reclaiming left-edge space.
- Wire the indicator into every scrollable list (Bot, Settings, Nearby, Tools,
  Trail, QuickMsg lists + DM/channel history) and add one to WaypointsView,
  which scrolled with no indicator before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 14:41:46 +02:00
MarekZegare4
8bd6fbf1cb feat(bot): hardening + auto-responder, query commands, quiet hours
Reply-bot overhaul on top of the trigger/reply auto-reply:

Robustness
- single botTriggerMatches() shared by DM/channel paths; named constants
  (BOT_REPLY_COOLDOWN_MS / BOT_SCRATCH) replace magic numbers.
- per-contact DM throttle (8-entry ring) so a second sender isn't starved
  while one contact is on cooldown.
- channel anti-loop: skip only when an incoming message equals our own reply
  (was: any reply containing the trigger word — which silently killed channel
  replies for the common "trigger word in reply" setup).

Features
- away / reply-to-all: a lone "*" trigger matches every message.
- independent DM vs channel triggers (bot_trigger / bot_trigger_ch); "*" works
  on the channel too, bounded by cooldown + echo guard.
- query commands: a DM or monitored-channel message is scanned for "!word"
  tokens — !ping/!batt/!loc/!time/!temp/!hops/!status/!help — merged into one
  combined reply. DM = per-contact throttle, ignores quiet hours; channel =
  broadcast, per-channel cooldown, respects quiet hours. !hops uses
  getPathHashCount() (0 = direct).
- quiet hours (bot_quiet_start/end, local, wraps midnight) silence push replies.
- reply counter shown in the BotScreen header.

UI / storage
- BotScreen: 9 rows, scrolling list (no more cramming), field I/O via
  fieldBuf()/fieldCap().
- prefs bot_commands_enabled / bot_quiet_start / bot_quiet_end / bot_trigger_ch
  persisted; schema 0xC0DE000A → 0xC0DE000C with clamping + migration
  (bot_trigger_ch seeded from bot_trigger on upgrade).
- docs: tools_screen bot section rewritten; FEATURES.md refreshed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 11:57:27 +02:00
MarekZegare4
8c0ccaed73 feat(ui): keyboard overhaul — shared instance, icon keys, symbols page
- Unify on the shared keyboard: WaypointsView drives UITask::keyboard()
  instead of its own instance; openKb() clears {loc}/{time} for literal
  fields (labels, coordinates). Reclaims the duplicate widget from the heap.
- Icon glyphs on the special row: caps ⇧, space ⎵ (two halves), delete ⌫,
  OK ✓ (reuses ICON_CHECK); {} and the page toggle stay text.
- Second character page (symbols), toggled by a "#@"/"abc" key. Tidy the
  letters page: drop the duplicate grid space, add the comma, group
  punctuation as . , ! ?
- Harden the preview buffers (KB_PREVIEW_CAP) against very wide displays.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 10:47:50 +02:00
MarekZegare4
4145185031 chore: address code-audit hygiene (stale refs, dead TODO, popup scroll)
- FEATURES audit: refresh references the Nearby/Trail refactors made stale —
  M4 (renderDiscoverDetail → renderScanDetail), L1 (SNR %.1f now in scan detail
  + ping; list cards show RSSI), Trail grid (round-step renderGrid + MIN_GRID_PX).
- MyMesh: drop the obsolete `// TODO: add expected ACK to table` — the code
  right below already populates expected_ack_table.
- PopupMenu: render() is now the single source of truth for _scroll, clamping
  the selection into view from the live-height cap, so handleInput() only moves
  _sel and never depends on a stale _cap (M3). Behaviour-preserving.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 10:00:48 +02:00
MarekZegare4
27d88bed52 docs: sync docs with shipped state (Nearby menu, design status, delivery)
- tools_screen (Nearby): drop the removed "Filter…" Options action; filtering
  is LEFT/RIGHT on the list only. Sort is adjusted in place via LEFT/RIGHT on
  its row, stored-source only; filter/sort persist across re-entry.
- nearby_redesign / trail_redesign: mark Status implemented (branches merged);
  record the Nearby deviations from the proposal.
- FEATURES: DM delivery status moved from idea to  shipped, with deltas.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 09:50:57 +02:00
MarekZegare4
c05e722afc refactor(ui): readable compile-time icon authoring (ASCII-art + dims)
Author mini-icons as ASCII-art rows packed to bytes at compile time via
constexpr packRow(), so the glyph shape is visible in source while the
binary holds only the packed bytes (strings never reach flash, identical
to the previous hand-written hex).

Bundle each icon's width/height with its data through MiniIcon and the
MINI_ICON(name, width, ...) macro, so draw sites carry no magic numbers:
miniIconDraw(d, x, y, ICON_CHECK). Also add an unused-by-design skeleton
for full-size page icons (≤32 px): packRow32 / BigIcon / BIG_ICON /
bigIconDraw, for authoring a future big glyph the same readable way.
Existing XBM bitmaps left untouched.

Flash size unchanged; verified no ASCII-art strings reach the .elf.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 09:42:29 +02:00
MarekZegare4
019f739b8b refactor(ui): reorganize Nearby Nodes (one list, two sources, unified menu)
Replace the many scrollable filter/sort categories and inconsistent popups
with a single list / detail / action-menu path over two sources (stored
contacts and live discover scan). Filter (type) and sort are independent
axes: LEFT/RIGHT cycle the type filter, the action menu's Sort row is
adjusted in-place with LEFT/RIGHT (not Enter). The active filter is shown
in the SCAN title and empty-list messages distinguish "no contacts" from
"filtered out". Filter/sort persist across re-entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 09:22:26 +02:00
MarekZegare4
38e9273ec7 refactor(ui): reorganize Tools › Trail (popup, map, waypoints)
Tidies the Trail screen end to end, with no functional change beyond the
intended UX cleanups. Squashed from refactor/trail-screen.

Popup:
- Two-level action menu (Hold Enter): short main menu (Start/Stop, Mark
  here, Waypoints…, Trail file…, Settings…) plus "Trail file…" and
  "Settings…" submenus, replacing one flat ~12-item list that mixed
  settings and actions. One interaction pattern per level; Reset lives in
  Trail file…, away from a stray Enter. Settings submenu is view-aware
  (Grid only on Map, Readout only on Summary).

Map:
- MapProjection (geo→pixel) built once and shared by the map, grid and
  marker drawing — removes the duplicated projection math and renderGrid's
  11 scalar params.
- renderMap split into computeBounds() and drawMarkers() helpers.

Grid:
- Square cells fitted to the frame: the shorter side is divided into a
  whole number of equal cells (grid touches that pair of borders), and the
  longer side centres the whole cells that fit — square, symmetric, no
  one-sided drift. Drawn as one dot per intersection (legible on OLED).

Waypoints:
- Extracted the whole waypoint management UI (list / navigate / add-by-
  coords / mark / rename / delete / send) into a self-contained
  WaypointsView component that TrailScreen owns and delegates to.
- Dropped the redundant bulk "Clear all" (per-waypoint Delete covers it).

Docs updated (tools_screen.md) + design rationale (docs/design/
trail_redesign.md). Builds clean on solo envs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 00:05:49 +02:00
MarekZegare4
bcf8774962 feat(ui): message delivery status (DM ACK + channel relay)
End-to-end delivery indicators on the device UI, drawn next to outgoing
messages and auto-scaled to the font (legible on landscape e-ink).

DM (and room servers, which share the DM path):
- Pending / delivered / failed marker driven by the real end-to-end ACK.
  Pending shows a row of dots — one per send — so auto-resend progress is
  visible before it resolves to ✓ / ✗.
- Auto-resend: new pref dm_resend_count (0-5, default 2), Settings ›
  Messages › Resend. A pending DM whose ACK times out is re-sent (reusing
  the original timestamp) until resends run out, then ✗. Driven from
  UITask::loop so it completes in the background, independent of screen.
- Incoming dedup: a retry reuses the sender timestamp + text but carries a
  fresh packet hash, so addDMMsg drops copies matching prefix+ts+text.

Channels (flood, no recipient ACK):
- ✓ only once a repeater echo confirms the send was relayed into the mesh;
  no echo is normal, not a failure (no pending/fail shown). A small ring
  tracks a burst of sends so each matches its echo. Receive-path hashing is
  gated so the hot flood path is untouched when idle.

Shared:
- Markers shown in both the history list and the fullscreen message view.
- Reusable scalable mini-icon facility in icons.h (bitmap + auto-scale);
  adding a new status icon is a bitmap plus one draw call.

No changes to the upstream mesh library (src/).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 23:33:16 +02:00
MarekZegare4
8545454f5b docs(features): add unprioritised idea backlog (DM delivery status + 10 more)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:47:12 +02:00
MarekZegare4
b8a7b5dcc0 refactor: dedup persistence header, harden action menu, tidy small items
- Persist.h: shared writeHeader()/readHeader() for the magic+version+count
  on-disk header; Waypoint and Trail snapshots now share one implementation
  (byte layout unchanged; each keeps its own count clamp/reject + extra fields).
- TrailScreen: pushAction() guards _act_map / PopupMenu capacity, so adding a
  new action can't silently overrun the fixed array.
- PopupMenu: add count()/setSelected() accessors; replace the remaining direct
  _sel/_count field pokes in NearbyScreen, TrailScreen and QuickMsgScreen.
- Trail summary: unit-suffixed time ("1h 05m" / "5m 03s") so hours can't be
  misread as minutes.
- Trail::haversineMeters delegates to geo::haversineKm — single Haversine
  implementation (also trims a little flash).

Verified: GAT562 (SSD1306) and WioTrackerL1Eink (GxEPD) solo builds compile clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:37:03 +02:00
MarekZegare4
151892e1ce refactor(ui): extract shared helpers, dedup screens, GPS shutdown via provider
Pull repeated UI idioms into DisplayDriver and remove duplicated logic:

- DisplayDriver: add drawScrollArrows() and drawInvertedHeader(); replaces 11
  copy-pasted scroll-arrow blocks across 5 screens and 3 inverted title-bar
  blocks (NearbyScreen x2, NavView). Standardises the detail-view separator.
- useImperial(): single source on UITask; NearbyScreen/TrailScreen delegate
  instead of each re-reading NodePrefs.units_imperial.
- NearbyScreen: extract saveSelectedWaypoint() (two identical blocks -> one);
  drop the redundant local label buffer (WaypointStore truncates).
- UITask::shutdown(): power GPS off through LocationProvider::stop() instead of
  poking PIN_GPS_EN directly — centralises enable/reset-pin + active-level logic.

Net -58 lines. Verified: GAT562 (SSD1306) and WioTrackerL1Eink (GxEPD) solo
builds compile clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:21:59 +02:00
MarekZegare4
1521be3803 fix(trail): check read() return for header bytes in readFrom/exportGpxFromFile
Mirrors the Waypoint::readFrom() hardening — reject a truncated trail
snapshot instead of proceeding with garbage header fields. Consistency
with the waypoint store's persistence path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 12:53:40 +02:00
MarekZegare4
fcdacaa3bc fix: GPS shutdown active-level, buzzer octave-8 consistency, waypoint header read checks
- UITask::shutdown(): power GPS off using !PIN_GPS_EN_ACTIVE instead of hardcoded
  LOW, matching MicroNMEALocationProvider::stop() (still LOW on current active-high
  devices, but correct for a future active-low GPS).
- buzzer _noteFreq(): clamp octave to 8 instead of 7 so the parser's accepted range
  (4-8) is fully consumed; previously an octave-8 digit was clamped away and could
  leak into the stream as the next note's duration.
- Waypoint::readFrom(): check read() return for version/reserved/count header bytes
  so a truncated file is rejected instead of using garbage count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 12:49:15 +02:00