summaryrefslogtreecommitdiff
path: root/firmware/bluetooth_rxtx
diff options
context:
space:
mode:
authorMike Ryan <mikeryan@lacklustre.net>2017-03-01 10:31:44 -0800
committerMike Ryan <mikeryan@lacklustre.net>2017-03-01 10:31:44 -0800
commit3f0827419efb1dff262dfa9ab64dc24fe6d9515b (patch)
treec537b170f21d0bb3964a927be9a01922238ab27b /firmware/bluetooth_rxtx
parente4c2928e8acacbd41ca01ba3055fe9dfe4759579 (diff)
le: return to requested advertising channel after connection following
Closes #210, with a very similar patch to the one provided by @tsvehagen. Thanks!
Diffstat (limited to 'firmware/bluetooth_rxtx')
-rw-r--r--firmware/bluetooth_rxtx/bluetooth_rxtx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/bluetooth_rxtx/bluetooth_rxtx.c b/firmware/bluetooth_rxtx/bluetooth_rxtx.c
index cc15d3f..4ba7d69 100644
--- a/firmware/bluetooth_rxtx/bluetooth_rxtx.c
+++ b/firmware/bluetooth_rxtx/bluetooth_rxtx.c
@@ -48,7 +48,7 @@ volatile uint16_t channel = 2441;
volatile uint16_t hop_direct_channel = 0; // for hopping directly to a channel
volatile uint16_t hop_timeout = 158;
volatile uint16_t requested_channel = 0;
-volatile uint16_t saved_request = 0;
+volatile uint16_t le_adv_channel = 2402;
/* bulk USB stuff */
volatile uint8_t idle_buf_clkn_high = 0;
@@ -361,6 +361,7 @@ static int vendor_request_handler(uint8_t request, uint16_t* request_params, uin
requested_channel = MIN(requested_channel, MAX_FREQ);
}
+ le_adv_channel = requested_channel;
if (mode != MODE_BT_FOLLOW_LE) {
channel = requested_channel;
requested_channel = 0;
@@ -841,7 +842,7 @@ static void cc2400_idle()
hop_direct_channel = 0;
hop_timeout = 158;
requested_channel = 0;
- saved_request = 0;
+ le_adv_channel = 2402;
/* bulk USB stuff */
@@ -1653,7 +1654,6 @@ void bt_le_sync(u8 active_mode)
/* RX mode */
cc2400_strobe(SRX);
- saved_request = requested_channel;
requested_channel = 0;
}
@@ -1787,7 +1787,7 @@ void bt_le_sync(u8 active_mode)
while ((cc2400_status() & FS_LOCK));
/* Retune */
- channel = saved_request != 0 ? saved_request : 2402;
+ channel = le_adv_channel != 0 ? le_adv_channel : 2402;
restart_jamming = 1;
}