Add configurable scrolling to the OLED display.
This commit is contained in:
parent
8d9cfb0f46
commit
3749b8d9f4
6 changed files with 25 additions and 11 deletions
8
Conf.cpp
8
Conf.cpp
|
@ -173,6 +173,7 @@ m_nextionIdleBrightness(20U),
|
|||
m_oledType(3U),
|
||||
m_oledBrightness(0U),
|
||||
m_oledInvert(false),
|
||||
m_oledScroll(false),
|
||||
m_lcdprocAddress(),
|
||||
m_lcdprocPort(0U),
|
||||
m_lcdprocLocalPort(0U),
|
||||
|
@ -571,6 +572,8 @@ bool CConf::read()
|
|||
m_oledBrightness = (unsigned char)::atoi(value);
|
||||
else if (::strcmp(key, "Invert") == 0)
|
||||
m_oledInvert = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Scroll") == 0)
|
||||
m_oledScroll = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_LCDPROC) {
|
||||
if (::strcmp(key, "Address") == 0)
|
||||
m_lcdprocAddress = value;
|
||||
|
@ -1187,6 +1190,11 @@ bool CConf::getOLEDInvert() const
|
|||
return m_oledInvert;
|
||||
}
|
||||
|
||||
bool CConf::getOLEDScroll() const
|
||||
{
|
||||
return m_oledScroll;
|
||||
}
|
||||
|
||||
std::string CConf::getLCDprocAddress() const
|
||||
{
|
||||
return m_lcdprocAddress;
|
||||
|
|
2
Conf.h
2
Conf.h
|
@ -186,6 +186,7 @@ public:
|
|||
unsigned char getOLEDType() const;
|
||||
unsigned char getOLEDBrightness() const;
|
||||
bool getOLEDInvert() const;
|
||||
bool getOLEDScroll() const;
|
||||
|
||||
// The LCDproc section
|
||||
std::string getLCDprocAddress() const;
|
||||
|
@ -334,6 +335,7 @@ private:
|
|||
unsigned char m_oledType;
|
||||
unsigned char m_oledBrightness;
|
||||
bool m_oledInvert;
|
||||
bool m_oledScroll;
|
||||
|
||||
std::string m_lcdprocAddress;
|
||||
unsigned int m_lcdprocPort;
|
||||
|
|
|
@ -165,6 +165,7 @@ IdleBrightness=20
|
|||
Type=3
|
||||
Brightness=0
|
||||
Invert=0
|
||||
Scroll=1
|
||||
|
||||
[LCDproc]
|
||||
Address=localhost
|
||||
|
|
|
@ -1147,7 +1147,8 @@ void CMMDVMHost::createDisplay()
|
|||
unsigned char type = m_conf.getOLEDType();
|
||||
unsigned char brightness = m_conf.getOLEDBrightness();
|
||||
bool invert = m_conf.getOLEDInvert();
|
||||
m_display = new COLED(type, brightness, invert);
|
||||
bool scroll = m_conf.getOLEDScroll();
|
||||
m_display = new COLED(type, brightness, invert, scroll);
|
||||
#endif
|
||||
} else {
|
||||
m_display = new CNullDisplay;
|
||||
|
|
17
OLED.cpp
17
OLED.cpp
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -103,10 +103,11 @@ const unsigned char logo_fusion_bmp [] =
|
|||
};
|
||||
|
||||
|
||||
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert) :
|
||||
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll) :
|
||||
m_displayType(displayType),
|
||||
m_displayBrightness(displayBrightness),
|
||||
m_displayInvert(displayInvert)
|
||||
m_displayInvert(displayInvert),
|
||||
m_displayScroll(displayScroll)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -379,16 +380,16 @@ void COLED::OLED_statusbar()
|
|||
|
||||
display.setCursor(0,0);
|
||||
if (m_mode == MODE_DMR)
|
||||
display.drawBitmap(0, 0, logo_dmr_bmp, 128, 16, WHITE);
|
||||
display.drawBitmap(0, 0, logo_dmr_bmp, 128, 16, WHITE);
|
||||
else if (m_mode == MODE_DSTAR)
|
||||
display.drawBitmap(0, 0, logo_dstar_bmp, 128, 16, WHITE);
|
||||
display.drawBitmap(0, 0, logo_dstar_bmp, 128, 16, WHITE);
|
||||
else if (m_mode == MODE_YSF)
|
||||
display.drawBitmap(0, 0, logo_fusion_bmp, 128, 16, WHITE);
|
||||
display.drawBitmap(0, 0, logo_fusion_bmp, 128, 16, WHITE);
|
||||
else if (m_mode == MODE_P25)
|
||||
display.print("P25");
|
||||
else
|
||||
display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE);
|
||||
|
||||
// display.startscrollright(0x00,0x02); //<-Uncomment this line to make the mode logo scroll
|
||||
|
||||
if (m_displayScroll)
|
||||
display.startscrollright(0x00,0x02); //<-Uncomment this line to make the mode logo scroll
|
||||
}
|
||||
|
|
5
OLED.h
5
OLED.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -38,7 +38,7 @@
|
|||
class COLED : public CDisplay
|
||||
{
|
||||
public:
|
||||
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert);
|
||||
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll);
|
||||
virtual ~COLED();
|
||||
|
||||
virtual bool open();
|
||||
|
@ -72,6 +72,7 @@ private:
|
|||
unsigned char m_displayType;
|
||||
unsigned char m_displayBrightness;
|
||||
bool m_displayInvert;
|
||||
bool m_displayScroll;
|
||||
|
||||
ArduiPi_OLED display;
|
||||
void OLED_statusbar();
|
||||
|
|
Loading…
Reference in a new issue