add enableOTA(bool)

This commit is contained in:
hathach committed 2019-02-01 18:49:23 +07:00
1 parent 58106006b9
commit 00816a2de2
3 files changed
+13 -2

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
- Use AdaCallback thread for BLECharacteristic callbacks
- Update bootloader to 0.2.7 which fixed OTA issue with latest BLE5 central such as iPhone X
- Added Metro nRF52840 Board support
- Added enableOTA(bool) to disable/enable OTA service (default is enable)
# 0.9.3
+8 -2
View File
@@ -137,6 +137,8 @@ AdafruitBluefruit::AdafruitBluefruit(void)
_led_blink_th = NULL;
_led_conn = true;
_ota_en = true;
_tx_power = CFG_BLE_TX_POWER_LEVEL;
_conn_hdl = BLE_CONN_HANDLE_INVALID;
@@ -254,6 +256,10 @@ void AdafruitBluefruit::configCentralBandwidth(uint8_t bw)
}
}
void AdafruitBluefruit::enableOTA(bool en)
{
_ota_en = en;
}
bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
{
@@ -452,8 +458,8 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
sd_power_usbremoved_enable(true);
#endif
/*------------- DFU OTA as built-in service -------------*/
_dfu_svc.begin();
// Add DFU OTA service if enabled
if ( _ota_en ) _dfu_svc.begin();
if (_central_count) Central.begin(); // Init Central
+4
View File
@@ -135,6 +135,8 @@ class AdafruitBluefruit
void configPrphBandwidth (uint8_t bw);
void configCentralBandwidth(uint8_t bw);
void enableOTA(bool en);
bool begin(uint8_t prph_count = 1, uint8_t central_count = 0);
/*------------------------------------------------------------------*/
@@ -231,6 +233,8 @@ class AdafruitBluefruit
TimerHandle_t _led_blink_th;
bool _led_conn;
bool _ota_en;
BLEDfu _dfu_svc;
uint16_t _conn_hdl;