From ffeae7ca1aae3980937d8e06e174d18abaff0acf Mon Sep 17 00:00:00 2001 From: Stefan Kremser Date: Sun, 14 Oct 2018 17:32:16 +0200 Subject: [PATCH] Improved packetMonitor draw function --- esp8266_deauther/DisplayUI.cpp | 22 +++++++++++++++++----- esp8266_deauther/DisplayUI.h | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/esp8266_deauther/DisplayUI.cpp b/esp8266_deauther/DisplayUI.cpp index 292fb62..4ee2b90 100644 --- a/esp8266_deauther/DisplayUI.cpp +++ b/esp8266_deauther/DisplayUI.cpp @@ -731,17 +731,29 @@ void DisplayUI::drawLoadingScan() { } void DisplayUI::drawPacketMonitor() { - double scale = scan.getScaleFactor(50); + double scale = scan.getScaleFactor(sreenHeight - lineHeight - 2); String headline = leftRight(str(D_CH) + getChannel() + String(' ') + String('[') + String(scan.deauths) + String(']'), String(scan.getPacketRate()) + str(D_PKTS), maxLen); drawString(0, 0, headline); if (scan.getMaxPacket() > 0) { - for (int i = 0; i < SCAN_PACKET_LIST_SIZE * 2; i += 2) { - drawLine(i, 64, i, 64 - scan.getPackets(i / 2) * scale); - drawLine(i + 1, 64, i + 1, 64 - scan.getPackets(i / 2) * scale); - } + int i = 0; + int x = 0; + int y = 0; + while(i < SCAN_PACKET_LIST_SIZE && x < screenWidth){ + y = (sreenHeight-1) - (scan.getPackets(i) * scale); + i++; + + //Serial.printf("%d,%d -> %d,%d\n", x, (sreenHeight-1), x, y); + drawLine(x, (sreenHeight-1), x, y); + x++; + + //Serial.printf("%d,%d -> %d,%d\n", x, (sreenHeight-1), x, y); + drawLine(x, (sreenHeight-1), x, y); + x++; + } + //Serial.println("---------"); } } diff --git a/esp8266_deauther/DisplayUI.h b/esp8266_deauther/DisplayUI.h index 5f08bd9..5f23864 100644 --- a/esp8266_deauther/DisplayUI.h +++ b/esp8266_deauther/DisplayUI.h @@ -85,6 +85,8 @@ class DisplayUI { const uint8_t buttonDelay = 250; const uint8_t drawInterval = 100; // 100ms = 10 FPS const uint16_t screenIntroTime = 2500; + const uint16_t screenWidth = 128; + const uint16_t sreenHeight = 64; void configInit(); void configOn();