From b82a77088286daa473843f8869d16eb79dd56f43 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Fri, 6 Apr 2018 17:19:37 +0200 Subject: [PATCH] OLED Display cosmetics --- src/macsniff.cpp | 11 +++++------ src/main.cpp | 11 +++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 21f4682e..7f53bd33 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -98,21 +98,20 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { // add this device and refresh display if it was not previously added if ( mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE) ) { char buff[16]; - snprintf(buff, sizeof(buff), "PAX:%d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value + snprintf(buff, sizeof(buff), "PAX:%-4d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value u8x8.setCursor(0,0); u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE } - u8x8.setCursor(12,3); - u8x8.printf("%d", currentScanDevice); + u8x8.setCursor(11,3); + u8x8.printf("%-4d", currentScanDevice); } }; void BLECount() { ESP_LOGI(TAG, "BLE scan started"); currentScanDevice = 0; // Set 0 seen device on this scan session - //u8x8.clearLine(3); // not needed? - u8x8.drawString(0,3,"BLE Scan..."); - BLEDevice::init(PROGNAME); + u8x8.drawString(0,3,"Scanning->"); + BLEDevice::init(""); // we don't want to be seen by a name BLEScan* pBLEScan = BLEDevice::getScan(); //create new scan pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster diff --git a/src/main.cpp b/src/main.cpp index 9b75e623..f91e1dc5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -278,15 +278,17 @@ void sniffer_loop(void * pvParameters) { u8x8.setCursor(0,3); // We just state out of BLE scanning if (currentScanDevice) { - u8x8.printf("BLE#: %-4d %d", (int) bles.size(), currentScanDevice); + u8x8.printf("BLE: %-4d %-4d", (int) bles.size(), currentScanDevice); } else { - u8x8.printf("BLE#: %-4d", (int) bles.size()); + u8x8.printf("BLE: %-4d", (int) bles.size()); } u8x8.setCursor(0,4); - u8x8.printf("MAC#: %-5d", (int) wifis.size()); + u8x8.printf("WIFI: %-4d", (int) wifis.size()); + u8x8.setCursor(11,4); + u8x8.printf("ch:%02i", channel); u8x8.setCursor(0,5); u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit); - u8x8.printf(" ch:%02i", channel); + //u8x8.printf(" ch:%02i", channel); // duration of one wifi scan loop reached? then send data and begin new scan cycle if( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) { @@ -325,6 +327,7 @@ void sniffer_loop(void * pvParameters) { u8x8.clearLine(6); + // TBD: need to check if long 2000ms pause causes stack problems while scanning continues if (cfg.screenon && cfg.screensaver) { vTaskDelay(2000/portTICK_PERIOD_MS); // pause for displaying results yield();