Add dot as date separator
This commit is contained in:
parent
768e3efcad
commit
2bd75c1cff
8
Conf.cpp
8
Conf.cpp
|
@ -139,6 +139,7 @@ m_nextionPort("/dev/ttyAMA0"),
|
|||
m_nextionBrightness(50U),
|
||||
m_nextionDisplayClock(false),
|
||||
m_nextionUTC(false),
|
||||
m_nextionDateFormat("English"),
|
||||
m_oledType(3),
|
||||
m_oledBrightness(0),
|
||||
m_oledInvert(0)
|
||||
|
@ -461,6 +462,8 @@ bool CConf::read()
|
|||
m_nextionDisplayClock = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "UTC") == 0)
|
||||
m_nextionUTC = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "DateFormat") == 0)
|
||||
m_nextionDateFormat = value;
|
||||
} else if (section == SECTION_OLED) {
|
||||
if (::strcmp(key, "Type") == 0)
|
||||
m_oledType = (unsigned char)::atoi(value);
|
||||
|
@ -926,6 +929,11 @@ bool CConf::getNextionUTC() const
|
|||
return m_nextionUTC;
|
||||
}
|
||||
|
||||
std::string CConf::getNextionDateFormat() const
|
||||
{
|
||||
return m_nextionDateFormat;
|
||||
}
|
||||
|
||||
unsigned char CConf::getOLEDType() const
|
||||
{
|
||||
return m_oledType;
|
||||
|
|
2
Conf.h
2
Conf.h
|
@ -148,6 +148,7 @@ public:
|
|||
unsigned int getNextionBrightness() const;
|
||||
bool getNextionDisplayClock() const;
|
||||
bool getNextionUTC() const;
|
||||
std::string getNextionDateFormat() const;
|
||||
|
||||
// The OLED section
|
||||
unsigned char getOLEDType() const;
|
||||
|
@ -260,6 +261,7 @@ private:
|
|||
unsigned int m_nextionBrightness;
|
||||
bool m_nextionDisplayClock;
|
||||
bool m_nextionUTC;
|
||||
std::string m_nextionDateFormat;
|
||||
|
||||
unsigned char m_oledType;
|
||||
unsigned char m_oledBrightness;
|
||||
|
|
|
@ -124,6 +124,7 @@ Port=/dev/ttyAMA0
|
|||
Brightness=50
|
||||
DisplayClock=1
|
||||
UTC=0
|
||||
DateFormat=English
|
||||
|
||||
[OLED]
|
||||
Type=3
|
||||
|
|
|
@ -833,6 +833,7 @@ void CMMDVMHost::createDisplay()
|
|||
unsigned int brightness = m_conf.getNextionBrightness();
|
||||
bool displayClock = m_conf.getNextionDisplayClock();
|
||||
bool utc = m_conf.getNextionUTC();
|
||||
std::string dateformat = m_conf.getNextionDateFormat();
|
||||
|
||||
LogInfo(" Port: %s", port.c_str());
|
||||
LogInfo(" Brightness: %u", brightness);
|
||||
|
@ -840,7 +841,7 @@ void CMMDVMHost::createDisplay()
|
|||
if (displayClock)
|
||||
LogInfo(" Display UTC: %s", utc ? "yes" : "no");
|
||||
|
||||
m_display = new CNextion(m_callsign, dmrid, port, brightness, displayClock, utc);
|
||||
m_display = new CNextion(m_callsign, dmrid, port, brightness, displayClock, utc, dateformat);
|
||||
#if defined(HD44780)
|
||||
} else if (type == "HD44780") {
|
||||
unsigned int rows = m_conf.getHD44780Rows();
|
||||
|
|
11
Nextion.cpp
11
Nextion.cpp
|
@ -24,7 +24,7 @@
|
|||
#include <cstring>
|
||||
#include <ctime>
|
||||
|
||||
CNextion::CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness, bool displayClock, bool utc) :
|
||||
CNextion::CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness, bool displayClock, bool utc, const std::string& dateformat) :
|
||||
CDisplay(),
|
||||
m_callsign(callsign),
|
||||
m_dmrid(dmrid),
|
||||
|
@ -33,6 +33,7 @@ m_brightness(brightness),
|
|||
m_mode(MODE_IDLE),
|
||||
m_displayClock(displayClock),
|
||||
m_utc(utc),
|
||||
m_dateformat(dateformat),
|
||||
m_clockDisplayTimer(1000U, 0U, 400U)
|
||||
{
|
||||
assert(brightness >= 0U && brightness <= 100U);
|
||||
|
@ -241,7 +242,13 @@ void CNextion::clockInt(unsigned int ms)
|
|||
int Sec = Time->tm_sec;
|
||||
|
||||
char text[50U];
|
||||
::sprintf(text, "t2.txt=\"%02d:%02d:%02d %02d/%02d/%2d\"", Hour, Min, Sec, Day, Month, Year % 100);
|
||||
if (strcmp(m_dateformat.c_str(), "English") == 0) {
|
||||
::sprintf(text, "t2.txt=\"%02d:%02d:%02d %02d/%02d/%2d\"", Hour, Min, Sec, Day, Month, Year % 100);
|
||||
printf(text, "t2.txt=\"%02d:%02d:%02d %02d/%02d/%2d\"", Hour, Min, Sec, Day, Month, Year % 100);
|
||||
} else if (strcmp(m_dateformat.c_str(), "German") == 0) {
|
||||
::sprintf(text, "t2.txt=\"%02d:%02d:%02d %02d.%02d.%2d\"", Hour, Min, Sec, Day, Month, Year % 100);
|
||||
printf(text, "t2.txt=\"%02d:%02d:%02d %02d.%02d.%2d\"", Hour, Min, Sec, Day, Month, Year % 100);
|
||||
}
|
||||
sendCommand(text);
|
||||
|
||||
m_clockDisplayTimer.start(); // restart the clock display timer
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CNextion : public CDisplay
|
||||
{
|
||||
public:
|
||||
CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness, bool displayClock, bool utc);
|
||||
CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness, bool displayClock, bool utc, const std::string& dateformat);
|
||||
virtual ~CNextion();
|
||||
|
||||
virtual bool open();
|
||||
|
@ -60,6 +60,7 @@ private:
|
|||
unsigned char m_mode;
|
||||
bool m_displayClock;
|
||||
bool m_utc;
|
||||
std::string m_dateformat;
|
||||
CTimer m_clockDisplayTimer;
|
||||
|
||||
void sendCommand(const char* command);
|
||||
|
|
Loading…
Reference in a new issue