Fixed connection timing issue

This commit is contained in:
Adam Greenwood-Byrne 2020-08-11 09:09:13 +01:00
parent 0fde327830
commit e1f5c41c6d
3 changed files with 5 additions and 3 deletions

View file

@ -262,8 +262,9 @@ void startActiveScanning() {
unsigned int p = BleScanInterval / BleScanDivisor;
unsigned int q = BleScanWindow / BleScanDivisor;
setLEwhitelist();
setLEscanparameters(LL_SCAN_ACTIVE, lo(p), hi(p), lo(q), hi(q), 0, 1);
//setLEwhitelist();
//setLEscanparameters(LL_SCAN_ACTIVE, lo(p), hi(p), lo(q), hi(q), 0, 1);
setLEscanparameters(LL_SCAN_ACTIVE, lo(p), hi(p), lo(q), hi(q), 0, 0);
setLEscanenable(1, 0);
}

View file

@ -11,3 +11,4 @@ void startActiveScanning();
void stopScanning();
void startActiveAdvertising();
void connect(unsigned char *addr);
void bt_flushrx();

View file

@ -171,9 +171,9 @@ void main()
startActiveScanning();
uart_writeText("Waiting for echo: ");
while (!(got_echo_sid && got_echo_name)) bt_search();
stopScanning();
for (int c=0;c<=5;c++) uart_byte(echo_addr[c]);
uart_writeText("\n");
stopScanning();
// Ask to connect to the echo
uart_writeText("Connecting to echo: ");