minor u8x8 code optimizations

This commit is contained in:
Klaus K Wilting 2018-04-06 17:31:01 +02:00
parent b82a770882
commit 0041970142
2 changed files with 0 additions and 4 deletions

View File

@ -92,14 +92,12 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) { void onResult(BLEAdvertisedDevice advertisedDevice) {
int lastcount = (int) macs.size(); int lastcount = (int) macs.size();
uint8_t *p = (uint8_t *) advertisedDevice.getAddress().getNative(); uint8_t *p = (uint8_t *) advertisedDevice.getAddress().getNative();
// Current devices seen on this scan session // Current devices seen on this scan session
currentScanDevice++; currentScanDevice++;
// 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:%-4d", (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.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE
} }
u8x8.setCursor(11,3); u8x8.setCursor(11,3);

View File

@ -272,9 +272,7 @@ void sniffer_loop(void * pvParameters) {
ESP_LOGI(TAG, "Wifi set channel %d", channel); ESP_LOGI(TAG, "Wifi set channel %d", channel);
snprintf(buff, sizeof(buff), "PAX:%d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value snprintf(buff, sizeof(buff), "PAX:%d", (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.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE
// u8x8.clearLine(3); // not needed?
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) {