Merge pull request #468 from mreckhof/master
Add Support for OLED Rotate
This commit is contained in:
commit
ce372ec360
8
Conf.cpp
8
Conf.cpp
|
@ -234,6 +234,7 @@ m_oledType(3U),
|
||||||
m_oledBrightness(0U),
|
m_oledBrightness(0U),
|
||||||
m_oledInvert(false),
|
m_oledInvert(false),
|
||||||
m_oledScroll(false),
|
m_oledScroll(false),
|
||||||
|
m_oledRotate(false),
|
||||||
m_lcdprocAddress(),
|
m_lcdprocAddress(),
|
||||||
m_lcdprocPort(0U),
|
m_lcdprocPort(0U),
|
||||||
m_lcdprocLocalPort(0U),
|
m_lcdprocLocalPort(0U),
|
||||||
|
@ -776,6 +777,8 @@ bool CConf::read()
|
||||||
m_oledInvert = ::atoi(value) == 1;
|
m_oledInvert = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Scroll") == 0)
|
else if (::strcmp(key, "Scroll") == 0)
|
||||||
m_oledScroll = ::atoi(value) == 1;
|
m_oledScroll = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "Rotate") == 0)
|
||||||
|
m_oledRotate = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_LCDPROC) {
|
} else if (section == SECTION_LCDPROC) {
|
||||||
if (::strcmp(key, "Address") == 0)
|
if (::strcmp(key, "Address") == 0)
|
||||||
m_lcdprocAddress = value;
|
m_lcdprocAddress = value;
|
||||||
|
@ -1667,6 +1670,11 @@ bool CConf::getOLEDScroll() const
|
||||||
return m_oledScroll;
|
return m_oledScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getOLEDRotate() const
|
||||||
|
{
|
||||||
|
return m_oledRotate;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getLCDprocAddress() const
|
std::string CConf::getLCDprocAddress() const
|
||||||
{
|
{
|
||||||
return m_lcdprocAddress;
|
return m_lcdprocAddress;
|
||||||
|
|
2
Conf.h
2
Conf.h
|
@ -253,6 +253,7 @@ public:
|
||||||
unsigned char getOLEDBrightness() const;
|
unsigned char getOLEDBrightness() const;
|
||||||
bool getOLEDInvert() const;
|
bool getOLEDInvert() const;
|
||||||
bool getOLEDScroll() const;
|
bool getOLEDScroll() const;
|
||||||
|
bool getOLEDRotate() const;
|
||||||
|
|
||||||
// The LCDproc section
|
// The LCDproc section
|
||||||
std::string getLCDprocAddress() const;
|
std::string getLCDprocAddress() const;
|
||||||
|
@ -467,6 +468,7 @@ private:
|
||||||
unsigned char m_oledBrightness;
|
unsigned char m_oledBrightness;
|
||||||
bool m_oledInvert;
|
bool m_oledInvert;
|
||||||
bool m_oledScroll;
|
bool m_oledScroll;
|
||||||
|
bool m_oledRotate;
|
||||||
|
|
||||||
std::string m_lcdprocAddress;
|
std::string m_lcdprocAddress;
|
||||||
unsigned int m_lcdprocPort;
|
unsigned int m_lcdprocPort;
|
||||||
|
|
|
@ -608,7 +608,8 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||||
unsigned char brightness = conf.getOLEDBrightness();
|
unsigned char brightness = conf.getOLEDBrightness();
|
||||||
bool invert = conf.getOLEDInvert();
|
bool invert = conf.getOLEDInvert();
|
||||||
bool scroll = conf.getOLEDScroll();
|
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
|
#endif
|
||||||
} else {
|
} else {
|
||||||
LogWarning("No valid display found, disabling");
|
LogWarning("No valid display found, disabling");
|
||||||
|
|
|
@ -232,6 +232,7 @@ Type=3
|
||||||
Brightness=0
|
Brightness=0
|
||||||
Invert=0
|
Invert=0
|
||||||
Scroll=1
|
Scroll=1
|
||||||
|
Rotate=0
|
||||||
|
|
||||||
[LCDproc]
|
[LCDproc]
|
||||||
Address=localhost
|
Address=localhost
|
||||||
|
|
8
OLED.cpp
8
OLED.cpp
|
@ -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
|
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_displayType(displayType),
|
||||||
m_displayBrightness(displayBrightness),
|
m_displayBrightness(displayBrightness),
|
||||||
m_displayInvert(displayInvert),
|
m_displayInvert(displayInvert),
|
||||||
m_displayScroll(displayScroll),
|
m_displayScroll(displayScroll),
|
||||||
|
m_displayRotate(displayRotate),
|
||||||
m_slot1Enabled(slot1Enabled),
|
m_slot1Enabled(slot1Enabled),
|
||||||
m_slot2Enabled(slot2Enabled)
|
m_slot2Enabled(slot2Enabled)
|
||||||
{
|
{
|
||||||
|
@ -207,6 +208,11 @@ bool COLED::open()
|
||||||
if (m_displayBrightness > 0U)
|
if (m_displayBrightness > 0U)
|
||||||
display.setBrightness(m_displayBrightness);
|
display.setBrightness(m_displayBrightness);
|
||||||
|
|
||||||
|
if (m_displayRotate > 0U) {
|
||||||
|
display.sendCommand(0xC0);
|
||||||
|
display.sendCommand(0xA0);
|
||||||
|
}
|
||||||
|
|
||||||
// init done
|
// init done
|
||||||
display.clearDisplay(); // clears the screen buffer
|
display.clearDisplay(); // clears the screen buffer
|
||||||
display.display(); // display it (clear display)
|
display.display(); // display it (clear display)
|
||||||
|
|
3
OLED.h
3
OLED.h
|
@ -40,7 +40,7 @@
|
||||||
class COLED : public CDisplay
|
class COLED : public CDisplay
|
||||||
{
|
{
|
||||||
public:
|
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 ~COLED();
|
||||||
|
|
||||||
virtual bool open();
|
virtual bool open();
|
||||||
|
@ -83,6 +83,7 @@ private:
|
||||||
unsigned char m_displayBrightness;
|
unsigned char m_displayBrightness;
|
||||||
bool m_displayInvert;
|
bool m_displayInvert;
|
||||||
bool m_displayScroll;
|
bool m_displayScroll;
|
||||||
|
bool m_displayRotate;
|
||||||
bool m_slot1Enabled;
|
bool m_slot1Enabled;
|
||||||
bool m_slot2Enabled;
|
bool m_slot2Enabled;
|
||||||
std::string m_ipaddress;
|
std::string m_ipaddress;
|
||||||
|
|
Loading…
Reference in a new issue