further fixes for refactoring BLE scan
This commit is contained in:
1 parent
c57e7b75f4
commit
d4c4f5b532
6 files changed
+16
-44
No files matched your search
@@ -28,7 +28,6 @@ void defaultConfig() {
|
||||
cfg.wifiscancycle = SEND_SECS; // wifi scan cycle [seconds/2]
|
||||
cfg.wifichancycle = WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
|
||||
cfg.blescantime = BLESCANTIME; // BLE scan cycle duration [seconds]
|
||||
cfg.blescancycle = BLESCANCYCLE; // do a BLE scan after [BLESCANCYCLE] full Wifi scan cycles
|
||||
cfg.blescan = 1; // 0=disabled, 1=enabled
|
||||
cfg.wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4)
|
||||
cfg.rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%)
|
||||
@@ -108,9 +107,6 @@ void saveConfig() {
|
||||
if( nvs_get_i8(my_handle, "blescantime", &flash8) != ESP_OK || flash8 != cfg.blescantime )
|
||||
nvs_set_i8(my_handle, "blescantime", cfg.blescantime);
|
||||
|
||||
if( nvs_get_i8(my_handle, "blescancycle", &flash8) != ESP_OK || flash8 != cfg.blescancycle )
|
||||
nvs_set_i8(my_handle, "blescancycle", cfg.blescancycle);
|
||||
|
||||
if( nvs_get_i8(my_handle, "blescanmode", &flash8) != ESP_OK || flash8 != cfg.blescan )
|
||||
nvs_set_i8(my_handle, "blescanmode", cfg.blescan);
|
||||
|
||||
@@ -260,14 +256,6 @@ void loadConfig() {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
if( nvs_get_i8(my_handle, "blescancycle", &flash8) == ESP_OK ) {
|
||||
cfg.blescancycle = flash8;
|
||||
ESP_LOGI(TAG, "blescancycle = %i", flash8);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "BLEscancycle set to default %i", cfg.blescancycle);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
if( nvs_get_i8(my_handle, "blescanmode", &flash8) == ESP_OK ) {
|
||||
cfg.blescan = flash8;
|
||||
ESP_LOGI(TAG, "BLEscanmode = %i", flash8);
|
||||
|
||||
@@ -33,7 +33,6 @@ typedef struct {
|
||||
int8_t wifiscancycle; // wifi scan cycle [seconds/2]
|
||||
int8_t wifichancycle; // wifi channel switch cycle [seconds/100]
|
||||
int8_t blescantime; // BLE scan cycle duration [seconds]
|
||||
int8_t blescancycle; // BLE scan frequency, once after [blescancycle] full wifi scans
|
||||
int8_t blescan; // 0=disabled, 1=enabled
|
||||
int8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
|
||||
int8_t rgblum; // RGB Led luminosity (0..100%)
|
||||
|
||||
+9
-15
@@ -325,17 +325,7 @@ void sniffer_loop(void * pvParameters) {
|
||||
}
|
||||
} // end of send data cycle
|
||||
|
||||
else {
|
||||
/*
|
||||
#ifdef BLECOUNTER
|
||||
if (nloop % (WIFI_CHANNEL_MAX * cfg.blescancycle) == 0 ) // once after cfg.blescancycle Wifi scans, do a BLE scan
|
||||
if (cfg.blescan) { // execute BLE count if BLE function is enabled
|
||||
BLECount(); // start BLE scan, this is a blocking call
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
} // end of channel rotation loop
|
||||
} // end of infinite wifi scan loop
|
||||
} // end of infinite wifi channel rotation loop
|
||||
}
|
||||
|
||||
/* end wifi specific parts ------------------------------------------------------------ */
|
||||
@@ -512,8 +502,10 @@ salt_reset(); // get new 16bit for salting hashes
|
||||
ESP_LOGI(TAG, "Starting Wifi task on core 0");
|
||||
xTaskCreatePinnedToCore(wifi_sniffer_loop, "wifisniffer", 4096, ( void * ) 1, 1, NULL, 0);
|
||||
#ifdef BLECOUNTER
|
||||
ESP_LOGI(TAG, "Starting Bluetooth task on core 0");
|
||||
xTaskCreatePinnedToCore(bt_loop, "btscan", 2048, NULL, 5, NULL, 0);
|
||||
if (cfg.blescan) { // start BLE task only if BLE function is enabled in NVRAM configuration
|
||||
ESP_LOGI(TAG, "Starting Bluetooth task on core 1");
|
||||
xTaskCreatePinnedToCore(bt_loop, "btscan", 2048, NULL, 5, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
// to come here: code for switching off core 1
|
||||
#else // run wifi task on core 0 and lora task on core 1 and bt task on core 1
|
||||
@@ -522,8 +514,10 @@ salt_reset(); // get new 16bit for salting hashes
|
||||
ESP_LOGI(TAG, "Starting Wifi task on core 0");
|
||||
xTaskCreatePinnedToCore(sniffer_loop, "wifisniffer", 4096, ( void * ) 1, 1, NULL, 0);
|
||||
#ifdef BLECOUNTER
|
||||
ESP_LOGI(TAG, "Starting Bluetooth task on core 1");
|
||||
xTaskCreatePinnedToCore(bt_loop, "btscan", 2048, NULL, 5, NULL, 1);
|
||||
if (cfg.blescan) { // start BLE task only if BLE function is enabled in NVRAM configuration
|
||||
ESP_LOGI(TAG, "Starting Bluetooth task on core 1");
|
||||
xTaskCreatePinnedToCore(bt_loop, "btscan", 2048, NULL, 5, NULL, 1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// program version - note: increment version after modifications to configData_t struct!!
|
||||
#define PROGVERSION "1.2.96" // use max 10 chars here!
|
||||
#define PROGVERSION "1.2.97" // use max 10 chars here!
|
||||
#define PROGNAME "PAXCNT"
|
||||
|
||||
// Verbose enables serial output
|
||||
|
||||
+1
-6
@@ -110,11 +110,6 @@ void set_blescantime(int val) {
|
||||
ESP_LOGI(TAG, "Remote command: set BLE scan time to %i seconds", cfg.blescantime);
|
||||
};
|
||||
|
||||
void set_blescancycle(int val) {
|
||||
cfg.blescancycle = val;
|
||||
ESP_LOGI(TAG, "Remote command: set BLE scan cycle to %i", cfg.blescancycle);
|
||||
};
|
||||
|
||||
void set_countmode(int val) {
|
||||
switch (val) {
|
||||
case 0: // cyclic unconfirmed
|
||||
@@ -251,7 +246,7 @@ cmd_t table[] = {
|
||||
{0x0a, set_wifiscancycle, true},
|
||||
{0x0b, set_wifichancycle, true},
|
||||
{0x0c, set_blescantime, true},
|
||||
{0x0d, set_blescancycle, true},
|
||||
{0x0d, set_noop, false},
|
||||
{0x0e, set_blescan, true},
|
||||
{0x0f, set_wifiant, true},
|
||||
{0x10, set_rgblum, true},
|
||||
|
||||
Reference in new issue
Block a user