From 6838ca23bb03242ce660739808924a0b4bddaa2e Mon Sep 17 00:00:00 2001 From: Chipster Date: Sun, 11 Jun 2023 10:35:39 -0500 Subject: [PATCH] Removed extranneous `m_display.startscrolldiagleft` func. --- OLED.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++--------- Version.h | 2 +- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/OLED.cpp b/OLED.cpp index b289894..c951806 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -257,15 +257,6 @@ void COLED::setIdleInt() m_display.clearDisplay(); OLED_statusbar(); -// m_display.setCursor(0,30); -// m_display.setTextSize(3); -// m_display.print("Idle"); - -// m_display.setTextSize(1); - if (m_displayScroll && m_displayLogoScreensaver) - m_display.startscrolldiagleft(0x00,0x0f); //the MMDVM logo scrolls the whole screen - m_display.display(); - unsigned char info[100U]; CNetworkInfo* m_network; @@ -284,6 +275,53 @@ void COLED::setIdleInt() networkInfoInitialized = true; passCounter = 0; } + + // Let's let the users know if they are in Auto-AP mode... + if (m_ipaddress.find("wlan0_ap") != std::string::npos) { + size_t pos = m_ipaddress.find("wlan0_ap"); + if (pos != std::string::npos) { + m_ipaddress.erase(pos, 9); // remove redundant/superfluous "wlan0_ap" from string + } + // Read ssid value from /etc/hostapd.conf if it exists... + std::string ssid; + std::ifstream configFile("/etc/hostapd.conf"); + if (configFile.is_open()) { + std::string line; + while (std::getline(configFile, line)) { + if (line.find("ssid=") != std::string::npos) { + std::istringstream iss(line); + std::string key, value; + if (std::getline(iss, key, '=') && std::getline(iss, value)) { + ssid = value; + break; + } + } + } + configFile.close(); + } else { + ssid = "Unknown"; // `/etc/hostapd.conf` does not exist... + } + + m_display.setCursor(0, OLED_LINE3); + m_display.setTextSize(1); + m_display.printf("Auto-AP Running..."); + m_display.setCursor(0, OLED_LINE4); + m_display.setTextSize(1); + m_display.printf("SSID: %s", ssid.c_str()); + m_display.setCursor(0, OLED_LINE5); + m_display.setTextSize(1); + m_display.printf("IP: %s", m_ipaddress.c_str()); + } else { // Connected to network - no Auto-AP mode; normal display layout... + m_display.setCursor(0,OLED_LINE3); + m_display.setTextSize(1); + m_display.print(" -IDLE-"); + m_display.setCursor(0, OLED_LINE5); + m_display.printf(" %s", m_ipaddress.c_str()); + } + + if (m_displayScroll && m_displayLogoScreensaver) + m_display.startscrolldiagleft(0x00,0x0f); // the MMDVM logo scrolls the whole screen + m_display.display(); } void COLED::setErrorInt(const char* text) diff --git a/Version.h b/Version.h index f5c6244..75f257c 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20220523"; +const char* VERSION = "20230611"; #endif