mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Amazfit Cor: support flashing new res format also on Cor
This commit is contained in:
parent
14a6c9a626
commit
f6f4d7ec40
@ -27,7 +27,6 @@ import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||
|
||||
public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
|
||||
protected HuamiFirmwareInfo firmwareInfo;
|
||||
@ -60,9 +59,7 @@ public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
|
||||
resId = R.string.kind_gps_cep;
|
||||
break;
|
||||
case RES:
|
||||
resId = R.string.kind_resources;
|
||||
break;
|
||||
case RES_NEW:
|
||||
case RES_COMPRESSED:
|
||||
resId = R.string.kind_resources;
|
||||
break;
|
||||
case FIRMWARE:
|
||||
|
@ -60,7 +60,7 @@ public abstract class HuamiFirmwareInfo {
|
||||
case RES:
|
||||
version = "RES " + Integer.toString(bytes[5]);
|
||||
break;
|
||||
case RES_NEW:
|
||||
case RES_COMPRESSED:
|
||||
version = "RES " + Integer.toString(bytes[14]);
|
||||
break;
|
||||
case FONT:
|
||||
|
@ -20,7 +20,7 @@ public enum HuamiFirmwareType {
|
||||
FIRMWARE((byte) 0),
|
||||
FONT((byte) 1),
|
||||
RES((byte) 2),
|
||||
RES_NEW((byte)130),
|
||||
RES_COMPRESSED((byte)130),
|
||||
GPS((byte) 3),
|
||||
GPS_CEP((byte) 4),
|
||||
GPS_ALMANAC((byte)5),
|
||||
|
@ -37,7 +37,7 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
|
||||
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 final int COMPRESSED_RES_HEADER_OFFSET = 0x9;
|
||||
|
||||
private static Map<Integer, String> crcToVersion = new HashMap<>();
|
||||
|
||||
@ -63,8 +63,8 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
|
||||
return HuamiFirmwareType.INVALID;
|
||||
}
|
||||
return HuamiFirmwareType.RES;
|
||||
} else if (ArrayUtils.equals(bytes, RES_HEADER, NEW_RES_HEADER_OFFSET)) {
|
||||
return HuamiFirmwareType.RES_NEW;
|
||||
} else if (ArrayUtils.equals(bytes, RES_HEADER, COMPRESSED_RES_HEADER_OFFSET) || ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET)) {
|
||||
return HuamiFirmwareType.RES_COMPRESSED;
|
||||
} 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;
|
||||
|
Loading…
Reference in New Issue
Block a user