remove drop libpax option (for issue #921)
This commit is contained in:
parent
762be09aa9
commit
6055909bc0
@ -62,9 +62,8 @@ Some 3D printable cases can be found (and, if wanted so, ordered) on Thingiverse
|
|||||||
|
|
||||||
<b>Power consumption</b> was metered at around 450 - 1000mW, depending on board and user settings in `paxcounter.conf`.
|
<b>Power consumption</b> was metered at around 450 - 1000mW, depending on board and user settings in `paxcounter.conf`.
|
||||||
|
|
||||||
By default, bluetooth sniffing not installed. If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results.
|
By default, bluetooth sniffing is not started. If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results.
|
||||||
|
|
||||||
<!-- TODO currently set to 1 here https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/paxcounter_orig.conf-->
|
|
||||||
=== "Deactivate BLE sniffing (Default)"
|
=== "Deactivate BLE sniffing (Default)"
|
||||||
|
|
||||||
``` c linenums="29" title="paxcounter.conf"
|
``` c linenums="29" title="paxcounter.conf"
|
||||||
|
@ -17,6 +17,5 @@ void flushQueues(void);
|
|||||||
bool allQueuesEmtpy(void);
|
bool allQueuesEmtpy(void);
|
||||||
void setSendIRQ(TimerHandle_t xTimer);
|
void setSendIRQ(TimerHandle_t xTimer);
|
||||||
void setSendIRQ(void);
|
void setSendIRQ(void);
|
||||||
void initSendDataTimer(uint8_t sendcycle);
|
|
||||||
|
|
||||||
#endif // _SENDDATA_H_
|
#endif // _SENDDATA_H_
|
||||||
|
@ -200,7 +200,6 @@ void dp_refresh(bool nextPage) {
|
|||||||
// line 3: wifi + bluetooth counters
|
// line 3: wifi + bluetooth counters
|
||||||
// WIFI:abcde BLTH:abcde
|
// WIFI:abcde BLTH:abcde
|
||||||
|
|
||||||
#if ((WIFICOUNTER) && (BLECOUNTER))
|
|
||||||
if (cfg.wifiscan)
|
if (cfg.wifiscan)
|
||||||
dp->printf("WIFI:%-5u", count.wifi_count);
|
dp->printf("WIFI:%-5u", count.wifi_count);
|
||||||
else
|
else
|
||||||
@ -209,18 +208,6 @@ void dp_refresh(bool nextPage) {
|
|||||||
dp->printf("BLTH:%-5u", count.ble_count);
|
dp->printf("BLTH:%-5u", count.ble_count);
|
||||||
else
|
else
|
||||||
dp->printf(" BLTH:off");
|
dp->printf(" BLTH:off");
|
||||||
#elif ((WIFICOUNTER) && (!BLECOUNTER))
|
|
||||||
if (cfg.wifiscan)
|
|
||||||
dp->printf("WIFI:%-5u", count.wifi_count);
|
|
||||||
else
|
|
||||||
dp->printf("WIFI:off ");
|
|
||||||
#elif ((!WIFICOUNTER) && (BLECOUNTER))
|
|
||||||
if (cfg.blescan)
|
|
||||||
dp->printf("BLTH:%-5u", count.ble_count);
|
|
||||||
dp->printf("BLTH:off");
|
|
||||||
#else
|
|
||||||
dp->printf("Sniffer disabled");
|
|
||||||
#endif
|
|
||||||
dp->printf("\r\n");
|
dp->printf("\r\n");
|
||||||
|
|
||||||
// line 4: Battery + GPS status + Wifi channel
|
// line 4: Battery + GPS status + Wifi channel
|
||||||
|
20
src/main.cpp
20
src/main.cpp
@ -218,7 +218,7 @@ void setup() {
|
|||||||
pinMode(HAS_TWO_LED, OUTPUT);
|
pinMode(HAS_TWO_LED, OUTPUT);
|
||||||
strcat_P(features, " LED2");
|
strcat_P(features, " LED2");
|
||||||
#endif
|
#endif
|
||||||
// use simple LED for power display if we have additional RGB LED, else for status
|
// use LED for power display if we have additional RGB LED, else for status
|
||||||
#ifdef HAS_RGB_LED
|
#ifdef HAS_RGB_LED
|
||||||
switch_LED(LED_ON);
|
switch_LED(LED_ON);
|
||||||
#endif
|
#endif
|
||||||
@ -270,8 +270,7 @@ void setup() {
|
|||||||
if (RTC_runmode == RUNMODE_MAINTENANCE)
|
if (RTC_runmode == RUNMODE_MAINTENANCE)
|
||||||
start_boot_menu();
|
start_boot_menu();
|
||||||
|
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
// start libpax lib (includes timer to trigger cyclic senddata)
|
||||||
// use libpax timer to trigger cyclic senddata
|
|
||||||
ESP_LOGI(TAG, "Starting libpax...");
|
ESP_LOGI(TAG, "Starting libpax...");
|
||||||
struct libpax_config_t configuration;
|
struct libpax_config_t configuration;
|
||||||
libpax_default_config(&configuration);
|
libpax_default_config(&configuration);
|
||||||
@ -296,14 +295,6 @@ void setup() {
|
|||||||
} else {
|
} else {
|
||||||
init_libpax();
|
init_libpax();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// use stand alone timer to trigger cyclic senddata
|
|
||||||
initSendDataTimer(cfg.sendcycle * 2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (BLECOUNTER)
|
|
||||||
strcat_P(features, " BLE");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// start rcommand processing task
|
// start rcommand processing task
|
||||||
ESP_LOGI(TAG, "Starting rcommand interpreter...");
|
ESP_LOGI(TAG, "Starting rcommand interpreter...");
|
||||||
@ -401,13 +392,6 @@ void setup() {
|
|||||||
strcat_P(features, " IF482");
|
strcat_P(features, " IF482");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (WIFICOUNTER)
|
|
||||||
strcat_P(features, " WIFI");
|
|
||||||
#else
|
|
||||||
// remove wifi driver from RAM, if option wifi not compiled
|
|
||||||
esp_wifi_deinit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// start state machine
|
// start state machine
|
||||||
ESP_LOGI(TAG, "Starting Interrupt Handler...");
|
ESP_LOGI(TAG, "Starting Interrupt Handler...");
|
||||||
xTaskCreatePinnedToCore(irqHandler, // task function
|
xTaskCreatePinnedToCore(irqHandler, // task function
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
((GPS_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | SENSOR3_DATA) & \
|
((GPS_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | SENSOR3_DATA) & \
|
||||||
(~BATT_DATA) & (~RESERVED_DATA))
|
(~BATT_DATA) & (~RESERVED_DATA))
|
||||||
|
|
||||||
// MAC sniffing parameters
|
// MAC sniffing settings
|
||||||
#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer
|
#define BLECOUNTER 0 // set to 0 if you do not want to start the BLE sniffer
|
||||||
#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer
|
#define WIFICOUNTER 1 // set to 0 if you do not want to start the WIFI sniffer
|
||||||
#define RSSILIMIT 0 // 0...-128, set to 0 if you do not want to filter signals
|
#define RSSILIMIT 0 // 0...-128, set to 0 if you do not want to filter signals
|
||||||
|
|
||||||
// BLE scan parameters
|
// BLE scan parameters
|
||||||
|
@ -54,7 +54,6 @@ void set_reset(uint8_t val[]) {
|
|||||||
|
|
||||||
void set_rssi(uint8_t val[]) {
|
void set_rssi(uint8_t val[]) {
|
||||||
cfg.rssilimit = val[0] * -1;
|
cfg.rssilimit = val[0] * -1;
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
libpax_config_t current_config;
|
libpax_config_t current_config;
|
||||||
libpax_get_current_config(¤t_config);
|
libpax_get_current_config(¤t_config);
|
||||||
@ -62,7 +61,6 @@ void set_rssi(uint8_t val[]) {
|
|||||||
current_config.ble_rssi_threshold = cfg.rssilimit;
|
current_config.ble_rssi_threshold = cfg.rssilimit;
|
||||||
libpax_update_config(¤t_config);
|
libpax_update_config(¤t_config);
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#endif
|
|
||||||
ESP_LOGI(TAG, "Remote command: set RSSI limit to %d", cfg.rssilimit);
|
ESP_LOGI(TAG, "Remote command: set RSSI limit to %d", cfg.rssilimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +71,8 @@ void set_sendcycle(uint8_t val[]) {
|
|||||||
cfg.sendcycle = val[0];
|
cfg.sendcycle = val[0];
|
||||||
ESP_LOGI(TAG, "Remote command: set send cycle to %d seconds",
|
ESP_LOGI(TAG, "Remote command: set send cycle to %d seconds",
|
||||||
cfg.sendcycle * 2);
|
cfg.sendcycle * 2);
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#else
|
|
||||||
// modify senddata timer
|
|
||||||
initSendDataTimer(cfg.sendcycle * 2);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_sleepcycle(uint8_t val[]) {
|
void set_sleepcycle(uint8_t val[]) {
|
||||||
@ -91,7 +84,6 @@ void set_sleepcycle(uint8_t val[]) {
|
|||||||
|
|
||||||
void set_wifichancycle(uint8_t val[]) {
|
void set_wifichancycle(uint8_t val[]) {
|
||||||
cfg.wifichancycle = val[0];
|
cfg.wifichancycle = val[0];
|
||||||
#if (WIFICOUNTER)
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
libpax_config_t current_config;
|
libpax_config_t current_config;
|
||||||
libpax_get_current_config(¤t_config);
|
libpax_get_current_config(¤t_config);
|
||||||
@ -109,19 +101,16 @@ void set_wifichancycle(uint8_t val[]) {
|
|||||||
current_config.wifi_channel_switch_interval = cfg.wifichancycle;
|
current_config.wifi_channel_switch_interval = cfg.wifichancycle;
|
||||||
libpax_update_config(¤t_config);
|
libpax_update_config(¤t_config);
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_blescantime(uint8_t val[]) {
|
void set_blescantime(uint8_t val[]) {
|
||||||
cfg.blescantime = val[0];
|
cfg.blescantime = val[0];
|
||||||
#if (BLECOUNTER)
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
libpax_config_t current_config;
|
libpax_config_t current_config;
|
||||||
libpax_get_current_config(¤t_config);
|
libpax_get_current_config(¤t_config);
|
||||||
current_config.blescantime = cfg.blescantime;
|
current_config.blescantime = cfg.blescantime;
|
||||||
libpax_update_config(¤t_config);
|
libpax_update_config(¤t_config);
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_countmode(uint8_t val[]) {
|
void set_countmode(uint8_t val[]) {
|
||||||
@ -144,10 +133,8 @@ void set_countmode(uint8_t val[]) {
|
|||||||
"Remote command: set counter mode called with invalid parameter(s)");
|
"Remote command: set counter mode called with invalid parameter(s)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
init_libpax(); // re-inits counter mode from cfg.countermode
|
init_libpax(); // re-inits counter mode from cfg.countermode
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_screensaver(uint8_t val[]) {
|
void set_screensaver(uint8_t val[]) {
|
||||||
@ -258,28 +245,24 @@ void set_loraadr(uint8_t val[]) {
|
|||||||
void set_blescan(uint8_t val[]) {
|
void set_blescan(uint8_t val[]) {
|
||||||
ESP_LOGI(TAG, "Remote command: set BLE scanner to %s", val[0] ? "on" : "off");
|
ESP_LOGI(TAG, "Remote command: set BLE scanner to %s", val[0] ? "on" : "off");
|
||||||
cfg.blescan = val[0] ? 1 : 0;
|
cfg.blescan = val[0] ? 1 : 0;
|
||||||
#if (BLECOUNTER)
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
libpax_config_t current_config;
|
libpax_config_t current_config;
|
||||||
libpax_get_current_config(¤t_config);
|
libpax_get_current_config(¤t_config);
|
||||||
current_config.blecounter = cfg.blescan;
|
current_config.blecounter = cfg.blescan;
|
||||||
libpax_update_config(¤t_config);
|
libpax_update_config(¤t_config);
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_wifiscan(uint8_t val[]) {
|
void set_wifiscan(uint8_t val[]) {
|
||||||
ESP_LOGI(TAG, "Remote command: set WIFI scanner to %s",
|
ESP_LOGI(TAG, "Remote command: set WIFI scanner to %s",
|
||||||
val[0] ? "on" : "off");
|
val[0] ? "on" : "off");
|
||||||
cfg.wifiscan = val[0] ? 1 : 0;
|
cfg.wifiscan = val[0] ? 1 : 0;
|
||||||
#if (WIFICOUNTER)
|
|
||||||
libpax_counter_stop();
|
libpax_counter_stop();
|
||||||
libpax_config_t current_config;
|
libpax_config_t current_config;
|
||||||
libpax_get_current_config(¤t_config);
|
libpax_get_current_config(¤t_config);
|
||||||
current_config.wificounter = cfg.wifiscan;
|
current_config.wificounter = cfg.wifiscan;
|
||||||
libpax_update_config(¤t_config);
|
libpax_update_config(¤t_config);
|
||||||
init_libpax();
|
init_libpax();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_wifiant(uint8_t val[]) {
|
void set_wifiant(uint8_t val[]) {
|
||||||
|
@ -10,19 +10,6 @@ void setSendIRQ(TimerHandle_t xTimer) {
|
|||||||
|
|
||||||
void setSendIRQ(void) { setSendIRQ(NULL); }
|
void setSendIRQ(void) { setSendIRQ(NULL); }
|
||||||
|
|
||||||
void initSendDataTimer(uint8_t sendcycle) {
|
|
||||||
static TimerHandle_t SendDataTimer = NULL;
|
|
||||||
|
|
||||||
if (SendDataTimer == NULL) {
|
|
||||||
SendDataTimer =
|
|
||||||
xTimerCreate("SendDataTimer", pdMS_TO_TICKS(sendcycle * 1000), pdTRUE,
|
|
||||||
(void *)0, setSendIRQ);
|
|
||||||
xTimerStart(SendDataTimer, 0);
|
|
||||||
} else {
|
|
||||||
xTimerChangePeriod(SendDataTimer, pdMS_TO_TICKS(sendcycle * 1000), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// put data to send in RTos Queues used for transmit over channels Lora and SPI
|
// put data to send in RTos Queues used for transmit over channels Lora and SPI
|
||||||
void SendPayload(uint8_t port) {
|
void SendPayload(uint8_t port) {
|
||||||
ESP_LOGD(TAG, "sending Payload for Port %d", port);
|
ESP_LOGD(TAG, "sending Payload for Port %d", port);
|
||||||
@ -81,16 +68,14 @@ void sendData() {
|
|||||||
#if (HAS_SDS011)
|
#if (HAS_SDS011)
|
||||||
sdsStatus_t sds_status;
|
sdsStatus_t sds_status;
|
||||||
#endif
|
#endif
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
struct count_payload_t count =
|
struct count_payload_t count =
|
||||||
count_from_libpax; // copy values from global libpax var
|
count_from_libpax; // copy values from global libpax var
|
||||||
ESP_LOGD(TAG, "Sending count results: pax=%d / wifi=%d / ble=%d", count.pax,
|
ESP_LOGD(TAG, "Sending count results: pax=%d / wifi=%d / ble=%d", count.pax,
|
||||||
count.wifi_count, count.ble_count);
|
count.wifi_count, count.ble_count);
|
||||||
#endif
|
|
||||||
|
|
||||||
while (bitmask) {
|
while (bitmask) {
|
||||||
switch (bitmask & mask) {
|
switch (bitmask & mask) {
|
||||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
case COUNT_DATA:
|
case COUNT_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
|
|
||||||
@ -138,8 +123,6 @@ void sendData() {
|
|||||||
SendPayload(COUNTERPORT);
|
SendPayload(COUNTERPORT);
|
||||||
break; // case COUNTDATA
|
break; // case COUNTDATA
|
||||||
|
|
||||||
#endif // ((WIFICOUNTER) || (BLECOUNTER))
|
|
||||||
|
|
||||||
#if (HAS_BME)
|
#if (HAS_BME)
|
||||||
case MEMS_DATA:
|
case MEMS_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user