mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Amazfit Bip U Pro: Fix flashing firmware, res, font, watchfaces
This commit is contained in:
parent
d9a77540ce
commit
48e5f44b81
@ -19,7 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipupr
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
||||
@ -42,37 +41,35 @@ public class AmazfitBipUProFirmwareInfo extends HuamiFirmwareInfo {
|
||||
@Override
|
||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||
|
||||
GBDevice device = GBApplication.app().getDeviceManager().getSelectedDevice();
|
||||
|
||||
if (ArrayUtils.equals(bytes, MiBand4FirmwareInfo.FW_HEADER, MiBand4FirmwareInfo.FW_HEADER_OFFSET)) {
|
||||
if (searchString32BitAligned(bytes, "Amazfit Bip U Pro")) {
|
||||
if (searchString32BitAligned(bytes, "\0\0Amazfit Bip U Pro")) {
|
||||
return HuamiFirmwareType.FIRMWARE;
|
||||
}
|
||||
return HuamiFirmwareType.INVALID;
|
||||
|
||||
}
|
||||
|
||||
if (ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET) ||
|
||||
ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET_NEW)) {
|
||||
return HuamiFirmwareType.RES_COMPRESSED;
|
||||
if (ArrayUtils.startsWith(bytes, NEWRES_HEADER)) {
|
||||
return HuamiFirmwareType.RES;
|
||||
}
|
||||
|
||||
if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) {
|
||||
if (ArrayUtils.startsWith(bytes, UIHH_HEADER) && (bytes[4] == 1 || bytes[4] == 2)) {
|
||||
return HuamiFirmwareType.WATCHFACE;
|
||||
}
|
||||
if (ArrayUtils.startsWith(bytes, GPS_ALMANAC_HEADER)) {
|
||||
return HuamiFirmwareType.GPS_ALMANAC;
|
||||
}
|
||||
if (ArrayUtils.startsWith(bytes, GPS_CEP_HEADER)) {
|
||||
return HuamiFirmwareType.GPS_CEP;
|
||||
}
|
||||
|
||||
if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) {
|
||||
if (bytes[10] == 0x01 || bytes[10] == 0x06 || bytes[10] == 0x03) {
|
||||
return HuamiFirmwareType.FONT;
|
||||
} else if (bytes[10] == 0x02 || bytes[10] == 0x0A) {
|
||||
return HuamiFirmwareType.FONT_LATIN;
|
||||
}
|
||||
}
|
||||
|
||||
if (ArrayUtils.startsWith(bytes, GPS_ALMANAC_HEADER)) {
|
||||
return HuamiFirmwareType.GPS_ALMANAC;
|
||||
}
|
||||
|
||||
if (ArrayUtils.startsWith(bytes, GPS_CEP_HEADER)) {
|
||||
return HuamiFirmwareType.GPS_CEP;
|
||||
}
|
||||
|
||||
for (byte[] gpsHeader : GPS_HEADERS) {
|
||||
if (ArrayUtils.startsWith(bytes, gpsHeader)) {
|
||||
return HuamiFirmwareType.GPS;
|
||||
|
Loading…
Reference in New Issue
Block a user