P5: device integration - host battery, the 6x8 A/B font, deploy updates

- BatteryService grows the host provider (Platform.battery="host"): the
  PicoCalc's own pack through the kernel power_supply driver - a true
  percent and charging flag from sysfs, no voltage-curve estimation, no
  radio connection needed. Unreadable supply = absent, gauge hidden.
- The console-font script now builds TWO 512-glyph PSF2 fonts: the 6x12
  Terminus-based default (53x26) and a 6x8 A/B candidate (53x40) based
  on the kernel's own font_6x8 (CP437 coverage - documented as having
  no Cyrillic), with the braille block at 2px dot pitch and all 18
  marks redrawn for the shorter cell. Built and verified live on the
  Lyra: stty reports 53x40 under meshterm8, specimen legible
  (.claude/plans/p5-specimen-6x8.png); flip with setfont, persist the
  winner in vconsole.conf. JP judges the A/B by eye.
- calculinux-setup.sh puts the deploy user in input/dialout/video
  (input is the modifier watch's /dev/input access).
- theme's platform binding now drops the fold table and cache on every
  switch: its emoji pads bake in cell_len at build time, which the
  regular platform's emoji-width calibration can re-measure - a stale
  table survived platform swaps in randomized test runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Fable 5 committed 2026-08-01 13:08:17 -04:00
1 parent 2b658f47a9
commit 89eef7f4d2
5 files changed
+279 -105

No files matched your search

+23
View File
@@ -86,6 +86,29 @@ def test_fkey_lane_text_fits_and_flips() -> None:
assert cell_len(lane_text(wide, shifted=True).plain) <= 53
def test_host_battery_reads_the_sysfs_supply(tmp_path, monkeypatch) -> None:
"""The PicoCalc battery path: a true percent and charging flag straight from sysfs."""
from meshterm.services import battery_service
(tmp_path / "capacity").write_text("53\n")
(tmp_path / "status").write_text("Discharging\n")
(tmp_path / "voltage_now").write_text("4012000\n")
monkeypatch.setattr(battery_service, "_HOST_SUPPLY", tmp_path)
service = battery_service.BatteryService(ctx=None)
service._poll_host()
reading = service.reading()
assert reading is not None
assert (reading.percent, reading.charging, reading.millivolts) == (53, False, 4012)
(tmp_path / "status").write_text("Charging\n")
service._poll_host()
assert service.reading().charging is True
monkeypatch.setattr(battery_service, "_HOST_SUPPLY", tmp_path / "gone")
service._poll_host()
assert service.reading() is None # unreadable supply = absent, header draws nothing
def test_dialog_gate_shrinks_on_picocalc() -> None:
from meshterm.ui.surface import _dialog_max_cells