1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

Colmi R0x: Add factory reset function

This commit is contained in:
Arjan Schrijver 2024-10-08 13:16:18 +02:00
parent 19c80947eb
commit ba3e60376d
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,7 @@ public class ColmiR0xConstants {
public static final byte CMD_MANUAL_HEART_RATE = 0x69;
public static final byte CMD_NOTIFICATION = 0x73;
public static final byte CMD_BIG_DATA_V2 = (byte) 0xbc;
public static final byte CMD_FACTORY_RESET = (byte) 0xff;
public static final byte PREF_READ = 0x01;
public static final byte PREF_WRITE = 0x02;

View File

@ -547,6 +547,13 @@ public class ColmiR0xDeviceSupport extends AbstractBTLEDeviceSupport {
sendWrite("poweroffRequest", poweroffPacket);
}
@Override
public void onReset(int flags) {
byte[] resetPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_FACTORY_RESET, 0x01});
LOG.info("Factory reset request sent: {}", StringUtils.bytesToHex(resetPacket));
sendWrite("resetRequest", resetPacket);
}
@Override
public void onFindDevice(boolean start) {
if (!start) return;