@@ -119,7 +119,8 @@ void setup()
119119
120120 // Configure and Start BLE Uart Service
121121 // Set Permission to access BLE Uart is to require man-in-the-middle protection
122- // This will cause central to perform pairing with static PIN we set above
122+ // This will cause central to perform pairing with a generated passkey, the passkey will
123+ // be printed on display or Serial and wait for our input
123124 Serial.println (" Configure BLE Uart to require man-in-the-middle protection for PIN pairing" );
124125 bleuart.setPermission (SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM);
125126 bleuart.begin ();
@@ -266,7 +267,7 @@ bool pairing_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bo
266267 uint32_t justReleased;
267268 do
268269 {
269- // Disconnected while waiting for input
270+ // Peer is disconnected while waiting for input
270271 if ( !Bluefruit.connected (conn_handle) ) break ;
271272
272273 // time out
@@ -286,7 +287,7 @@ bool pairing_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bo
286287 // wait until either button is pressed (30 seconds timeout)
287288 while ( digitalRead (BUTTON_YES) && digitalRead (BUTTON_NO) )
288289 {
289- // Disconnected while waiting for input
290+ // Peer is disconnected while waiting for input
290291 if ( !Bluefruit.connected (conn_handle) ) break ;
291292
292293 // time out
@@ -355,6 +356,9 @@ void disconnect_callback(uint16_t conn_handle, uint8_t reason)
355356 Serial.print (" Disconnected, reason = 0x" ); Serial.println (reason, HEX);
356357
357358#ifdef USE_ARCADA
359+ tft->fillScreen (ARCADA_BLACK);
360+ tft->setTextSize (2 );
361+ tft->setCursor (0 , 0 );
358362 tft->println (" Advertising ..." );
359363#endif
360364}
0 commit comments