scan performance optimizations
This commit is contained in:
1 parent
9bdc7291d8
commit
30178bbf43
8 files changed
+20
-16
No files matched your search
+8
-8
@@ -88,8 +88,8 @@ static const char *btsig_gap_type(uint32_t gap_type) {
|
||||
}
|
||||
} // btsig_gap_type
|
||||
|
||||
|
||||
static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
|
||||
// using IRAM_:ATTR here to speed up callback function
|
||||
IRAM_ATTR static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
|
||||
{
|
||||
esp_ble_gap_cb_param_t *p = (esp_ble_gap_cb_param_t *)param;
|
||||
esp_err_t status;
|
||||
@@ -188,7 +188,7 @@ esp_err_t register_ble_functionality(void)
|
||||
|
||||
// This function is called to occur gap event, such as scan result.
|
||||
//register the scan callback function to the gap module
|
||||
status = esp_ble_gap_register_callback(gap_callback_handler);
|
||||
status = esp_ble_gap_register_callback(&gap_callback_handler);
|
||||
if (status != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "esp_ble_gap_register_callback: rc=%d", status);
|
||||
@@ -226,11 +226,11 @@ esp_err_t register_ble_functionality(void)
|
||||
|
||||
void stop_BLEscan(void){
|
||||
ESP_LOGI(TAG, "Shutting BT Down ...");
|
||||
esp_ble_gap_register_callback(NULL);
|
||||
esp_bluedroid_disable();
|
||||
esp_bluedroid_deinit();
|
||||
esp_bt_controller_disable();
|
||||
esp_bt_controller_deinit();
|
||||
ESP_ERROR_CHECK(esp_ble_gap_register_callback(NULL));
|
||||
ESP_ERROR_CHECK(esp_bluedroid_disable());
|
||||
ESP_ERROR_CHECK(esp_bluedroid_deinit());
|
||||
ESP_ERROR_CHECK(esp_bt_controller_disable());
|
||||
ESP_ERROR_CHECK(esp_bt_controller_deinit());
|
||||
}
|
||||
|
||||
void start_BLEscan(void){
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
*
|
||||
* Read the values from TTN console (or whatever applies), insert them here,
|
||||
* and rename this file to src/loraconf.h
|
||||
*
|
||||
* Note that DEVEUI, APPEUI and APPKEY should all be specified in MSB format.
|
||||
* (This is different from standard LMIC-Arduino which expects DEVEUI and APPEUI in LSB format.)
|
||||
|
||||
* Set your DEVEUI here, if you have one. You can leave this untouched,
|
||||
* then the DEVEUI will be generated during runtime from device's MAC adress
|
||||
|
||||
+2
-1
@@ -102,7 +102,8 @@ void wifi_sniffer_set_channel(uint8_t channel) {
|
||||
esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
|
||||
}
|
||||
|
||||
void wifi_sniffer_packet_handler(void* buff, wifi_promiscuous_pkt_type_t type) {
|
||||
// using IRAM_:ATTR here to speed up callback function
|
||||
IRAM_ATTR void wifi_sniffer_packet_handler(void* buff, wifi_promiscuous_pkt_type_t type) {
|
||||
const wifi_promiscuous_pkt_t *ppkt = (wifi_promiscuous_pkt_t *)buff;
|
||||
const wifi_ieee80211_packet_t *ipkt = (wifi_ieee80211_packet_t *)ppkt->payload;
|
||||
const wifi_ieee80211_mac_hdr_t *hdr = &ipkt->hdr;
|
||||
|
||||
+1
-1
@@ -327,7 +327,7 @@ uint64_t uptime() {
|
||||
if (cfg.blescan)
|
||||
u8x8.printf("BLTH:%-4d", macs_ble);
|
||||
else
|
||||
u8x8.printf("%-16s", "BLTH:off");
|
||||
u8x8.printf("%s", "BLTH:off");
|
||||
#endif
|
||||
|
||||
// update LoRa SF display (line 3)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
// program version - note: increment version after modifications to configData_t struct!!
|
||||
#define PROGVERSION "1.3.5" // use max 10 chars here!
|
||||
#define PROGVERSION "1.3.51" // use max 10 chars here!
|
||||
#define PROGNAME "PAXCNT"
|
||||
|
||||
//--- Declarations ---
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
// BLE scan parameters
|
||||
#define BLESTACKSIZE 8192 // stack size for esp_bt_controller
|
||||
#define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below
|
||||
#define BLESCANWINDOW 10 // [milliseconds] scan window, see below, 3 .. 10240, default 10
|
||||
#define BLESCANINTERVAL 10 // [milliseconds] scan interval, see below, 3 .. 10240, default 10
|
||||
#define BLESCANWINDOW 0x50 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms
|
||||
#define BLESCANINTERVAL 0x50 // [milliseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle
|
||||
|
||||
/* Note: guide for setting bluetooth parameters
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user