centralize display writes (part 2)

This commit is contained in:
Klaus K Wilting 2018-04-15 22:31:19 +02:00
parent 130fefd49d
commit 3efd3890f3
2 changed files with 9 additions and 23 deletions

View File

@ -50,22 +50,14 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
// Insert only if it was not found on global count // Insert only if it was not found on global count
if (added) { if (added) {
//char buff[16];
//snprintf(buff, sizeof(buff), "PAX:%-4d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value
//u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE
if (sniff_type == MAC_SNIFF_WIFI ) { if (sniff_type == MAC_SNIFF_WIFI ) {
rgb_set_color(COLOR_GREEN); rgb_set_color(COLOR_GREEN);
wifis.insert(hashedmac); // add hashed MAC to wifi container wifis.insert(hashedmac); // add hashed MAC to wifi container
//u8x8.setCursor(0,4);
//u8x8.printf("WIFI: %-4d", (int) wifis.size());
} }
#ifdef BLECOUNTER #ifdef BLECOUNTER
else if (sniff_type == MAC_SNIFF_BLE ) { else if (sniff_type == MAC_SNIFF_BLE ) {
rgb_set_color(COLOR_MAGENTA); rgb_set_color(COLOR_MAGENTA);
bles.insert(hashedmac); // add hashed MAC to BLE container bles.insert(hashedmac); // add hashed MAC to BLE container
//u8x8.setCursor(0,3);
//u8x8.printf("BLTH: %-4d", (int) bles.size());
} }
#endif #endif

View File

@ -272,15 +272,7 @@ void sniffer_loop(void * pvParameters) {
channel = (channel % WIFI_CHANNEL_MAX) + 1; // rotates variable channel 1..WIFI_CHANNEL_MAX channel = (channel % WIFI_CHANNEL_MAX) + 1; // rotates variable channel 1..WIFI_CHANNEL_MAX
wifi_sniffer_set_channel(channel); wifi_sniffer_set_channel(channel);
ESP_LOGD(TAG, "Wifi set channel %d", channel); ESP_LOGD(TAG, "Wifi set channel %d", channel);
/*
snprintf(buff, sizeof(buff), "PAX:%d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value
u8x8.draw2x2String(0, 0, buff); // display number on unique macs total
u8x8.setCursor(11,4);
u8x8.printf("ch:%02i", channel);
u8x8.setCursor(0,5);
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit);
*/
// duration of one wifi scan loop reached? then send data and begin new scan cycle // duration of one wifi scan loop reached? then send data and begin new scan cycle
if ( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) { if ( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) {
u8x8.setPowerSave(!cfg.screenon); // set display on if enabled u8x8.setPowerSave(!cfg.screenon); // set display on if enabled
@ -538,8 +530,10 @@ void loop() {
u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE
u8x8.setCursor(0,4); u8x8.setCursor(0,4);
u8x8.printf("WIFI: %-4d", (int) wifis.size()); u8x8.printf("WIFI: %-4d", (int) wifis.size());
#ifdef BLECOUNTER
u8x8.setCursor(0,3); u8x8.setCursor(0,3);
u8x8.printf("BLTH: %-4d", (int) bles.size()); u8x8.printf("BLTH: %-4d", (int) bles.size());
#endif
// display actual wifi channel (line 4) // display actual wifi channel (line 4)
u8x8.setCursor(11,4); u8x8.setCursor(11,4);
u8x8.printf("ch:%02i", channel); u8x8.printf("ch:%02i", channel);