forked from Blendman974/faceclaw
Merge branch 'main' into fancy-compass
This commit is contained in:
commit
5ffba82f45
5 files changed
+29
-92
No files matched your search
@@ -73,7 +73,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
private boolean ringNotificationsReady;
|
private boolean ringNotificationsReady;
|
||||||
private boolean sessionReady;
|
private boolean sessionReady;
|
||||||
private boolean fixedLayoutCreated;
|
private boolean fixedLayoutCreated;
|
||||||
private boolean warmedUp;
|
|
||||||
private boolean shutdownRequested;
|
private boolean shutdownRequested;
|
||||||
// CFW firmware-debug-flags overlay (mode 7). Desired value pushed from TS; the
|
// CFW firmware-debug-flags overlay (mode 7). Desired value pushed from TS; the
|
||||||
// sub-op last sent this session (-1 = not yet), reset on (re)connect so the
|
// sub-op last sent this session (-1 = not yet), reset on (re)connect so the
|
||||||
@@ -307,7 +306,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
|
|
||||||
public void setFirmwareDebugFlags(boolean enabled) {
|
public void setFirmwareDebugFlags(boolean enabled) {
|
||||||
// Just record it; the drive loop emits the mode-7 control message when the
|
// Just record it; the drive loop emits the mode-7 control message when the
|
||||||
// session is warmed up and idle, and re-emits when this value changes.
|
// display path is ready and idle, and re-emits when this value changes.
|
||||||
firmwareDebugFlagsEnabled = enabled;
|
firmwareDebugFlagsEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +316,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
int magic;
|
int magic;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (!running || !sessionReady || shutdownRequested || !fixedLayoutCreated || !warmedUp) {
|
if (!running || !sessionReady || shutdownRequested || !fixedLayoutCreated) {
|
||||||
logLine("skip G2 mic enable; EvenHub display path not ready");
|
logLine("skip G2 mic enable; EvenHub display path not ready");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -383,8 +382,8 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the recreated layout, warmup, and retained compositor frame
|
* Wait until the recreated layout and retained compositor frame have both
|
||||||
* have all landed. If this wake came from CFW's deferred double tap, READY
|
* landed. If this wake came from CFW's deferred double tap, READY
|
||||||
* is then sent to both arms to cancel their stock-dashboard fallback.
|
* is then sent to both arms to cancel their stock-dashboard fallback.
|
||||||
*/
|
*/
|
||||||
public boolean awaitEvenHubSessionReady(int timeoutMs) {
|
public boolean awaitEvenHubSessionReady(int timeoutMs) {
|
||||||
@@ -397,7 +396,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
frameReady = !desiredFingerprint.isEmpty()
|
frameReady = !desiredFingerprint.isEmpty()
|
||||||
&& desiredFingerprint.equals(displayedFingerprint);
|
&& desiredFingerprint.equals(displayedFingerprint);
|
||||||
}
|
}
|
||||||
if (!shutdownRequested && fixedLayoutCreated && warmedUp && frameReady) {
|
if (!shutdownRequested && fixedLayoutCreated && frameReady) {
|
||||||
if (faceclawWakePendingNonce >= 0) {
|
if (faceclawWakePendingNonce >= 0) {
|
||||||
readyGeneration = enqueueFaceclawWakeControlLocked(
|
readyGeneration = enqueueFaceclawWakeControlLocked(
|
||||||
BleProtocol.FACECLAW_WAKE_OP_READY,
|
BleProtocol.FACECLAW_WAKE_OP_READY,
|
||||||
@@ -463,7 +462,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
compassEnabled = enable;
|
compassEnabled = enable;
|
||||||
compassControlLastSent = -1;
|
compassControlLastSent = -1;
|
||||||
clearMessagesOfKindLocked("compass-control");
|
clearMessagesOfKindLocked("compass-control");
|
||||||
if (running && sessionReady && !shutdownRequested && fixedLayoutCreated && warmedUp) {
|
if (running && sessionReady && !shutdownRequested && fixedLayoutCreated) {
|
||||||
enqueueCompassControlLocked(true, compassEnabled);
|
enqueueCompassControlLocked(true, compassEnabled);
|
||||||
} else {
|
} else {
|
||||||
logLine("defer compass " + (enable ? "enable" : "disable") + "; display path not ready");
|
logLine("defer compass " + (enable ? "enable" : "disable") + "; display path not ready");
|
||||||
@@ -742,8 +741,8 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
surfaceId, pixels8bpp, rectX, rectY, rectWidth, rectHeight, contentFingerprint, glyphs);
|
surfaceId, pixels8bpp, rectX, rectY, rectWidth, rectHeight, contentFingerprint, glyphs);
|
||||||
FrameTimings.getInstance().spanEnd(frameId, "composite");
|
FrameTimings.getInstance().spanEnd(frameId, "composite");
|
||||||
// Pack the composited 8bpp buffer down to the headerless 4bpp frame
|
// Pack the composited 8bpp buffer down to the headerless 4bpp frame
|
||||||
// format the wire planners consume; BMP framing is added later only on
|
// format the wire planners consume; BMP framing is added later only for
|
||||||
// the rare paths that still need it (warmup, uncompressed fallback).
|
// the uncompressed fallback.
|
||||||
FrameTimings.getInstance().spanStart(frameId, "pack-4bpp");
|
FrameTimings.getInstance().spanStart(frameId, "pack-4bpp");
|
||||||
byte[] packed = BmpUtil.pack4bppFromGray8(composite.gray, composite.width, composite.height);
|
byte[] packed = BmpUtil.pack4bppFromGray8(composite.gray, composite.width, composite.height);
|
||||||
FrameTimings.getInstance().spanEnd(frameId, "pack-4bpp");
|
FrameTimings.getInstance().spanEnd(frameId, "pack-4bpp");
|
||||||
@@ -835,7 +834,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!cfwCleanupSupported || !running || !sessionReady
|
if (!cfwCleanupSupported || !running || !sessionReady
|
||||||
|| shutdownRequested || !fixedLayoutCreated || !warmedUp) {
|
|| shutdownRequested || !fixedLayoutCreated) {
|
||||||
logLine("skip CFW cleanup; mode 11 unavailable or image path not ready");
|
logLine("skip CFW cleanup; mode 11 unavailable or image path not ready");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -986,7 +985,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
shutdownRequested = false;
|
shutdownRequested = false;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
audioCaptureActive = false;
|
audioCaptureActive = false;
|
||||||
clearAllMessagesPreservingWakeLeaseLocked("EvenHub resume");
|
clearAllMessagesPreservingWakeLeaseLocked("EvenHub resume");
|
||||||
@@ -1021,7 +1019,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
message.onAck = () -> {
|
message.onAck = () -> {
|
||||||
lastShutdownAckMagic = message.magic;
|
lastShutdownAckMagic = message.magic;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
};
|
};
|
||||||
message.onTimeout = () -> {
|
message.onTimeout = () -> {
|
||||||
@@ -1039,7 +1036,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
// this also covers a disable that was wiped by the queue flush above
|
// this also covers a disable that was wiped by the queue flush above
|
||||||
// or whose ack was lost, and the charging-mode/exit paths where the
|
// or whose ack was lost, and the charging-mode/exit paths where the
|
||||||
// Compass window never got a chance to release it.
|
// Compass window never got a chance to release it.
|
||||||
if (compassMaybeOn && fixedLayoutCreated && warmedUp) {
|
if (compassMaybeOn && fixedLayoutCreated) {
|
||||||
enqueueCompassControlLocked(true, false);
|
enqueueCompassControlLocked(true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1264,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
lastShutdownExitAtMs = SystemClock.elapsedRealtime();
|
lastShutdownExitAtMs = SystemClock.elapsedRealtime();
|
||||||
}
|
}
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
clearAllMessagesLocked("firmware exit event");
|
clearAllMessagesLocked("firmware exit event");
|
||||||
}
|
}
|
||||||
@@ -1363,7 +1359,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
if (!connected) {
|
if (!connected) {
|
||||||
sessionReady = false;
|
sessionReady = false;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
chargingMode = false;
|
chargingMode = false;
|
||||||
audioCaptureActive = false;
|
audioCaptureActive = false;
|
||||||
@@ -1398,7 +1393,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
// its page was intentionally suspended.
|
// its page was intentionally suspended.
|
||||||
shutdownRequested = false;
|
shutdownRequested = false;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
clearAllMessagesLocked("session ready");
|
clearAllMessagesLocked("session ready");
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
lastAckAtMs = SystemClock.elapsedRealtime();
|
lastAckAtMs = SystemClock.elapsedRealtime();
|
||||||
@@ -1692,19 +1686,14 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
// Prewrite outside the lock; the logical message remains pending until
|
// Prewrite outside the lock; the logical message remains pending until
|
||||||
// its final BLE frame is sent after the current protocol ACK.
|
// its final BLE frame is sent after the current protocol ACK.
|
||||||
}
|
}
|
||||||
if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated && !warmedUp && pendingMessages.isEmpty() && inFlightMessages.isEmpty()) {
|
if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated
|
||||||
Log.i(TAG, "enqueueing warmup");
|
|
||||||
enqueueWarmupLocked();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated && warmedUp
|
|
||||||
&& (firmwareDebugFlagsEnabled ? 2 : 1) != firmwareDebugFlagsLastSent
|
&& (firmwareDebugFlagsEnabled ? 2 : 1) != firmwareDebugFlagsLastSent
|
||||||
&& pendingMessages.isEmpty() && inFlightMessages.isEmpty()) {
|
&& pendingMessages.isEmpty() && inFlightMessages.isEmpty()) {
|
||||||
Log.i(TAG, "enqueueing firmware debug flags " + (firmwareDebugFlagsEnabled ? "show" : "hide"));
|
Log.i(TAG, "enqueueing firmware debug flags " + (firmwareDebugFlagsEnabled ? "show" : "hide"));
|
||||||
enqueueFirmwareDebugFlagsLocked();
|
enqueueFirmwareDebugFlagsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated && warmedUp
|
if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated
|
||||||
&& (compassEnabled ? 1 : 0) != compassControlLastSent
|
&& (compassEnabled ? 1 : 0) != compassControlLastSent
|
||||||
&& pendingMessages.isEmpty() && inFlightMessages.isEmpty()) {
|
&& pendingMessages.isEmpty() && inFlightMessages.isEmpty()) {
|
||||||
Log.i(TAG, "enqueueing compass " + (compassEnabled ? "enable" : "disable"));
|
Log.i(TAG, "enqueueing compass " + (compassEnabled ? "enable" : "disable"));
|
||||||
@@ -1724,7 +1713,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
// window unprotected and a heartbeat that came due there
|
// window unprotected and a heartbeat that came due there
|
||||||
// cost the frame a full ack round trip (measured 124ms on
|
// cost the frame a full ack round trip (measured 124ms on
|
||||||
// frame#232 of the 2026-08-20 02:27 capture).
|
// frame#232 of the 2026-08-20 02:27 capture).
|
||||||
boolean imageWaiting = !shutdownRequested && fixedLayoutCreated && warmedUp
|
boolean imageWaiting = !shutdownRequested && fixedLayoutCreated
|
||||||
&& !hasPendingOrInflightKindLocked("heartbeat")
|
&& !hasPendingOrInflightKindLocked("heartbeat")
|
||||||
&& now >= imageRetryAfterMs
|
&& now >= imageRetryAfterMs
|
||||||
&& (hasPendingImageLocked()
|
&& (hasPendingImageLocked()
|
||||||
@@ -1737,7 +1726,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
if (messageToPrewrite == null && sessionReady && windowHasRoom && !pendingMessages.isEmpty()) {
|
if (messageToPrewrite == null && sessionReady && windowHasRoom && !pendingMessages.isEmpty()) {
|
||||||
messageToWrite = pendingMessages.removeFirst();
|
messageToWrite = pendingMessages.removeFirst();
|
||||||
Log.i(TAG, "sending pending message: " + messageToWrite.label);
|
Log.i(TAG, "sending pending message: " + messageToWrite.label);
|
||||||
} else if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated && warmedUp
|
} else if (messageToPrewrite == null && !shutdownRequested && fixedLayoutCreated
|
||||||
&& windowHasRoom && !hasPendingImageLocked()
|
&& windowHasRoom && !hasPendingImageLocked()
|
||||||
&& now >= imageRetryAfterMs
|
&& now >= imageRetryAfterMs
|
||||||
&& !getDesiredFingerprint().equals(lastEnqueuedFingerprint)) {
|
&& !getDesiredFingerprint().equals(lastEnqueuedFingerprint)) {
|
||||||
@@ -1798,7 +1787,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldBlockPrewriteForHeartbeatLocked(long now) {
|
private boolean shouldBlockPrewriteForHeartbeatLocked(long now) {
|
||||||
if (shutdownRequested || !warmedUp || !fixedLayoutCreated) {
|
if (shutdownRequested || !fixedLayoutCreated) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return hasPendingOrInflightKindLocked("heartbeat")
|
return hasPendingOrInflightKindLocked("heartbeat")
|
||||||
@@ -1809,7 +1798,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
if (message == null || !message.isLeftArmMessage) {
|
if (message == null || !message.isLeftArmMessage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!"image".equals(message.kind) && !"warmup".equals(message.kind)) {
|
if (!"image".equals(message.kind)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return message.message.length + 2 > 232;
|
return message.message.length + 2 > 232;
|
||||||
@@ -1817,7 +1806,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
|
|
||||||
private boolean handleHeartbeat(boolean imageWaiting) {
|
private boolean handleHeartbeat(boolean imageWaiting) {
|
||||||
long now = SystemClock.elapsedRealtime();
|
long now = SystemClock.elapsedRealtime();
|
||||||
boolean heartbeatEligible = !shutdownRequested && warmedUp && fixedLayoutCreated;
|
boolean heartbeatEligible = !shutdownRequested && fixedLayoutCreated;
|
||||||
boolean heartbeatPending = heartbeatEligible && hasPendingOrInflightKindLocked("heartbeat");
|
boolean heartbeatPending = heartbeatEligible && hasPendingOrInflightKindLocked("heartbeat");
|
||||||
long heartbeatElapsedMs = now - lastHeartbeatAckedAtMs;
|
long heartbeatElapsedMs = now - lastHeartbeatAckedAtMs;
|
||||||
boolean heartbeatReady = heartbeatEligible && heartbeatElapsedMs >= ConnectionOptions.HEARTBEAT_READY_MS;
|
boolean heartbeatReady = heartbeatEligible && heartbeatElapsedMs >= ConnectionOptions.HEARTBEAT_READY_MS;
|
||||||
@@ -2092,8 +2081,8 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueCreateLayoutLocked() {
|
private void enqueueCreateLayoutLocked() {
|
||||||
// New session/container: re-assert the firmware-debug-flags overlay once it's
|
// New session/container: re-assert the firmware-debug-flags overlay once
|
||||||
// warmed up again (the mode-7 send is gated on this having reset).
|
// the layout is ready (the mode-7 send is gated on this having reset).
|
||||||
firmwareDebugFlagsLastSent = -1;
|
firmwareDebugFlagsLastSent = -1;
|
||||||
OutboundMessage message = messageBuilder.createLayout(DASHBOARD_TILE);
|
OutboundMessage message = messageBuilder.createLayout(DASHBOARD_TILE);
|
||||||
message.onAck = () -> {
|
message.onAck = () -> {
|
||||||
@@ -2124,9 +2113,8 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
clearMessagesOfKindLocked("create-layout");
|
clearMessagesOfKindLocked("create-layout");
|
||||||
fixedLayoutCreated = true;
|
fixedLayoutCreated = true;
|
||||||
warmedUp = false;
|
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
logLine("existing dashboard layout accepted text probe; image warmup still required");
|
logLine("existing dashboard layout accepted text probe");
|
||||||
};
|
};
|
||||||
message.onTimeout = () -> {
|
message.onTimeout = () -> {
|
||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
@@ -2140,36 +2128,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
logLine("queue startup text probe");
|
logLine("queue startup text probe");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueWarmupLocked() {
|
|
||||||
BleProtocol.ImageTileOptions tile = DASHBOARD_TILE;
|
|
||||||
// Warm up the legacy container with a carrier-sized blank BMP. Real
|
|
||||||
// 640x480 frames use mode 6 and are intentionally independent of this
|
|
||||||
// geometry; a mismatched raw BMP would be rejected by the stock loader.
|
|
||||||
byte[] bmp = BmpUtil.build4bppBmpFromPacked(
|
|
||||||
new byte[((tile.width + 1) >> 1) * tile.height], tile.width, tile.height);
|
|
||||||
int sessionId = nextMapSessionId();
|
|
||||||
List<BleProtocol.ImageFragment> fragments = BleImageOptimizer.planImageFragments(bmp, ConnectionOptions.IMAGE_FRAGMENT_SIZE);
|
|
||||||
for (BleProtocol.ImageFragment fragment : fragments) {
|
|
||||||
OutboundMessage message = messageBuilder.imageWarmupFragment(tile, sessionId, fragment, bmp, connectionOptions.sendImagesToLeft);
|
|
||||||
pendingMessages.addLast(message);
|
|
||||||
message.onAck = () -> {
|
|
||||||
// The first tile warmup primes the image path but does not reliably
|
|
||||||
// guarantee that the tile is now visible on-screen, so it must not
|
|
||||||
// update the displayed-tile cache used by image dedupe.
|
|
||||||
warmedUp = true;
|
|
||||||
// Warmup fragments are image messages on the wire, so they reset
|
|
||||||
// the firmware's heartbeat timer just like real image updates.
|
|
||||||
lastHeartbeatAckedAtMs = SystemClock.elapsedRealtime();
|
|
||||||
};
|
|
||||||
message.onTimeout = () -> {
|
|
||||||
warmedUp = false;
|
|
||||||
clearMessagesOfKindLocked("warmup");
|
|
||||||
displayedFingerprint = "";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
logLine("queue blank warmup");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the CFW mode-7 diagnostic-flag control op to the dashboard container:
|
* Send the CFW mode-7 diagnostic-flag control op to the dashboard container:
|
||||||
* [7][2] to show the on-glasses debug-flag overlay, [7][1] to hide it. Uses the
|
* [7][2] to show the on-glasses debug-flag overlay, [7][1] to hide it. Uses the
|
||||||
@@ -2519,7 +2477,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
chargingMode = true;
|
chargingMode = true;
|
||||||
clearAllMessagesLocked("glasses charging");
|
clearAllMessagesLocked("glasses charging");
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
finishDesiredFrameLocked("discarded: glasses charging");
|
finishDesiredFrameLocked("discarded: glasses charging");
|
||||||
@@ -2542,7 +2499,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
* Record, into the frame that is waiting, why it did not go out on this
|
* Record, into the frame that is waiting, why it did not go out on this
|
||||||
* pass of the send loop. Without this the export shows a bare multi-second
|
* pass of the send loop. Without this the export shows a bare multi-second
|
||||||
* jump between "image submitted as desired frame" and the first BLE
|
* jump between "image submitted as desired frame" and the first BLE
|
||||||
* packet, with no hint whether we were blocked on warmup, a heartbeat, the
|
* packet, with no hint whether we were blocked on a heartbeat, the
|
||||||
* BLE window, or another message queued ahead. Deduped on (frame, reason),
|
* BLE window, or another message queued ahead. Deduped on (frame, reason),
|
||||||
* so a frame stalled for seconds gets one line per state change rather
|
* so a frame stalled for seconds gets one line per state change rather
|
||||||
* than one per loop pass.
|
* than one per loop pass.
|
||||||
@@ -2586,9 +2543,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
if (!fixedLayoutCreated) {
|
if (!fixedLayoutCreated) {
|
||||||
return "display layout not created yet";
|
return "display layout not created yet";
|
||||||
}
|
}
|
||||||
if (!warmedUp) {
|
|
||||||
return "waiting for the warmup frame";
|
|
||||||
}
|
|
||||||
if (now < imageRetryAfterMs) {
|
if (now < imageRetryAfterMs) {
|
||||||
return "image retry backoff (" + (imageRetryAfterMs - now) + "ms left)";
|
return "image retry backoff (" + (imageRetryAfterMs - now) + "ms left)";
|
||||||
}
|
}
|
||||||
@@ -2624,7 +2578,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
// round trip. Reported explicitly because it is otherwise invisible --
|
// round trip. Reported explicitly because it is otherwise invisible --
|
||||||
// heartbeats belong to no frame.
|
// heartbeats belong to no frame.
|
||||||
long heartbeatElapsedMs = now - lastHeartbeatAckedAtMs;
|
long heartbeatElapsedMs = now - lastHeartbeatAckedAtMs;
|
||||||
if (warmedUp && fixedLayoutCreated && !shutdownRequested
|
if (fixedLayoutCreated && !shutdownRequested
|
||||||
&& heartbeatElapsedMs >= ConnectionOptions.HEARTBEAT_READY_MS) {
|
&& heartbeatElapsedMs >= ConnectionOptions.HEARTBEAT_READY_MS) {
|
||||||
return "heartbeat due (" + heartbeatElapsedMs + "ms since the last one acked)";
|
return "heartbeat due (" + heartbeatElapsedMs + "ms since the last one acked)";
|
||||||
}
|
}
|
||||||
@@ -2980,7 +2934,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
maybeEmitEvenAppConflictLocked(reason);
|
maybeEmitEvenAppConflictLocked(reason);
|
||||||
sessionReady = false;
|
sessionReady = false;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
startupProbePending = false;
|
startupProbePending = false;
|
||||||
shutdownRequested = false;
|
shutdownRequested = false;
|
||||||
chargingMode = false;
|
chargingMode = false;
|
||||||
@@ -3004,7 +2957,6 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
sessionReady = false;
|
sessionReady = false;
|
||||||
shutdownRequested = false;
|
shutdownRequested = false;
|
||||||
fixedLayoutCreated = false;
|
fixedLayoutCreated = false;
|
||||||
warmedUp = false;
|
|
||||||
chargingMode = false;
|
chargingMode = false;
|
||||||
rightConnected = false;
|
rightConnected = false;
|
||||||
leftConnected = false;
|
leftConnected = false;
|
||||||
@@ -3022,7 +2974,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
audioPacketListener = null;
|
audioPacketListener = null;
|
||||||
compassControlLastSent = -1;
|
compassControlLastSent = -1;
|
||||||
// A dead transport orphans any glasses-side compass state; the fresh
|
// A dead transport orphans any glasses-side compass state; the fresh
|
||||||
// session re-asserts the desired state after warmup (lastSent = -1).
|
// session re-asserts the desired state once its layout is ready.
|
||||||
compassMaybeOn = false;
|
compassMaybeOn = false;
|
||||||
faceclawWakePendingNonce = -1;
|
faceclawWakePendingNonce = -1;
|
||||||
lastFaceclawWakeLeaseQueuedAtMs = 0;
|
lastFaceclawWakeLeaseQueuedAtMs = 0;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.faceclaw.app;
|
|||||||
public class MessageBuilder {
|
public class MessageBuilder {
|
||||||
private static final int ACK_TIMEOUT_MS = 3_500;
|
private static final int ACK_TIMEOUT_MS = 3_500;
|
||||||
private static final int HEARTBEAT_TIMEOUT_MS = 1_500;
|
private static final int HEARTBEAT_TIMEOUT_MS = 1_500;
|
||||||
private static final int WARMUP_FRAGMENT_TIMEOUT_MS = 3_000;
|
|
||||||
|
|
||||||
private BleMagicPool magicPool;
|
private BleMagicPool magicPool;
|
||||||
|
|
||||||
@@ -39,21 +38,6 @@ public class MessageBuilder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutboundMessage imageWarmupFragment(BleProtocol.ImageTileOptions tile, int sessionId, BleProtocol.ImageFragment fragment, byte[] bmp, boolean leftArm) {
|
|
||||||
int magic = magicPool.allocate();
|
|
||||||
return new OutboundMessage(
|
|
||||||
"warmup",
|
|
||||||
"warmup " + tile.name + "#" + fragment.index,
|
|
||||||
BleProtocol.SID_EVENHUB,
|
|
||||||
BleProtocol.FLAG_REQUEST,
|
|
||||||
magic,
|
|
||||||
BleProtocol.buildImageRawData(tile, sessionId, bmp.length, fragment, magic),
|
|
||||||
WARMUP_FRAGMENT_TIMEOUT_MS,
|
|
||||||
-1,
|
|
||||||
leftArm
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutboundMessage imagePayload(
|
public OutboundMessage imagePayload(
|
||||||
BleProtocol.ImageTileOptions tile,
|
BleProtocol.ImageTileOptions tile,
|
||||||
int sessionId,
|
int sessionId,
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ public class BmpUtil {
|
|||||||
/**
|
/**
|
||||||
* Wrap a packed 4bpp frame in BMP framing (BITMAPINFOHEADER + 16-entry gray
|
* Wrap a packed 4bpp frame in BMP framing (BITMAPINFOHEADER + 16-entry gray
|
||||||
* palette, bottom-up rows padded to a 4-byte stride). Only the full-frame
|
* palette, bottom-up rows padded to a 4-byte stride). Only the full-frame
|
||||||
* image path still speaks BMP on the wire (warmup, and the fallback when
|
* fallback used when mode-6 compression does not shrink the frame still
|
||||||
* mode-6 compression does not shrink the frame); everything else uses the
|
* speaks BMP on the wire; everything else uses the headerless packed format
|
||||||
* headerless packed format directly.
|
* directly.
|
||||||
*/
|
*/
|
||||||
public static byte[] build4bppBmpFromPacked(byte[] packed, int width, int height) {
|
public static byte[] build4bppBmpFromPacked(byte[] packed, int width, int height) {
|
||||||
int packedStride = (width + 1) >> 1;
|
int packedStride = (width + 1) >> 1;
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ export class FaceclawCommunicatorBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve only once the recreated layout, image warmup, and retained frame
|
* Resolve only once the recreated layout and retained frame
|
||||||
* are visible. CFW's deferred-dashboard READY is emitted from this barrier.
|
* are visible. CFW's deferred-dashboard READY is emitted from this barrier.
|
||||||
*/
|
*/
|
||||||
async awaitEvenHubSessionReady(timeoutMs: number): Promise<boolean> {
|
async awaitEvenHubSessionReady(timeoutMs: number): Promise<boolean> {
|
||||||
|
|||||||
+2
-1
@@ -4,7 +4,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nativescript build android"
|
"build": "nativescript build android",
|
||||||
|
"clean": "rm -rf platforms"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@evenrealities/pretext": "^0.1.4",
|
"@evenrealities/pretext": "^0.1.4",
|
||||||
|
|||||||
Reference in new issue
Block a user