diff --git a/lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java b/lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java index 242b16c5..d2fc0c4f 100644 --- a/lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java +++ b/lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java @@ -778,7 +778,7 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres * Stores the last progress percent. Used to prevent from sending progress notifications with * the same value. */ - private int mLastProgress = -1; + private int mLastProgress = 0; /* package */ DfuProgressInfo mProgressInfo; private long mLastNotificationTime; @@ -1661,6 +1661,8 @@ protected void disconnect(@NonNull final BluetoothGatt gatt) { if (mConnectionState == STATE_DISCONNECTED) return; + mConnectionState = STATE_DISCONNECTING; + sendLogBroadcast(LOG_LEVEL_VERBOSE, "Disconnecting..."); mProgressInfo.setProgress(PROGRESS_DISCONNECTING); @@ -1763,7 +1765,7 @@ protected void refreshDeviceCache(@NonNull final BluetoothGatt gatt, final boole public void updateProgressNotification() { final DfuProgressInfo info = mProgressInfo; final int progress = info.getProgress(); - if (mLastProgress == progress) + if (mLastProgress == progress && progress >= 0 && progress <= 100) return; mLastProgress = progress;