Commit Graph
3 Commits
Author SHA1 Message Date
Kaj SchittecatandClaude Opus 5 b52c71f4a5 p4: stop retrying a C6 that is never coming back
7ce1b3f turned off CONFIG_ESP_HOSTED_TRANSPORT_RESTART_ON_FAILURE so a wrong-
firmware C6 could not reboot the board. It stopped the boot loop and I called
it fixed on a 45 s capture. That was the wrong test. Disabling the restart did
not stop esp-hosted, it only removed its exit: sdio_read_task posts
ESP_HOSTED_EVENT_TRANSPORT_FAILURE and then `continue`s straight back into a
register read that is going to fail again. Measured on the same board:

  731 failed register reads in 45 s, ~2.2 KB/s of log, forever

A boot loop and an unbounded retry storm are the same mistake: an unreachable
co-processor is a PERMANENT condition and the driver treats it as transient.

* The rx task now parks after the failure event is posted (build-time patch to
  the esp-hosted fork, same idempotent mechanism build.sh already uses for
  libsodium and the SD_MMC pull-ups; it fails loudly if upstream moves that
  code rather than silently not applying). No reboot, no retry: Wi-Fi and BLE
  are unavailable and everything else carries on.

* hostedInitBLE() no longer runs unconditionally. It is a full esp-hosted
  handshake and it ran on every boot even though the banner advertises lazy
  initialisation -- so on a mismatched unit it started a transport that can
  never come up, for a radio the user may have had switched off. It now
  honours the same stored intent beginBle() already checked.

* The keyboard hot-plug probe backs off from 1.5 s to 15 s once the expansion
  has been absent a few times, and returns to the fast rate the moment one
  succeeds. The probe is a real I2C transaction and on an empty bus Arduino's
  Wire layer logs two [E] lines per attempt: a permanent drip down the USB-CDC
  the companion app talks over, for an accessory most people do not own.

Measured on an ESP-AT unit running the HOSTED image, 150 s captures:

                      shipped   7ce1b3f only   this
  resets                 5           0           0
  host restarts         yes         yes          0
  failed reg reads       -        731/45s        1
  steady log rate        -        2.2 KB/s    ~14 B/s
  UI                   never      appears     stays up

The remaining ~14 B/s is the backed-off keyboard probe on a board with no
expansion attached, which is the expected floor.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-05 10:26:17 +02:00
Kaj SchittecatandClaude Opus 5 7ce1b3f48c p4: an unreachable C6 must not take the device down with it
beta_86 flipped the T-Display P4's default C6 backend to esp-hosted. Current
V1 units ship the C6 with esp-hosted firmware and are fine; OLDER units still
carry the factory ESP-AT firmware, and on those the SDIO stream never frames.
That turned into a board that will not boot at all, reported by three people
so far (#600 jalevdev, myshoeisonfire on Discord, and Kaj's own unit), each
with the same signature:

  H_SDIO_DRV: len[25970]>max[1524] OR offset[25697] != exp[12], Drop

Two separate things made a co-processor mismatch fatal, and both had to go.

1. The UI was behind the C6. hostedInitBLE() ran unconditionally at setup, a
   hosted handshake, with ui_task.begin() ~80 lines later. The LEGACY backend
   always started its worker AFTER the UI, which is exactly why a dead C6 used
   to cost Wi-Fi and nothing else; the hosted path was wired in ahead of it.
   Both backends now start at the end of setup, after the UI, with a note
   saying nothing C6-dependent may move above it.

2. esp-hosted resets the host. CONFIG_ESP_HOSTED_HOST_RESTART_NO_COMMUNICATION_
   WITH_SLAVE=n covers one path; the one that actually fires is
   H_TRANSPORT_RESTART_ON_FAILURE in sdio_drv.c, about 10 s after the connect
   attempt, and it is on by default. Now off. The failure still arrives as
   ESP_HOSTED_EVENT_TRANSPORT_FAILURE, which is what an application should act
   on instead of the transport rebooting the board underneath it.

Measured on an ESP-AT unit, 45 s captures, same hardware:

  as shipped       5 resets, host restarts, UI never appears
  reorder only     2 resets, host restarts, UI appears then dies
  reorder + config 0 resets, 0 restarts, UI stays up

The C6 is still unreachable on that unit, as it must be - it is the wrong
firmware for it. It now costs Wi-Fi and BLE and nothing else.

Also here, both needed before this can ship:

* The ESP-AT build gets its own artifact name (tdisplay-p4-at, and the matching
  -lcd/-lr2021 combinations). Both backends used to answer "tdisplay-p4", so an
  ESP-AT unit's self-update would have fetched the hosted bin and put itself
  straight back into the loop, recoverable only over USB. That is the T-Deck
  Max bug again (a Max self-updating to Pro firmware) and would have been the
  fourth time this table shipped wrong.

* The keyboard expansion probe prints a one-shot bus scan. "It does not work"
  has three causes that are indistinguishable from outside: not clipped on,
  clipped on but unpowered, or present and failing bring-up. An unpowered board
  does not NACK cleanly either - its pull-ups are dead, the lines sit low
  through its ESD diodes, and every transaction returns ESP_ERR_INVALID_STATE,
  which reads like a driver fault. The scan says which it is in one line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-05 10:03:19 +02:00
Michael A. CojocariandClaude Opus 5.5 ad91b1cb3f feat(tdisplay-p4): clip-on keyboard expansion, plus keyboard and layout fixes
The T-Display P4 keyboard expansion (TCA8418 + its own XL9555, ported from
camillia-mt) now works. It is looked for every 1.5 s, so it can be clipped on
or off while running, and is routed like the CardKB and Bluetooth keyboards:
it types into the focused field and keeps the on-screen keyboard down. The
external-keyboard routing was gated on Bluetooth, which the P4 lacks, so it
now follows a new CAP_EXT_KEYBOARD; the Bluetooth-only parts stay on
CAP_BLE_KEYBOARD.

- Keys: Shift/Sym/Alt one-shot, Caps Lock lights the expansion LEDs, arrows
  and Backspace repeat, Alt+Backspace backs out, F1-F5 open the tabs left to
  right, and F11 steps the keyboard light through off/low/medium/high (saved
  across reboots).
- Wire1 is shared with the ES8311 codec on other pins; P4I2c1 switches it
  under a lock, and the codec's lazy bring-up now goes through it.
- With the keyboard attached the tab bar labels F1-F5 beside each icon, and
  Enter on a chat bubble opens its action menu.

Also, on any keyboard build, Enter runs the command in the terminal and the
repeater admin console (the admin console's Enter hook sat on its Send button,
where nothing raised it). And on the P4: the status-bar name shrinks to fit the
bar, the Discover buttons are spaced out, contact names clear their icon in
landscape, and leaving an app returns the focus to its tile in the app drawer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:10:12 -04:00