1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

Amazfit Cor: allow to flash latest firmware

This commit is contained in:
Andreas Shimokawa 2018-01-13 16:29:48 +01:00
parent 68bd6f99e2
commit aca31c320a

View File

@ -32,8 +32,11 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
(byte) 0xfe, (byte) 0xe7, (byte) 0xfe, (byte) 0xe7, (byte) 0xfe, (byte) 0xe7, (byte) 0xfe, (byte) 0xe7
};
//FIXME: this is a moving target :/
private static final int FW_HEADER_OFFSET = 0x9330;
private static final int FW_HEADER_OFFSET_2 = 0x9340;
private static final int FW_HEADER_OFFSET_3 = 0x9288;
private static final int NEW_RES_HEADER_OFFSET = 0x9;
private static Map<Integer, String> crcToVersion = new HashMap<>();
@ -62,7 +65,7 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
return HuamiFirmwareType.RES;
} else if (ArrayUtils.equals(bytes, RES_HEADER, NEW_RES_HEADER_OFFSET)) {
return HuamiFirmwareType.RES_NEW;
} else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET) || ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET_2)) {
} else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET) || ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET_2) || ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET_3)) {
// TODO: this is certainly not a correct validation, but it works for now
return HuamiFirmwareType.FIRMWARE;
}