From 495ba0e598a82a66c159038044de31aa44603241 Mon Sep 17 00:00:00 2001 From: lihuanhuan Date: Wed, 31 Jan 2024 11:30:35 +0800 Subject: [PATCH] Increase the priority of entering boot mode via button press. (#15) --- .../components/libraries/bootloader/nrf_bootloader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ble-firmware/components/libraries/bootloader/nrf_bootloader.c b/ble-firmware/components/libraries/bootloader/nrf_bootloader.c index 2aaf061..74b967f 100644 --- a/ble-firmware/components/libraries/bootloader/nrf_bootloader.c +++ b/ble-firmware/components/libraries/bootloader/nrf_bootloader.c @@ -354,12 +354,6 @@ static void dfu_enter_flags_clear(void) */ static bool dfu_enter_check(void) { - if (!app_is_valid(crc_on_valid_app_required())) - { - NRF_LOG_DEBUG("DFU mode because app is not valid."); - return true; - } - if (NRF_BL_DFU_ENTER_METHOD_BUTTON && (nrf_gpio_pin_read(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN) == 0)) { @@ -367,6 +361,12 @@ static bool dfu_enter_check(void) button_dfu_flag = 1; return true; } + + if (!app_is_valid(crc_on_valid_app_required())) + { + NRF_LOG_DEBUG("DFU mode because app is not valid."); + return true; + } if (NRF_BL_DFU_ENTER_METHOD_PINRESET && (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk))