@@ -840,9 +840,20 @@ static PT_THREAD(broadcast_task(struct pt *pt, pbio_task_t *task)) {
840840 PT_WAIT_UNTIL (pt , hci_command_complete );
841841
842842 if (!is_broadcasting ) {
843- #if PBDRV_CONFIG_BLUETOOTH_STM32_CC2640_QUIRK_BROKEN_NONCONN_IND
844- // On city hub, since we have to use connectable advertisement, we
843+ // Since we have to sometimes use connectable advertisement, we
845844 // set the advertising interval to 100ms to match other platforms.
845+ // We have to do this for both general discoverable and connectable
846+ // depending on if the hub is connected to another device or not.
847+
848+ PT_WAIT_WHILE (pt , write_xfer_size );
849+ GAP_SetParamValue (TGAP_GEN_DISC_ADV_INT_MIN , 0xA0 );
850+ PT_WAIT_UNTIL (pt , hci_command_status );
851+ // ignoring response data
852+
853+ PT_WAIT_WHILE (pt , write_xfer_size );
854+ GAP_SetParamValue (TGAP_GEN_DISC_ADV_INT_MAX , 0xA0 );
855+ PT_WAIT_UNTIL (pt , hci_command_status );
856+ // ignoring response data
846857
847858 PT_WAIT_WHILE (pt , write_xfer_size );
848859 GAP_SetParamValue (TGAP_CONN_ADV_INT_MIN , 0xA0 );
@@ -854,8 +865,6 @@ static PT_THREAD(broadcast_task(struct pt *pt, pbio_task_t *task)) {
854865 PT_WAIT_UNTIL (pt , hci_command_status );
855866 // ignoring response data
856867
857- #endif // PBDRV_CONFIG_BLUETOOTH_STM32_CC2640_QUIRK_BROKEN_NONCONN_IND
858-
859868 PT_WAIT_WHILE (pt , write_xfer_size );
860869 GAP_makeDiscoverable (
861870 #if PBDRV_CONFIG_BLUETOOTH_STM32_CC2640_QUIRK_BROKEN_NONCONN_IND
@@ -910,9 +919,18 @@ static PT_THREAD(stop_broadcast_task(struct pt *pt, pbio_task_t *task)) {
910919 // Status could also be bleIncorrectMode which means "Not advertising".
911920 // This is not expected, but should be safe to ignore.
912921
913- #if PBDRV_CONFIG_BLUETOOTH_STM32_CC2640_QUIRK_BROKEN_NONCONN_IND
914922 // Restore advertising interval from gap_init().
915923
924+ PT_WAIT_WHILE (pt , write_xfer_size );
925+ GAP_SetParamValue (TGAP_GEN_DISC_ADV_INT_MIN , 40 );
926+ PT_WAIT_UNTIL (pt , hci_command_status );
927+ // ignoring response data
928+
929+ PT_WAIT_WHILE (pt , write_xfer_size );
930+ GAP_SetParamValue (TGAP_GEN_DISC_ADV_INT_MAX , 40 );
931+ PT_WAIT_UNTIL (pt , hci_command_status );
932+ // ignoring response data
933+
916934 PT_WAIT_WHILE (pt , write_xfer_size );
917935 GAP_SetParamValue (TGAP_CONN_ADV_INT_MIN , 40 );
918936 PT_WAIT_UNTIL (pt , hci_command_status );
@@ -923,8 +941,6 @@ static PT_THREAD(stop_broadcast_task(struct pt *pt, pbio_task_t *task)) {
923941 PT_WAIT_UNTIL (pt , hci_command_status );
924942 // ignoring response data
925943
926- #endif // PBDRV_CONFIG_BLUETOOTH_STM32_CC2640_QUIRK_BROKEN_NONCONN_IND
927-
928944 is_broadcasting = false;
929945 }
930946
0 commit comments