1
0
mirror of https://github.com/CovidBraceletPrj/CovidBracelet.git synced 2024-12-05 00:55:43 +01:00

Trying to optimize Advertising

This commit is contained in:
Patrick Rathje 2022-05-28 00:46:23 +02:00
parent b61709478e
commit ac3277e2ae

View File

@ -26,7 +26,7 @@
typedef ENIntervalIdentifier ENIntervalIdentifier; typedef ENIntervalIdentifier ENIntervalIdentifier;
#define RPI_ROTATION_MS (11*60*1000) #define RPI_ROTATION_MS (11*60*1000)
#define SCAN_INTERVAL_MS (1*60*1000) #define SCAN_INTERVAL_MS (10*1000)
#define SCAN_DURATION_MS 1000 #define SCAN_DURATION_MS 1000
#define ADV_INTERVAL_MS 220 #define ADV_INTERVAL_MS 220
#define ADV_DURATION_MS 1000 #define ADV_DURATION_MS 1000
@ -70,7 +70,7 @@ int tracing_run()
on_adv(); on_adv();
} }
k_sleep(K_MSEC(ADV_INTERVAL_MS)); // TODO: what to put here?
//printk("covid start\n"); //printk("covid start\n");
@ -245,18 +245,14 @@ int on_scan() {
int on_adv() { int on_adv() {
int err = 0; int err = 0;
err = bt_le_adv_start(BT_LE_ADV_PARAM(0, (ADV_INTERVAL_MS-10)/0.625, (ADV_INTERVAL_MS+10)/0.625, NULL), ad, ARRAY_SIZE(ad), NULL, 0);
err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad), NULL, 0);
if (err) if (err)
{ {
printk("Advertising failed to start (err %d)\n", err); printk("Advertising failed to start (err %d)\n", err);
return err; return err;
} }
k_yield();
k_sleep(K_MSEC(ADV_DURATION_MS)); // TODO: what to put here?
err = bt_le_adv_stop(); err = bt_le_adv_stop();
if (err) if (err)
{ {
printk("Advertising failed to stop (err %d)\n", err); printk("Advertising failed to stop (err %d)\n", err);