From bd5117b9e44c83e11b2f9459bb53e50ecdb81058 Mon Sep 17 00:00:00 2001 From: sp5lg Date: Fri, 27 Sep 2019 22:28:57 +0200 Subject: [PATCH] Introducing LogoScreensaver=1 or 0 parameter for blanking OLED diplays in idle --- Conf.cpp | 8 ++++++++ Conf.h | 2 ++ Display.cpp | 3 ++- MMDVM.ini | 1 + OLED.cpp | 5 +++-- OLED.h | 3 ++- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index 73d0433..746b50a 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -237,6 +237,7 @@ m_oledBrightness(0U), m_oledInvert(false), m_oledScroll(false), m_oledRotate(false), +m_oledLogoScreensaver(true), m_lcdprocAddress(), m_lcdprocPort(0U), m_lcdprocLocalPort(0U), @@ -790,6 +791,8 @@ bool CConf::read() m_oledScroll = ::atoi(value) == 1; else if (::strcmp(key, "Rotate") == 0) m_oledRotate = ::atoi(value) == 1; + else if (::strcmp(key, "LogoScreensaver") == 0) + m_oledLogoScreensaver = ::atoi(value) == 1; } else if (section == SECTION_LCDPROC) { if (::strcmp(key, "Address") == 0) m_lcdprocAddress = value; @@ -1698,6 +1701,11 @@ bool CConf::getOLEDRotate() const return m_oledRotate; } +bool CConf::getOLEDLogoScreensaver() const +{ + return m_oledLogoScreensaver; +} + std::string CConf::getLCDprocAddress() const { diff --git a/Conf.h b/Conf.h index dd2c292..2bed9d7 100644 --- a/Conf.h +++ b/Conf.h @@ -254,6 +254,7 @@ public: bool getOLEDInvert() const; bool getOLEDScroll() const; bool getOLEDRotate() const; + bool getOLEDLogoScreensaver() const; // The LCDproc section std::string getLCDprocAddress() const; @@ -477,6 +478,7 @@ private: bool m_oledInvert; bool m_oledScroll; bool m_oledRotate; + bool m_oledLogoScreensaver; std::string m_lcdprocAddress; unsigned int m_lcdprocPort; diff --git a/Display.cpp b/Display.cpp index a66d3cc..6d9224d 100644 --- a/Display.cpp +++ b/Display.cpp @@ -569,8 +569,9 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem) bool invert = conf.getOLEDInvert(); bool scroll = conf.getOLEDScroll(); bool rotate = conf.getOLEDRotate(); + bool logosaver = conf.getOLEDLogoScreensaver(); - display = new COLED(type, brightness, invert, scroll, rotate, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2()); + display = new COLED(type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2()); #endif } else if (type == "CAST") { display = new CCASTInfo(modem); diff --git a/MMDVM.ini b/MMDVM.ini index 519cee7..56fe14e 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -234,6 +234,7 @@ Invert=0 Scroll=1 Rotate=0 Cast=0 +LogoScreensaver=1 [LCDproc] Address=localhost diff --git a/OLED.cpp b/OLED.cpp index 36d73fc..8dbfbe5 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -169,12 +169,13 @@ const unsigned char logo_POCSAG_bmp [] = 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool slot1Enabled, bool slot2Enabled) : +COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled) : m_displayType(displayType), m_displayBrightness(displayBrightness), m_displayInvert(displayInvert), m_displayScroll(displayScroll), m_displayRotate(displayRotate), +m_displayLogoScreensaver(displayLogoScreensaver), m_slot1Enabled(slot1Enabled), m_slot2Enabled(slot2Enabled), m_ipaddress(), @@ -600,7 +601,7 @@ void COLED::OLED_statusbar() m_display.drawBitmap(0, 0, logo_NXDN_bmp, 128, 16, WHITE); else if (m_mode == MODE_POCSAG) m_display.drawBitmap(0, 0, logo_POCSAG_bmp, 128, 16, WHITE); - else + else if (m_displayLogoScreensaver) m_display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE); if (m_displayScroll) diff --git a/OLED.h b/OLED.h index 8153546..8169cc9 100644 --- a/OLED.h +++ b/OLED.h @@ -40,7 +40,7 @@ class COLED : public CDisplay { public: - COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool slot1Enabled, bool slot2Enabled); + COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled); virtual ~COLED(); virtual bool open(); @@ -83,6 +83,7 @@ private: bool m_displayInvert; bool m_displayScroll; bool m_displayRotate; + bool m_displayLogoScreensaver; bool m_slot1Enabled; bool m_slot2Enabled; std::string m_ipaddress;