summaryrefslogtreecommitdiff
path: root/src/components/ble
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2021-07-23 22:52:08 +0300
committerGitHub <noreply@github.com>2021-07-23 22:52:08 +0300
commitd666c5004f27da2c72abd6f94881143bc157a10d (patch)
tree75d0afb1853029264cb1198af9521c3bd1fe675e /src/components/ble
parentdc2b5f0c6b387f674915d0dbe817b7ac2a821e07 (diff)
parentd6cccc2dcd95a7d332ee657d1357ae060389f6e6 (diff)
Merge branch 'develop' into new_touch_handler
Diffstat (limited to 'src/components/ble')
-rw-r--r--src/components/ble/DfuService.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp
index e6bcea81..4179994d 100644
--- a/src/components/ble/DfuService.cpp
+++ b/src/components/ble/DfuService.cpp
@@ -266,13 +266,14 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf* om) {
static_cast<uint8_t>(ErrorCodes::NoError)};
notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3);
} else {
- bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error);
NRF_LOG_INFO("Image Error : bad CRC");
uint8_t data[3] {static_cast<uint8_t>(Opcodes::Response),
static_cast<uint8_t>(Opcodes::ValidateFirmware),
static_cast<uint8_t>(ErrorCodes::CrcError)};
notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3);
+ bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error);
+ Reset();
}
return 0;
@@ -283,10 +284,8 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf* om) {
return 0;
}
NRF_LOG_INFO("[DFU] -> Activate image and reset!");
- bleController.StopFirmwareUpdate();
- systemTask.PushMessage(Pinetime::System::Messages::BleFirmwareUpdateFinished);
- Reset();
bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated);
+ Reset();
return 0;
default:
return 0;
@@ -294,6 +293,7 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf* om) {
}
void DfuService::OnTimeout() {
+ bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error);
Reset();
}
@@ -307,7 +307,6 @@ void DfuService::Reset() {
applicationSize = 0;
expectedCrc = 0;
notificationManager.Reset();
- bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error);
bleController.StopFirmwareUpdate();
systemTask.PushMessage(Pinetime::System::Messages::BleFirmwareUpdateFinished);
}