@@ -602,9 +602,9 @@ void mmSetBluetoothProtocol(BluetoothRadioType_e bluetoothUserChoice, bool clear
602602 && (bluetoothUserChoice != BLUETOOTH_RADIO_OFF)
603603 && (bluetoothRadioPreviousOnType == BLUETOOTH_RADIO_OFF))
604604 {
605- bluetoothStart ();
606605 settings.bluetoothRadioType = bluetoothUserChoice;
607606 settings.clearBtPairings = clearBtPairings;
607+ bluetoothStart ();
608608 return ;
609609 }
610610 // If Bluetooth was off, and the user has selected on, and Bluetooth has been started previously
@@ -622,14 +622,23 @@ void mmSetBluetoothProtocol(BluetoothRadioType_e bluetoothUserChoice, bool clear
622622 return ;
623623 }
624624 // If Bluetooth was in Accessory Mode, and still is, and clearBtPairings is true
625- // then restart skipping the online check
625+ // then (re)start Bluetooth skipping the online check
626626 else if ((settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
627627 && (bluetoothUserChoice == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
628628 && clearBtPairings)
629629 {
630+ settings.clearBtPairings = clearBtPairings;
630631 bluetoothStartSkipOnlineCheck ();
631632 return ;
632633 }
634+ // If Bluetooth was in Accessory Mode, and still is, and clearBtPairings is false
635+ // then do nothing
636+ else if ((settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
637+ && (bluetoothUserChoice == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
638+ && (!clearBtPairings))
639+ {
640+ return ;
641+ }
633642 // If Bluetooth was on, and the user has selected a different mode
634643 // then restart
635644 else if ((settings.bluetoothRadioType != BLUETOOTH_RADIO_OFF)
@@ -643,7 +652,7 @@ void mmSetBluetoothProtocol(BluetoothRadioType_e bluetoothUserChoice, bool clear
643652 ESP.restart ();
644653 return ;
645654 }
646- // <--- Insert any new special cases here --->
655+ // <--- Insert any new special cases here, or higher up if needed --->
647656
648657 // Previous catch-all. Likely to cause connection failures...
649658 bluetoothStop ();
0 commit comments