mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Pebble: Keep mmSequence in 5-bit range and don't overflow into the command bits
This commit is contained in:
+2
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user