| @@ -70,4 +70,7 @@ static inline bool button_pressed(uint32_t pin) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| bool is_ota(void); | ||||
|  | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										19
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/main.c
									
									
									
									
									
								
							| @@ -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) ) | ||||
|   { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user