1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-05 04:21:35 +02:00

Mi Band 3: Support flashing latest Japanese-Korean font file

This increases the supported file size to 2.0MB.
Somehow it is confusing that the new file is version 1 and the old version 2.
Also according to firmare.json both are version 1....
This commit is contained in:
Andreas Shimokawa 2019-05-07 11:13:48 +02:00
parent 0399bc048c
commit f7fe3a836f
2 changed files with 4 additions and 2 deletions

View File

@ -51,7 +51,7 @@ public abstract class AbstractMiBandFWHelper {
}
try (InputStream in = new BufferedInputStream(uriHelper.openInputStream())) {
this.fw = FileUtils.readAll(in, 1024 * 1536); // 1.5 MB
this.fw = FileUtils.readAll(in, 1024 * 2048); // 2.0 MB
determineFirmwareInfo(fw);
} catch (IOException ex) {
throw ex; // pass through

View File

@ -70,6 +70,8 @@ public class MiBand3FirmwareInfo extends HuamiFirmwareInfo {
// font
crcToVersion.put(19775, "1");
crcToVersion.put(42959, "2 (old Jap/Kor)");
crcToVersion.put(12052, "1 (Jap/Kor)");
}
public MiBand3FirmwareInfo(byte[] bytes) {
@ -79,7 +81,7 @@ public class MiBand3FirmwareInfo extends HuamiFirmwareInfo {
@Override
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
if (ArrayUtils.startsWith(bytes, FT_HEADER)) {
if (bytes[FONT_TYPE_OFFSET] == 0x03 || bytes[FONT_TYPE_OFFSET] == 0x04) {
if (bytes[FONT_TYPE_OFFSET] >= 0x03 && bytes[FONT_TYPE_OFFSET] <= 0x05) {
return HuamiFirmwareType.FONT;
}
return HuamiFirmwareType.INVALID;