From d1195efb8277bc3367adb3825fc7c122b39bb987 Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Sun, 20 Jun 2021 18:42:26 +0200 Subject: [PATCH] Fill Display Lines to Avoid Artifacts --- src/main.cpp | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fe9575f..5851e61 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,6 +84,12 @@ void loraKeySetup(uint8_t keyset) { lora.setKeys(NwkSkey_2, AppSkey_2, DevAddr_2); } +void fillLine() { + for (uint8_t i = oled.tx; i<15; i++) + oled.print(" "); + oled.println(""); +} + // Button Handler Function void handler(Button2& btn) { switch (btn.getClickType()) { @@ -198,37 +204,49 @@ void updateDisplay() { oldFix = hasFix; } oled.print("HDOP: "); - oled.println(buffer[0]); + oled.print(buffer[0]); + fillLine(); oled.print("Sats: "); oled.print(buffer[1]); oled.print("/"); - oled.println(buffer[2]); + oled.print(buffer[2]); + fillLine(); oled.print("Int: "); - oled.println(interval); + oled.print(interval); + fillLine(); oled.print("Packet: "); - oled.println(packets); + oled.print(packets); + fillLine(); oled.print("Alt: "); - oled.println(buffer[3]); + oled.print(buffer[3]); + fillLine(); oled.print("Speed: "); - oled.println(buffer[4]); + oled.print(buffer[4]); + fillLine(); oled.print("Bat: "); - oled.println((float)readSupplyVoltage()/1000); + oled.print((float)readSupplyVoltage()/1000); + fillLine(); } else { if (hasFix != oldFix){ oled.clear(); oldFix = hasFix; } - oled.println("NO GPS FIX"); + oled.print("NO GPS FIX"); + fillLine(); oled.print("Sats: "); oled.print(buffer[1]); oled.print("/"); - oled.println(buffer[2]); + oled.print(buffer[2]); + fillLine(); oled.print("Int: "); - oled.println(interval); + oled.print(interval); + fillLine(); oled.print("Packet: "); - oled.println(packets); + oled.print(packets); + fillLine(); oled.print("Bat: "); - oled.println((float)readSupplyVoltage()/1000); + oled.print((float)readSupplyVoltage()/1000); + fillLine(); } oled.print(statusmsg); oled.println(" ");