diff --git a/include/globals.h b/include/globals.h index 7d479c40..a3edad17 100644 --- a/include/globals.h +++ b/include/globals.h @@ -108,9 +108,9 @@ extern std::array beacons; extern configData_t cfg; // current device configuration extern char display_line6[], display_line7[]; // screen buffers +extern uint8_t volatile channel; // wifi channel rotation counter extern uint16_t volatile macs_total, macs_wifi, macs_ble, - batt_voltage; // display values -extern uint32_t volatile PacketCounter; // sniffed packet counter + batt_voltage; // display values extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC extern timesource_t timeSource; extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ, *gpsIRQ; diff --git a/src/display.cpp b/src/display.cpp index 0ea33ed8..2c1c3048 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -11,13 +11,12 @@ Display-Mask (128 x 64 pixel): 1|PAX:aabbccddee 2|B:a.bcV Sats:ab 3|BLTH:abcde SF:ab -4|WIFI:abcde **** +4|WIFI:abcde ch:ab 5|RLIM:abcd abcdKB 6|xxxxxxxxxxxxxxxx 6|20:27:00* 27.Feb 7|yyyyyyyyyyyyyyab -line 4: **** = Packet traffic indicator line 6: x = Text for LORA status OR time/date line 7: y = Text for LMIC status; ab = payload queue @@ -225,22 +224,11 @@ void draw_page(time_t t, uint8_t page) { u8x8.setInverseFont(0); #endif // HAS_LORA - // line 4: update wifi counter + packet density display + // line 4: update wifi counter + channel display u8x8.setCursor(0, 4); u8x8.printf("WIFI:%-5d", macs_wifi); - // display and reset packetcounter - u8x8.setCursor(12, 4); - if (PacketCounter > (100000 / DISPLAYREFRESH_MS)) - u8x8.printf("****"); - else if (PacketCounter > (10000 / DISPLAYREFRESH_MS)) - u8x8.printf(" ***"); - else if (PacketCounter > (1000 / DISPLAYREFRESH_MS)) - u8x8.printf(" **"); - else if (PacketCounter > 0) - u8x8.printf(" *"); - else - u8x8.printf(" "); - PacketCounter = 0; + u8x8.setCursor(11, 4); + u8x8.printf("ch:%02d", channel); // line 5: update RSSI limiter status & free memory display u8x8.setCursor(0, 5); diff --git a/src/main.cpp b/src/main.cpp index 89b6d774..ae883673 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -81,9 +81,9 @@ triggers pps 1 sec impulse configData_t cfg; // struct holds current device configuration char display_line6[16], display_line7[16]; // display buffers +uint8_t volatile channel = 0; // channel rotation counter uint16_t volatile macs_total = 0, macs_wifi = 0, macs_ble = 0, - batt_voltage = 0; // globals for display -uint32_t volatile PacketCounter = 0; // sniffed packet counter + batt_voltage = 0; // globals for display hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL, *gpsIRQ = NULL; diff --git a/src/wifiscan.cpp b/src/wifiscan.cpp index fedbad44..750f9c5a 100644 --- a/src/wifiscan.cpp +++ b/src/wifiscan.cpp @@ -37,8 +37,6 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff, (wifi_ieee80211_packet_t *)ppkt->payload; const wifi_ieee80211_mac_hdr_t *hdr = &ipkt->hdr; - PacketCounter++; // increase packets per second counter - if ((cfg.rssilimit) && (ppkt->rx_ctrl.rssi < cfg.rssilimit)) // rssi is negative value ESP_LOGD(TAG, "WiFi RSSI %d -> ignoring (limit: %d)", ppkt->rx_ctrl.rssi, @@ -47,9 +45,8 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff, mac_add((uint8_t *)hdr->addr2, ppkt->rx_ctrl.rssi, MAC_SNIFF_WIFI); } -// Software-timer driven Wifi channel rotation function +// Software-timer driven Wifi channel rotation callback function void switchWifiChannel(TimerHandle_t xTimer) { - static uint8_t channel = 0; // channel rotation counter channel = (channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE); @@ -60,13 +57,13 @@ void wifi_sniffer_init(void) { wificfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM wificfg.wifi_task_core_id = 0; // we want wifi task running on core 0 - wifi_promiscuous_filter_t filter = { - .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames + // wifi_promiscuous_filter_t filter = { + // .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames // .filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames - // wifi_promiscuous_filter_t filter = {.filter_mask = - // WIFI_PROMIS_FILTER_MASK_MGMT | - // WIFI_PROMIS_FILTER_MASK_DATA}; + wifi_promiscuous_filter_t filter = {.filter_mask = + WIFI_PROMIS_FILTER_MASK_MGMT | + WIFI_PROMIS_FILTER_MASK_DATA}; ESP_ERROR_CHECK(esp_wifi_init(&wificfg)); // configure Wifi with cfg ESP_ERROR_CHECK(