This commit is contained in:
Eduardo José Tagle
2026-02-02 14:28:35 -03:00
3 changed files with 14 additions and 12 deletions
@@ -140,7 +140,7 @@ static void wait_for_events(void)
(m_update_status == BOOTLOADER_SYS_RESET) ||
(m_update_status == BOOTLOADER_RESET_TO_SELF))
{
// When update has completed or a timeout/reset occured we will return.
// When update has completed or a timeout/reset occurred we will return.
return;
}
}
@@ -191,8 +191,9 @@ static void bootloader_settings_save(bootloader_settings_t * p_settings)
uint32_t err_code;
while(1) {
err_code = pstorage_clear(&m_bootsettings_handle, sizeof(bootloader_settings_t));
if (err_code != NRF_ERROR_NO_MEM)
if (err_code != NRF_ERROR_NO_MEM) {
break;
}
// This means the write/erase queue of commands was completely full - Should not
// happen, but better safe than sorry, wait until space becomes available -
// the pstorage event handler is only run from the main loop, and we are also
@@ -209,8 +210,9 @@ static void bootloader_settings_save(bootloader_settings_t * p_settings)
while(1) {
err_code = pstorage_store(&m_bootsettings_handle, (uint8_t *) p_settings, sizeof(bootloader_settings_t), 0);
if (err_code != NRF_ERROR_NO_MEM)
if (err_code != NRF_ERROR_NO_MEM) {
break;
}
// No space, wait until an entry in the queue is freed
while (NRF_ERROR_NOT_FOUND != proc_soc()) {
// nothing
@@ -322,9 +324,8 @@ void bootloader_dfu_update_process(dfu_update_status_t update_status)
}
else if (update_status.status_code == DFU_RESET)
{
m_update_status = update_status.restart_into_bootloader == false
? BOOTLOADER_SYS_RESET
: BOOTLOADER_RESET_TO_SELF;
m_update_status =
(update_status.restart_into_bootloader == false ? BOOTLOADER_SYS_RESET : BOOTLOADER_RESET_TO_SELF);
}
else
{
@@ -789,8 +789,9 @@ uint32_t dfu_bl_image_validate(void)
sd_mbr_cmd_1.params.compare.len = bootloader_settings.bl_image_size / sizeof(uint32_t);
uint32_t err_code = sd_mbr_command(&sd_mbr_cmd_1);
if (err_code == NRF_SUCCESS)
return NRF_SUCCESS;
if (err_code == NRF_SUCCESS) {
return NRF_SUCCESS;
}
uint32_t bl_image_start_2 = (bootloader_settings.sd_image_size == 0) ?
DFU_BANK_1_REGION_START :
+4 -4
View File
@@ -134,7 +134,7 @@ uint32_t* dbl_reset_mem = ((uint32_t*) DFU_DBL_RESET_MEM);
// true if ble, false if serial
bool _ota_dfu = false;
bool _ota_connected = false;
bool _ota_was_active = false;
bool _ota_was_connected = false;
bool _sd_inited = false;
bool is_ota(void) {
@@ -231,7 +231,7 @@ int main(void) {
// Reset the system with the OTA DFU update in case we were in it,
// to allow completion of FLASHING, otherwise, default to normal reset
if (_ota_was_active) {
if (_ota_was_connected) {
NRF_POWER->GPREGRET = DFU_MAGIC_OTA_RESET;
}
@@ -526,8 +526,8 @@ uint32_t proc_ble(void) {
_ota_connected = true;
// Remember someone connected to BLE
_ota_was_active = true;
// Remember someone connected to BLE
_ota_was_connected = true;
led_state(STATE_BLE_CONNECTED);
break;
}