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 ed1d6ffc0..1db8b75e7 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 @@ -54,6 +54,8 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation { public static final byte COMMAND_COMPLETE_TRANSFER = (byte) 0xd5; public static final byte COMMAND_FINALIZE_UPDATE = (byte) 0xd6; + public static final byte REPLY_ERROR_FREE_SPACE = (byte) 0x47; + protected int mChunkLength = -1; @Override @@ -133,7 +135,13 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation { LOG.error("Unexpected notification during firmware update: "); operationFailed(); getSupport().logMessageContent(value); - displayMessage(getContext(), getContext().getString(R.string.updatefirmwareoperation_metadata_updateproblem), Toast.LENGTH_LONG, GB.ERROR); + 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; + } + 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 eeea5e104..e79974627 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -824,6 +824,7 @@ %1$s (%2$s) 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 Firmware installation complete Firmware installation complete, rebooting deviceā€¦ Firmware flashing failed