mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Amazfit GTS: Fix setting menu items with low mtu
This commit is contained in:
@@ -2381,7 +2381,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeToChunked(TransactionBuilder builder, int type, byte[] data) {
|
protected void writeToChunked(TransactionBuilder builder, int type, byte[] data) {
|
||||||
final int MAX_CHUNKLENGTH = mMTU - 6;
|
final int MAX_CHUNKLENGTH = mMTU - 6;
|
||||||
int remaining = data.length;
|
int remaining = data.length;
|
||||||
byte count = 0;
|
byte count = 0;
|
||||||
|
@@ -73,7 +73,7 @@ public class AmazfitGTSSupport extends AmazfitBipSupport {
|
|||||||
Set<String> pages = HuamiCoordinator.getDisplayItems(gbDevice.getAddress());
|
Set<String> pages = HuamiCoordinator.getDisplayItems(gbDevice.getAddress());
|
||||||
LOG.info("Setting display items to " + (pages == null ? "none" : pages));
|
LOG.info("Setting display items to " + (pages == null ? "none" : pages));
|
||||||
byte[] command = new byte[]{
|
byte[] command = new byte[]{
|
||||||
0x00, (byte) 0xC2, 0x00, 0x1E, // looks like chunked, but 0x00 :O
|
0x1E,
|
||||||
0x00, 0x00, (byte) 0xFF, 0x01, // Status
|
0x00, 0x00, (byte) 0xFF, 0x01, // Status
|
||||||
0x01, 0x00, (byte) 0xFF, 0x19, // PAI
|
0x01, 0x00, (byte) 0xFF, 0x19, // PAI
|
||||||
0x02, 0x00, (byte) 0xFF, 0x02, // HR
|
0x02, 0x00, (byte) 0xFF, 0x02, // HR
|
||||||
@@ -94,7 +94,7 @@ public class AmazfitGTSSupport extends AmazfitBipSupport {
|
|||||||
if (pages != null) {
|
if (pages != null) {
|
||||||
pages.add("settings");
|
pages.add("settings");
|
||||||
// it seem that we first have to put all ENABLED items into the array
|
// it seem that we first have to put all ENABLED items into the array
|
||||||
int pos = 4;
|
int pos = 1;
|
||||||
for (int i = 0; i < keys.length; i++) {
|
for (int i = 0; i < keys.length; i++) {
|
||||||
String key = keys[i];
|
String key = keys[i];
|
||||||
byte id = ids[i];
|
byte id = ids[i];
|
||||||
@@ -115,7 +115,7 @@ public class AmazfitGTSSupport extends AmazfitBipSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.write(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_CHUNKEDTRANSFER), command);
|
writeToChunked(builder, 2, command);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user