Pebble: Keep mmSequence in 5-bit range and don't overflow into the command bits

This commit is contained in:
Benjamin Temple
2026-05-17 08:06:14 -07:00
parent 5cd9c40436
commit 9d46ba6bc9
@@ -256,7 +256,8 @@ public class PebbleLESupport {
while (payloadToSend > 0) {
int chunkSize = Math.min(payloadToSend, maxChunkSize);
byte[] outBuf = new byte[chunkSize + 1];
outBuf[0] = (byte) ((mmSequence++ << 3) & 0xff);
outBuf[0] = (byte) ((mmSequence << 3) & 0xff);
mmSequence = (mmSequence + 1) & 0x1f; // keep serial in 5-bit range (0-31)
System.arraycopy(buf, srcPos, outBuf, 1, chunkSize);
sendDataToPebble(outBuf);
srcPos += chunkSize;