Flash prompt: retry the page-create once (2.2.9 post-prelude drop window)

The device-info frame trace settled the remaining firmware-check mystery: the
right lens is the correct settings endpoint, but on stock 2.2.9 a request
written immediately after the prelude ack is sometimes silently dropped while
the lens emits its own sid-0x80 notifications (flag 0x01, cmd 4, device-chosen
magic, result {f1:1}, ~2 s apart). The probe's retry answers within ~100 ms
every time, so the check now passes; the left-lens fallback never fired.

The flash-prompt page-create goes out at exactly the same post-prelude moment,
so give it the same single retry. Finding documented in
../notes/ble-connections-2.2.9.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
This commit is contained in:
James BabcockandClaude Fable 5 committed 2026-08-23 17:32:15 -07:00
1 parent a7684f603d
commit 3e440830a3
1 file changed
+14 -4
@@ -226,10 +226,20 @@ public class FaceclawFlashPromptCommunicator implements FaceclawBleListener {
throw new IllegalStateException("session prelude not acked: " + address);
}
// 3. Create the prompt page (warning text + No/Yes list) on sid=0xe0 Cmd=0.
int magic = allocMagic();
byte[] page = BleProtocol.buildCreatePromptPage(
magic, TEXT_NAME, TEXT_CONTAINER_ID, warningText, LIST_NAME, LIST_CONTAINER_ID, ITEMS);
if (writeAndAwaitAck(address, BleProtocol.SID_EVENHUB, BleProtocol.FLAG_REQUEST, magic, page, CREATE_ACK_TIMEOUT_MS) == null) {
// Two attempts: on 2.2.9 the first request sent right after the
// prelude can be dropped while the lens emits its own sid-0x80
// notifications (observed with the device-info settings read).
byte[] pageAck = null;
for (int attempt = 0; attempt < 2 && pageAck == null && !cancelled; attempt++) {
int magic = allocMagic();
byte[] page = BleProtocol.buildCreatePromptPage(
magic, TEXT_NAME, TEXT_CONTAINER_ID, warningText, LIST_NAME, LIST_CONTAINER_ID, ITEMS);
pageAck = writeAndAwaitAck(address, BleProtocol.SID_EVENHUB, BleProtocol.FLAG_REQUEST, magic, page, CREATE_ACK_TIMEOUT_MS);
if (pageAck == null) {
emitLog("prompt page attempt " + (attempt + 1) + " unacked: " + address);
}
}
if (pageAck == null) {
throw new IllegalStateException("prompt page not acked: " + address);
}
emitLog("prompt page shown on " + address);