@@ -304,7 +304,7 @@ int jsble_exec_pending(uint8_t *buffer, int bufferLen) {
304
304
assert (IOEVENT_MAX_LEN >= NRF_BLE_MAX_MTU_SIZE );
305
305
int eventBytesHandled = 2 + bufferLen ;
306
306
// Now handle the actual event
307
- if (bufferLen < 3 ) return ;
307
+ if (bufferLen < 3 ) return 0 ;
308
308
BLEPending blep = (BLEPending )buffer [0 ];
309
309
uint16_t data = (uint16_t )(buffer [1 ] | (buffer [2 ]<<8 ));
310
310
// skip first 3 bytes
@@ -1213,7 +1213,7 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) {
1213
1213
#else
1214
1214
int centralIdx = -1 ;
1215
1215
#endif
1216
- if (centralIdx < 0 ) {
1216
+ if (centralIdx < 0 ) { // Peripheral Connection
1217
1217
bleStatus &= ~BLE_IS_RSSI_SCANNING ; // scanning will have stopped now we're disconnected
1218
1218
m_peripheral_conn_handle = BLE_CONN_HANDLE_INVALID ;
1219
1219
// if we were on bluetooth and we disconnected, clear the input line so we're fresh next time (#2219)
@@ -1229,6 +1229,9 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) {
1229
1229
// restart advertising after disconnection
1230
1230
if (!(bleStatus & BLE_IS_SLEEPING ))
1231
1231
jsble_queue_pending (BLEP_ADVERTISING_START , 0 ); // start advertising again
1232
+ // If we were debugging and got disconnected, exit the debugger
1233
+ if (jsiStatus & JSIS_IN_DEBUGGER )
1234
+ jsiStatus |= JSIS_EXIT_DEBUGGER ;
1232
1235
}
1233
1236
if ((bleStatus & BLE_NEEDS_SOFTDEVICE_RESTART ) && !jsble_has_connection ())
1234
1237
jsble_queue_pending (BLEP_RESTART_SOFTDEVICE , 0 );
0 commit comments