diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/UpdateFirmwareOperation2020.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/UpdateFirmwareOperation2020.java
index 1db8b75e7..2ab9d6277 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/UpdateFirmwareOperation2020.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/UpdateFirmwareOperation2020.java
@@ -55,6 +55,7 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation {
public static final byte COMMAND_FINALIZE_UPDATE = (byte) 0xd6;
public static final byte REPLY_ERROR_FREE_SPACE = (byte) 0x47;
+ public static final byte REPLY_ERROR_LOW_BATTERY = (byte) 0x22;
protected int mChunkLength = -1;
@@ -137,9 +138,13 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation {
getSupport().logMessageContent(value);
int errorMessage = R.string.updatefirmwareoperation_metadata_updateproblem;
// Display a more specific error message for known errors
+
if (value[0] == HuamiService.RESPONSE && value[1] == COMMAND_START_TRANSFER && value[2] == REPLY_ERROR_FREE_SPACE) {
// Not enough free space on the device
errorMessage = R.string.updatefirmwareoperation_updateproblem_free_space;
+ } else if (value[0] == HuamiService.RESPONSE && value[1] == COMMAND_SEND_FIRMWARE_INFO && value[2] == REPLY_ERROR_LOW_BATTERY) {
+ // Battery is too low
+ errorMessage = R.string.updatefirmwareoperation_updateproblem_low_battery;
}
displayMessage(getContext(), getContext().getString(errorMessage), Toast.LENGTH_LONG, GB.ERROR);
done();
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c91041c58..df1cafc7a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -858,6 +858,7 @@
Problem with the firmware transfer. DO NOT REBOOT your Mi Band!
Problem with the firmware metadata transfer
The device does not have enough free space
+ The device battery is too low
Firmware installation complete
Firmware installation complete, rebooting deviceā¦
Firmware flashing failed