Pebble: Don't sleep for 100ms when doing firmware installs

originally the 100ms sleep after writes was introduced to fix a bug where sending an appmessage right after ACKing a previous appmessage cuased the outgoing packet to be NACK'd by the 3.0+ firmware. 4fe498efc
Keeping because 100ms for most situations doesn't matter, but definitely worth avoiding when uploading new firmware to the watch.
This commit is contained in:
Benjamin Temple
2026-05-17 08:06:18 -07:00
parent 1f36e541e3
commit ad08874466
@@ -476,7 +476,7 @@ class PebbleIoThread extends GBDeviceIoThread {
}
private void write_real(byte[] bytes) {
private void write_stream(byte[] bytes) {
try {
if (mIsTCP) {
ByteBuffer buf = ByteBuffer.allocate(bytes.length + 8);
@@ -495,6 +495,10 @@ class PebbleIoThread extends GBDeviceIoThread {
} catch (IOException e) {
LOG.error("Error writing.", e);
}
}
private void write_real(byte[] bytes) {
write_stream(bytes);
try {
Thread.sleep(100);
} catch (InterruptedException ignored) {
@@ -651,7 +655,10 @@ class PebbleIoThread extends GBDeviceIoThread {
return;
}
LOG.info("got {}bytes for writeInstallApp()", bytes.length);
write_real(bytes);
// Bypass the 100ms post-write sleep in write_real — that sleep prevents appmessage
// NACKs on firmware 3.0+ and is not relevant here. IoThread's blocking read is woken
// immediately when the watch responds, via notifyAll() in writeToPipedOutputStream.
write_stream(bytes);
}
void installApp(Uri uri, int appId) {