Skip to content

Commit

Permalink
Merge pull request #317 from dev-cqkct/main
Browse files Browse the repository at this point in the history
修复中断升级后,恢复升级可能卡住无法继续的问题。
  • Loading branch information
philips77 authored Dec 8, 2021
2 parents e6e7626 + 25c0118 commit fe0ed15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,11 @@ void uploadFirmwareImage(final BluetoothGattCharacteristic packetCharacteristic)
mFirmwareUploadInProgress = true;
mPacketsSentSinceNotification = 0;

final byte[] buffer = mBuffer;
try {
final int available = mProgressInfo.getAvailableObjectSizeIsBytes();
byte[] buffer = mBuffer;
if (available < buffer.length)
buffer = new byte[available];
final int size = mFirmwareStream.read(buffer);
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE,
"Sending firmware to characteristic " + packetCharacteristic.getUuid() + "...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ private void sendFirmware(final BluetoothGatt gatt) throws RemoteDfuException,
throw e;
}
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_APPLICATION, "Data object already executed");
// At this point, the error flag should be cleared, and the subsequent process can be executed normally.
mRemoteErrorOccurred = false;
}
} else {
resumeSendingData = true;
Expand Down

0 comments on commit fe0ed15

Please sign in to comment.