Merge pull request #468 from mreckhof/master

Add Support for OLED Rotate
This commit is contained in:
Jonathan Naylor 2018-10-30 10:33:44 -07:00 committed by GitHub
commit ce372ec360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 3 deletions

View file

@ -234,6 +234,7 @@ m_oledType(3U),
m_oledBrightness(0U),
m_oledInvert(false),
m_oledScroll(false),
m_oledRotate(false),
m_lcdprocAddress(),
m_lcdprocPort(0U),
m_lcdprocLocalPort(0U),
@ -776,6 +777,8 @@ bool CConf::read()
m_oledInvert = ::atoi(value) == 1;
else if (::strcmp(key, "Scroll") == 0)
m_oledScroll = ::atoi(value) == 1;
else if (::strcmp(key, "Rotate") == 0)
m_oledRotate = ::atoi(value) == 1;
} else if (section == SECTION_LCDPROC) {
if (::strcmp(key, "Address") == 0)
m_lcdprocAddress = value;
@ -1667,6 +1670,11 @@ bool CConf::getOLEDScroll() const
return m_oledScroll;
}
bool CConf::getOLEDRotate() const
{
return m_oledRotate;
}
std::string CConf::getLCDprocAddress() const
{
return m_lcdprocAddress;

2
Conf.h
View file

@ -253,6 +253,7 @@ public:
unsigned char getOLEDBrightness() const;
bool getOLEDInvert() const;
bool getOLEDScroll() const;
bool getOLEDRotate() const;
// The LCDproc section
std::string getLCDprocAddress() const;
@ -467,6 +468,7 @@ private:
unsigned char m_oledBrightness;
bool m_oledInvert;
bool m_oledScroll;
bool m_oledRotate;
std::string m_lcdprocAddress;
unsigned int m_lcdprocPort;

View file

@ -608,7 +608,8 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
unsigned char brightness = conf.getOLEDBrightness();
bool invert = conf.getOLEDInvert();
bool scroll = conf.getOLEDScroll();
display = new COLED(type, brightness, invert, scroll, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2());
bool rotate = conf.getOLEDRotate();
display = new COLED(type, brightness, invert, scroll, rotate, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2());
#endif
} else {
LogWarning("No valid display found, disabling");

View file

@ -232,6 +232,7 @@ Type=3
Brightness=0
Invert=0
Scroll=1
Rotate=0
[LCDproc]
Address=localhost

View file

@ -169,11 +169,12 @@ 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 slot1Enabled, bool slot2Enabled) :
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool slot1Enabled, bool slot2Enabled) :
m_displayType(displayType),
m_displayBrightness(displayBrightness),
m_displayInvert(displayInvert),
m_displayScroll(displayScroll),
m_displayRotate(displayRotate),
m_slot1Enabled(slot1Enabled),
m_slot2Enabled(slot2Enabled)
{
@ -207,6 +208,11 @@ bool COLED::open()
if (m_displayBrightness > 0U)
display.setBrightness(m_displayBrightness);
if (m_displayRotate > 0U) {
display.sendCommand(0xC0);
display.sendCommand(0xA0);
}
// init done
display.clearDisplay(); // clears the screen buffer
display.display(); // display it (clear display)

3
OLED.h
View file

@ -40,7 +40,7 @@
class COLED : public CDisplay
{
public:
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool slot1Enabled, bool slot2Enabled);
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool slot1Enabled, bool slot2Enabled);
virtual ~COLED();
virtual bool open();
@ -83,6 +83,7 @@ private:
unsigned char m_displayBrightness;
bool m_displayInvert;
bool m_displayScroll;
bool m_displayRotate;
bool m_slot1Enabled;
bool m_slot2Enabled;
std::string m_ipaddress;