Skip to content

Commit 7063af6

Browse files
fix not running dispatch
1 parent 7da9b62 commit 7063af6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

BLE_Privacy/source/main.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,19 @@ class PrivacyDevice : private mbed::NonCopyable<PrivacyDevice>,
7373
if (_ble.hasInitialized()) {
7474
/* ble instance already initialised, skip init and start activity */
7575
start();
76-
return;
77-
}
78-
79-
/* this will inform us off all events so we can schedule their handling
80-
* using our event queue */
81-
_ble.onEventsToProcess(
82-
makeFunctionPointer(this, &PrivacyDevice::schedule_ble_events)
83-
);
76+
} else {
77+
/* this will inform us off all events so we can schedule their handling
78+
* using our event queue */
79+
_ble.onEventsToProcess(
80+
makeFunctionPointer(this, &PrivacyDevice::schedule_ble_events)
81+
);
8482

85-
error = _ble.init(this, &PrivacyDevice::on_init_complete);
83+
ble_error_t error = _ble.init(this, &PrivacyDevice::on_init_complete);
8684

87-
if (error) {
88-
printf("Error returned by BLE::init.\r\n");
89-
return;
85+
if (error) {
86+
printf("Error returned by BLE::init.\r\n");
87+
return;
88+
}
9089
}
9190

9291
/* this will not return until shutdown */

0 commit comments

Comments
 (0)