sanitze libpax integration (volatile vars removed)
This commit is contained in:
parent
2dd9a4701b
commit
8e4fe93069
@ -8,6 +8,6 @@
|
||||
|
||||
void init_libpax(void);
|
||||
|
||||
extern uint16_t volatile libpax_macs_ble, libpax_macs_wifi; // libpax values
|
||||
extern struct count_payload_t count_from_libpax; // libpax count storage
|
||||
|
||||
#endif
|
@ -7,6 +7,8 @@
|
||||
#include <esp_coexist.h> // needed for coex version display
|
||||
#include <esp_wifi.h> // needed for wifi init / deinit
|
||||
|
||||
#include <libpax_helpers.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include "reset.h"
|
||||
#include "i2c.h"
|
||||
@ -19,7 +21,6 @@
|
||||
#include "lorawan.h"
|
||||
#include "timekeeper.h"
|
||||
#include "boot.h"
|
||||
#include "libpax_helpers.h"
|
||||
#include "power.h"
|
||||
#include "antenna.h"
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <rom/rtc.h>
|
||||
|
||||
#include "libpax_helpers.h"
|
||||
#include "senddata.h"
|
||||
#include "cyclic.h"
|
||||
#include "configmanager.h"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef _SENDDATA_H
|
||||
#define _SENDDATA_H
|
||||
|
||||
#include "libpax_helpers.h"
|
||||
#include "spislave.h"
|
||||
#include "mqttclient.h"
|
||||
#include "cyclic.h"
|
||||
@ -18,6 +17,7 @@ void checkSendQueues(void);
|
||||
void flushQueues(void);
|
||||
bool allQueuesEmtpy(void);
|
||||
void setSendIRQ(TimerHandle_t xTimer = NULL);
|
||||
void setSendIRQ(void);
|
||||
void initSendDataTimer(uint8_t sendcycle);
|
||||
|
||||
#endif // _SENDDATA_H_
|
||||
|
@ -5,18 +5,9 @@ static const char TAG[] = __FILE__;
|
||||
|
||||
// libpax payload
|
||||
struct count_payload_t count_from_libpax;
|
||||
uint16_t volatile libpax_macs_ble, libpax_macs_wifi;
|
||||
|
||||
void process_count(void) {
|
||||
ESP_LOGD(TAG, "pax: %d / %d / %d", count_from_libpax.pax,
|
||||
count_from_libpax.wifi_count, count_from_libpax.ble_count);
|
||||
libpax_macs_ble = count_from_libpax.ble_count;
|
||||
libpax_macs_wifi = count_from_libpax.wifi_count;
|
||||
setSendIRQ();
|
||||
}
|
||||
|
||||
void init_libpax(void) {
|
||||
libpax_counter_init(process_count, &count_from_libpax, cfg.sendcycle * 2,
|
||||
libpax_counter_init(setSendIRQ, &count_from_libpax, cfg.sendcycle * 2,
|
||||
cfg.countermode);
|
||||
libpax_counter_start();
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
// Basic Config
|
||||
#include "globals.h"
|
||||
#include "rcommand.h"
|
||||
#include "libpax_helpers.h"
|
||||
|
||||
// Local logging tag
|
||||
static const char TAG[] = __FILE__;
|
||||
|
@ -5,6 +5,10 @@ void setSendIRQ(TimerHandle_t xTimer) {
|
||||
xTaskNotify(irqHandlerTask, SENDCYCLE_IRQ, eSetBits);
|
||||
}
|
||||
|
||||
#if ((WIFICOUNTER) || (BLECOUNTER))
|
||||
void setSendIRQ(void) { setSendIRQ(NULL); }
|
||||
#endif
|
||||
|
||||
void initSendDataTimer(uint8_t sendcycle) {
|
||||
static TimerHandle_t SendDataTimer = NULL;
|
||||
|
||||
@ -79,6 +83,10 @@ void sendData() {
|
||||
sdsStatus_t sds_status;
|
||||
#endif
|
||||
|
||||
ESP_LOGD(TAG, "Sending count results: pax=%d / wifi=%d / ble=%d",
|
||||
count_from_libpax.pax, count_from_libpax.wifi_count,
|
||||
count_from_libpax.ble_count);
|
||||
|
||||
while (bitmask) {
|
||||
switch (bitmask & mask) {
|
||||
|
||||
@ -86,11 +94,9 @@ void sendData() {
|
||||
case COUNT_DATA:
|
||||
payload.reset();
|
||||
#if !(PAYLOAD_OPENSENSEBOX)
|
||||
ESP_LOGI(TAG, "Sending libpax wifi count: %d", libpax_macs_wifi);
|
||||
payload.addCount(libpax_macs_wifi, MAC_SNIFF_WIFI);
|
||||
payload.addCount(count_from_libpax.wifi_count, MAC_SNIFF_WIFI);
|
||||
if (cfg.blescan) {
|
||||
ESP_LOGI(TAG, "Sending libpax ble count: %d", libpax_macs_ble);
|
||||
payload.addCount(libpax_macs_ble, MAC_SNIFF_BLE);
|
||||
payload.addCount(count_from_libpax.ble_count, MAC_SNIFF_BLE);
|
||||
}
|
||||
#endif
|
||||
#if (HAS_GPS)
|
||||
@ -104,11 +110,9 @@ void sendData() {
|
||||
}
|
||||
#endif
|
||||
#if (PAYLOAD_OPENSENSEBOX)
|
||||
ESP_LOGI(TAG, "Sending libpax wifi count: %d", libpax_macs_wifi);
|
||||
payload.addCount(libpax_macs_wifi, MAC_SNIFF_WIFI);
|
||||
payload.addCount(count_from_libpax.wifi_count, MAC_SNIFF_WIFI);
|
||||
if (cfg.blescan) {
|
||||
ESP_LOGI(TAG, "Sending libpax ble count: %d", libpax_macs_ble);
|
||||
payload.addCount(libpax_macs_ble, MAC_SNIFF_BLE);
|
||||
payload.addCount(count_from_libpax.ble_count, MAC_SNIFF_BLE);
|
||||
#endif
|
||||
#if (HAS_SDS011)
|
||||
sds011_store(&sds_status);
|
||||
@ -116,10 +120,11 @@ void sendData() {
|
||||
#endif
|
||||
SendPayload(COUNTERPORT);
|
||||
#ifdef HAS_DISPLAY
|
||||
dp_plotCurve(libpax_macs_ble + libpax_macs_wifi, true);
|
||||
dp_plotCurve(count_from_libpax.pax, true);
|
||||
#endif
|
||||
#if (HAS_SDCARD)
|
||||
sdcardWriteData(libpax_macs_wifi, libpax_macs_ble
|
||||
sdcardWriteData(count_from_libpax.wifi_count,
|
||||
count_from_libpax.ble_count
|
||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||
,
|
||||
read_voltage()
|
||||
|
Loading…
Reference in New Issue
Block a user