OLED Display cosmetics

This commit is contained in:
Klaus K Wilting 2018-04-06 17:19:37 +02:00
parent a65c6f8596
commit b82a770882
2 changed files with 12 additions and 10 deletions

View File

@ -98,21 +98,20 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
// add this device and refresh display if it was not previously added // add this device and refresh display if it was not previously added
if ( mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE) ) { if ( mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE) ) {
char buff[16]; 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.setCursor(0,0);
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(12,3); u8x8.setCursor(11,3);
u8x8.printf("%d", currentScanDevice); u8x8.printf("%-4d", currentScanDevice);
} }
}; };
void BLECount() { void BLECount() {
ESP_LOGI(TAG, "BLE scan started"); ESP_LOGI(TAG, "BLE scan started");
currentScanDevice = 0; // Set 0 seen device on this scan session currentScanDevice = 0; // Set 0 seen device on this scan session
//u8x8.clearLine(3); // not needed? u8x8.drawString(0,3,"Scanning->");
u8x8.drawString(0,3,"BLE Scan..."); BLEDevice::init(""); // we don't want to be seen by a name
BLEDevice::init(PROGNAME);
BLEScan* pBLEScan = BLEDevice::getScan(); //create new scan BLEScan* pBLEScan = BLEDevice::getScan(); //create new scan
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster

View File

@ -278,15 +278,17 @@ void sniffer_loop(void * pvParameters) {
u8x8.setCursor(0,3); u8x8.setCursor(0,3);
// We just state out of BLE scanning // We just state out of BLE scanning
if (currentScanDevice) { if (currentScanDevice) {
u8x8.printf("BLE#: %-4d %d", (int) bles.size(), currentScanDevice); u8x8.printf("BLE: %-4d %-4d", (int) bles.size(), currentScanDevice);
} else { } else {
u8x8.printf("BLE#: %-4d", (int) bles.size()); u8x8.printf("BLE: %-4d", (int) bles.size());
} }
u8x8.setCursor(0,4); 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.setCursor(0,5);
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit); 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 // 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 ) {
@ -325,6 +327,7 @@ void sniffer_loop(void * pvParameters) {
u8x8.clearLine(6); u8x8.clearLine(6);
// TBD: need to check if long 2000ms pause causes stack problems while scanning continues
if (cfg.screenon && cfg.screensaver) { if (cfg.screenon && cfg.screensaver) {
vTaskDelay(2000/portTICK_PERIOD_MS); // pause for displaying results vTaskDelay(2000/portTICK_PERIOD_MS); // pause for displaying results
yield(); yield();