Clean up the OLED configuration.
This commit is contained in:
parent
8f2a2a1d46
commit
b69336dca1
5 changed files with 23 additions and 24 deletions
14
Conf.cpp
14
Conf.cpp
|
@ -169,9 +169,9 @@ m_nextionBrightness(50U),
|
|||
m_nextionDisplayClock(false),
|
||||
m_nextionUTC(false),
|
||||
m_nextionIdleBrightness(20U),
|
||||
m_oledType(3),
|
||||
m_oledBrightness(0),
|
||||
m_oledInvert(0),
|
||||
m_oledType(3U),
|
||||
m_oledBrightness(0U),
|
||||
m_oledInvert(false),
|
||||
m_lcdprocAddress(),
|
||||
m_lcdprocPort(0U),
|
||||
m_lcdprocLocalPort(0U),
|
||||
|
@ -589,10 +589,10 @@ bool CConf::read()
|
|||
} else if (section == SECTION_OLED) {
|
||||
if (::strcmp(key, "Type") == 0)
|
||||
m_oledType = (unsigned char)::atoi(value);
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_oledBrightness = (unsigned char)::atoi(value);
|
||||
else if (::strcmp(key, "Brightness") == 0)
|
||||
m_oledInvert = (unsigned char)::atoi(value);
|
||||
m_oledBrightness = (unsigned char)::atoi(value);
|
||||
else if (::strcmp(key, "Invert") == 0)
|
||||
m_oledInvert = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_LCDPROC) {
|
||||
if (::strcmp(key, "Address") == 0)
|
||||
m_lcdprocAddress = value;
|
||||
|
@ -1199,7 +1199,7 @@ unsigned char CConf::getOLEDBrightness() const
|
|||
return m_oledBrightness;
|
||||
}
|
||||
|
||||
unsigned char CConf::getOLEDInvert() const
|
||||
bool CConf::getOLEDInvert() const
|
||||
{
|
||||
return m_oledInvert;
|
||||
}
|
||||
|
|
4
Conf.h
4
Conf.h
|
@ -184,7 +184,7 @@ public:
|
|||
// The OLED section
|
||||
unsigned char getOLEDType() const;
|
||||
unsigned char getOLEDBrightness() const;
|
||||
unsigned char getOLEDInvert() const;
|
||||
bool getOLEDInvert() const;
|
||||
|
||||
// The LCDproc section
|
||||
std::string getLCDprocAddress() const;
|
||||
|
@ -331,7 +331,7 @@ private:
|
|||
|
||||
unsigned char m_oledType;
|
||||
unsigned char m_oledBrightness;
|
||||
unsigned char m_oledInvert;
|
||||
bool m_oledInvert;
|
||||
|
||||
std::string m_lcdprocAddress;
|
||||
unsigned int m_lcdprocPort;
|
||||
|
|
|
@ -1134,10 +1134,10 @@ void CMMDVMHost::createDisplay()
|
|||
|
||||
#if defined(OLED)
|
||||
} else if (type == "OLED") {
|
||||
unsigned char displayType = m_conf.getOLEDType();
|
||||
unsigned char displayBrightness = m_conf.getOLEDBrightness();
|
||||
unsigned char displayInvert = m_conf.getOLEDInvert();
|
||||
m_display = new COLED(displayType, displayBrightness, displayInvert);
|
||||
unsigned char type = m_conf.getOLEDType();
|
||||
unsigned char brightness = m_conf.getOLEDBrightness();
|
||||
bool invert = m_conf.getOLEDInvert();
|
||||
m_display = new COLED(type, brightness, invert);
|
||||
#endif
|
||||
} else {
|
||||
m_display = new CNullDisplay;
|
||||
|
|
6
OLED.cpp
6
OLED.cpp
|
@ -56,7 +56,7 @@ static unsigned char logo_dmr_bmp[] =
|
|||
0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111
|
||||
};
|
||||
|
||||
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, unsigned char displayInvert) :
|
||||
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert) :
|
||||
m_displayType(displayType),
|
||||
m_displayBrightness(displayBrightness),
|
||||
m_displayInvert(displayInvert)
|
||||
|
@ -85,8 +85,8 @@ bool COLED::open()
|
|||
|
||||
display.begin();
|
||||
|
||||
display.invertDisplay(m_displayInvert);
|
||||
if (m_displayBrightness > 0)
|
||||
display.invertDisplay(m_displayInvert ? 1 : 0);
|
||||
if (m_displayBrightness > 0U)
|
||||
display.setBrightness(m_displayBrightness);
|
||||
|
||||
// init done
|
||||
|
|
3
OLED.h
3
OLED.h
|
@ -70,8 +70,7 @@ private:
|
|||
unsigned char m_mode;
|
||||
unsigned char m_displayType;
|
||||
unsigned char m_displayBrightness;
|
||||
unsigned char m_displayInvert;
|
||||
|
||||
bool m_displayInvert;
|
||||
|
||||
ArduiPi_OLED display;
|
||||
void OLED_statusbar();
|
||||
|
|
Loading…
Reference in a new issue