new option WIFICOUNTER fixed

This commit is contained in:
Verkehrsrot 2019-04-13 18:44:25 +02:00
parent 77e795dbf8
commit 38118cae6c
3 changed files with 12 additions and 6 deletions

View File

@ -9,7 +9,9 @@ static const char TAG[] = __FILE__;
Ticker housekeeper; Ticker housekeeper;
void housekeeping() { xTaskNotifyFromISR(irqHandlerTask, CYCLIC_IRQ, eSetBits, NULL); } void housekeeping() {
xTaskNotifyFromISR(irqHandlerTask, CYCLIC_IRQ, eSetBits, NULL);
}
// do all housekeeping // do all housekeeping
void doHousekeeping() { void doHousekeeping() {
@ -24,7 +26,7 @@ void doHousekeeping() {
#ifdef HAS_SPI #ifdef HAS_SPI
spi_housekeeping(); spi_housekeeping();
#endif #endif
#if(HAS_LORA) #if (HAS_LORA)
lora_housekeeping(); lora_housekeeping();
#endif #endif
@ -32,7 +34,7 @@ void doHousekeeping() {
ESP_LOGD(TAG, "IRQhandler %d bytes left | Taskstate = %d", ESP_LOGD(TAG, "IRQhandler %d bytes left | Taskstate = %d",
uxTaskGetStackHighWaterMark(irqHandlerTask), uxTaskGetStackHighWaterMark(irqHandlerTask),
eTaskGetState(irqHandlerTask)); eTaskGetState(irqHandlerTask));
#if(HAS_GPS) #if (HAS_GPS)
ESP_LOGD(TAG, "Gpsloop %d bytes left | Taskstate = %d", ESP_LOGD(TAG, "Gpsloop %d bytes left | Taskstate = %d",
uxTaskGetStackHighWaterMark(GpsTask), eTaskGetState(GpsTask)); uxTaskGetStackHighWaterMark(GpsTask), eTaskGetState(GpsTask));
#endif #endif
@ -115,8 +117,10 @@ uint32_t getFreeRAM() {
} }
void reset_counters() { void reset_counters() {
#if ((WIFICOUNTER) || (BLECOUNTER))
macs.clear(); // clear all macs container macs.clear(); // clear all macs container
macs_total = 0; // reset all counters macs_total = 0; // reset all counters
macs_wifi = 0; macs_wifi = 0;
macs_ble = 0; macs_ble = 0;
#endif
} }

View File

@ -409,9 +409,7 @@ void setup() {
#endif #endif
// cyclic function interrupts // cyclic function interrupts
#if (WIFICOUNTER) || (BLECOUNTER)
sendcycler.attach(SENDCYCLE * 2, sendcycle); sendcycler.attach(SENDCYCLE * 2, sendcycle);
#endif
housekeeper.attach(HOMECYCLE, housekeeping); housekeeper.attach(HOMECYCLE, housekeeping);
// button interrupt // button interrupt

View File

@ -3,7 +3,9 @@
Ticker sendcycler; Ticker sendcycler;
void sendcycle() { xTaskNotifyFromISR(irqHandlerTask, SENDCYCLE_IRQ, eSetBits, NULL); } void sendcycle() {
xTaskNotifyFromISR(irqHandlerTask, SENDCYCLE_IRQ, eSetBits, NULL);
}
// 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, sendprio_t prio) { void SendPayload(uint8_t port, sendprio_t prio) {
@ -57,6 +59,7 @@ void sendCounter() {
while (bitmask) { while (bitmask) {
switch (bitmask & mask) { switch (bitmask & mask) {
#if ((WIFICOUNTER) || (BLECOUNTER))
case COUNT_DATA: case COUNT_DATA:
payload.reset(); payload.reset();
payload.addCount(macs_wifi, MAC_SNIFF_WIFI); payload.addCount(macs_wifi, MAC_SNIFF_WIFI);
@ -70,6 +73,7 @@ void sendCounter() {
ESP_LOGI(TAG, "Counter cleared"); ESP_LOGI(TAG, "Counter cleared");
} }
break; break;
#endif
#if (HAS_BME) #if (HAS_BME)
case MEMS_DATA: case MEMS_DATA: