close #18, close #19

softdevice is only enabled with OTA mode
This commit is contained in:
hathach
2018-08-13 21:50:55 +07:00
parent fe712fb588
commit 1c2911a63c
6 changed files with 23 additions and 41 deletions

View File

@ -70,4 +70,7 @@ static inline bool button_pressed(uint32_t pin)
}
bool is_ota(void);
#endif

View File

@ -299,13 +299,6 @@ uint32_t softdev_init(bool init_softdevice)
return NRF_SUCCESS;
}
void softdev_teardown(void)
{
sd_softdevice_disable();
}
int main(void)
{
// SD is already Initialized in case of BOOTLOADER_DFU_OTA_MAGIC
@ -330,17 +323,12 @@ int main(void)
board_init();
bootloader_init();
// When updating SoftDevice, bootloader will reset before swapping SD
if (bootloader_dfu_sd_in_progress())
{
APP_ERROR_CHECK( bootloader_dfu_sd_update_continue() );
softdev_init(!sd_inited);
sd_inited = true;
APP_ERROR_CHECK( bootloader_dfu_sd_update_finalize() );
}
else
{
// softdev_init();
}
/*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/
// DFU button pressed
@ -362,6 +350,8 @@ int main(void)
// Initiate an update of the firmware.
APP_ERROR_CHECK( bootloader_dfu_start(_ota_update, 0) );
if ( _ota_update ) sd_softdevice_disable();
}
#ifdef NRF52832_XXAA
else
@ -373,9 +363,6 @@ int main(void)
}
#endif
// we are all done with DFU, disable soft device
softdev_teardown();
/*------------- Adafruit Factory reset -------------*/
if ( !button_pressed(BUTTON_DFU) && button_pressed(BUTTON_FRESET) )
{

View File

@ -1,5 +1,5 @@
#define UF2_VERSION "1.00"
#define PRODUCT_NAME "Adafruit Bluefruit nRF52"
#define PRODUCT_NAME "Adafruit Bluefruit nRF52840"
#define BOARD_ID "NRF52-Bluefruit-v0"
#define INDEX_URL "https://www.adafruit.com/product/0000"
#define BOOTLOADER_ID MK_DIS_FIRMWARE