Add configurable scrolling to the OLED display.
This commit is contained in:
parent
8d9cfb0f46
commit
3749b8d9f4
8
Conf.cpp
8
Conf.cpp
|
@ -173,6 +173,7 @@ m_nextionIdleBrightness(20U),
|
||||||
m_oledType(3U),
|
m_oledType(3U),
|
||||||
m_oledBrightness(0U),
|
m_oledBrightness(0U),
|
||||||
m_oledInvert(false),
|
m_oledInvert(false),
|
||||||
|
m_oledScroll(false),
|
||||||
m_lcdprocAddress(),
|
m_lcdprocAddress(),
|
||||||
m_lcdprocPort(0U),
|
m_lcdprocPort(0U),
|
||||||
m_lcdprocLocalPort(0U),
|
m_lcdprocLocalPort(0U),
|
||||||
|
@ -571,6 +572,8 @@ bool CConf::read()
|
||||||
m_oledBrightness = (unsigned char)::atoi(value);
|
m_oledBrightness = (unsigned char)::atoi(value);
|
||||||
else if (::strcmp(key, "Invert") == 0)
|
else if (::strcmp(key, "Invert") == 0)
|
||||||
m_oledInvert = ::atoi(value) == 1;
|
m_oledInvert = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "Scroll") == 0)
|
||||||
|
m_oledScroll = ::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;
|
||||||
|
@ -1187,6 +1190,11 @@ bool CConf::getOLEDInvert() const
|
||||||
return m_oledInvert;
|
return m_oledInvert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getOLEDScroll() const
|
||||||
|
{
|
||||||
|
return m_oledScroll;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getLCDprocAddress() const
|
std::string CConf::getLCDprocAddress() const
|
||||||
{
|
{
|
||||||
return m_lcdprocAddress;
|
return m_lcdprocAddress;
|
||||||
|
|
2
Conf.h
2
Conf.h
|
@ -186,6 +186,7 @@ public:
|
||||||
unsigned char getOLEDType() const;
|
unsigned char getOLEDType() const;
|
||||||
unsigned char getOLEDBrightness() const;
|
unsigned char getOLEDBrightness() const;
|
||||||
bool getOLEDInvert() const;
|
bool getOLEDInvert() const;
|
||||||
|
bool getOLEDScroll() const;
|
||||||
|
|
||||||
// The LCDproc section
|
// The LCDproc section
|
||||||
std::string getLCDprocAddress() const;
|
std::string getLCDprocAddress() const;
|
||||||
|
@ -334,6 +335,7 @@ private:
|
||||||
unsigned char m_oledType;
|
unsigned char m_oledType;
|
||||||
unsigned char m_oledBrightness;
|
unsigned char m_oledBrightness;
|
||||||
bool m_oledInvert;
|
bool m_oledInvert;
|
||||||
|
bool m_oledScroll;
|
||||||
|
|
||||||
std::string m_lcdprocAddress;
|
std::string m_lcdprocAddress;
|
||||||
unsigned int m_lcdprocPort;
|
unsigned int m_lcdprocPort;
|
||||||
|
|
|
@ -165,6 +165,7 @@ IdleBrightness=20
|
||||||
Type=3
|
Type=3
|
||||||
Brightness=0
|
Brightness=0
|
||||||
Invert=0
|
Invert=0
|
||||||
|
Scroll=1
|
||||||
|
|
||||||
[LCDproc]
|
[LCDproc]
|
||||||
Address=localhost
|
Address=localhost
|
||||||
|
|
|
@ -1147,7 +1147,8 @@ void CMMDVMHost::createDisplay()
|
||||||
unsigned char type = m_conf.getOLEDType();
|
unsigned char type = m_conf.getOLEDType();
|
||||||
unsigned char brightness = m_conf.getOLEDBrightness();
|
unsigned char brightness = m_conf.getOLEDBrightness();
|
||||||
bool invert = m_conf.getOLEDInvert();
|
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
|
#endif
|
||||||
} else {
|
} else {
|
||||||
m_display = new CNullDisplay;
|
m_display = new CNullDisplay;
|
||||||
|
|
11
OLED.cpp
11
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
|
* 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
|
* 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_displayType(displayType),
|
||||||
m_displayBrightness(displayBrightness),
|
m_displayBrightness(displayBrightness),
|
||||||
m_displayInvert(displayInvert)
|
m_displayInvert(displayInvert),
|
||||||
|
m_displayScroll(displayScroll)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +390,6 @@ void COLED::OLED_statusbar()
|
||||||
else
|
else
|
||||||
display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE);
|
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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
class COLED : public CDisplay
|
class COLED : public CDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert);
|
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll);
|
||||||
virtual ~COLED();
|
virtual ~COLED();
|
||||||
|
|
||||||
virtual bool open();
|
virtual bool open();
|
||||||
|
@ -72,6 +72,7 @@ private:
|
||||||
unsigned char m_displayType;
|
unsigned char m_displayType;
|
||||||
unsigned char m_displayBrightness;
|
unsigned char m_displayBrightness;
|
||||||
bool m_displayInvert;
|
bool m_displayInvert;
|
||||||
|
bool m_displayScroll;
|
||||||
|
|
||||||
ArduiPi_OLED display;
|
ArduiPi_OLED display;
|
||||||
void OLED_statusbar();
|
void OLED_statusbar();
|
||||||
|
|
Loading…
Reference in a new issue