Merge pull request #25 from phl0/NextionFormatting

Variable type for callsign in TFTSerial and HD44780
This commit is contained in:
Jonathan Naylor 2016-04-21 11:50:00 +01:00
commit ba63f7fb19
5 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,7 @@
const char* LISTENING = "Listening "; const char* LISTENING = "Listening ";
CHD44780::CHD44780(unsigned int rows, unsigned int cols, const char* callsign, unsigned int dmrid, const std::vector<unsigned int>& pins) : CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector<unsigned int>& pins) :
m_rows(rows), m_rows(rows),
m_cols(cols), m_cols(cols),
m_callsign(callsign), m_callsign(callsign),
@ -44,7 +44,7 @@ m_dmr(false)
{ {
assert(rows > 1U); assert(rows > 1U);
assert(cols > 15U); assert(cols > 15U);
assert(callsign != NULL); assert(callsign.c_str() != NULL);
} }
CHD44780::~CHD44780() CHD44780::~CHD44780()
@ -93,7 +93,7 @@ void CHD44780::setIdle()
::lcdClear(m_fd); ::lcdClear(m_fd);
::lcdPosition(m_fd, 0, 0); ::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "%-6s / %u", m_callsign, m_dmrid); ::lcdPrintf(m_fd, "%-6s / %u", m_callsign.c_str(), m_dmrid);
::lcdPosition(m_fd, 0, 1); ::lcdPosition(m_fd, 0, 1);
::lcdPuts(m_fd, "MMDVM Idle"); ::lcdPuts(m_fd, "MMDVM Idle");

View File

@ -37,7 +37,7 @@
class CHD44780 : public IDisplay class CHD44780 : public IDisplay
{ {
public: public:
CHD44780(unsigned int rows, unsigned int cols, const char* callsign, unsigned int dmrid, const std::vector<unsigned int>& pins); CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector<unsigned int>& pins);
virtual ~CHD44780(); virtual ~CHD44780();
virtual bool open(); virtual bool open();
@ -61,7 +61,7 @@ public:
private: private:
unsigned int m_rows; unsigned int m_rows;
unsigned int m_cols; unsigned int m_cols;
const char* m_callsign; std::string m_callsign;
unsigned int m_dmrid; unsigned int m_dmrid;
unsigned int m_rb; unsigned int m_rb;
unsigned int m_strb; unsigned int m_strb;

View File

@ -582,7 +582,7 @@ void CMMDVMHost::createDisplay()
LogInfo(" Port: %s", port.c_str()); LogInfo(" Port: %s", port.c_str());
LogInfo(" Brightness: %u", brightness); LogInfo(" Brightness: %u", brightness);
m_display = new CTFTSerial(callsign.c_str(), dmrid, port, brightness); m_display = new CTFTSerial(callsign, dmrid, port, brightness);
} else if (type == "Nextion") { } else if (type == "Nextion") {
std::string port = m_conf.getNextionPort(); std::string port = m_conf.getNextionPort();
unsigned int brightness = m_conf.getNextionBrightness(); unsigned int brightness = m_conf.getNextionBrightness();
@ -602,7 +602,7 @@ void CMMDVMHost::createDisplay()
LogInfo(" Columns: %u", columns); LogInfo(" Columns: %u", columns);
LogInfo(" Pins: %u,%u,%u,%u,%u,%u", pins.at(0U), pins.at(1U), pins.at(2U), pins.at(3U), pins.at(4U), pins.at(5U)); LogInfo(" Pins: %u,%u,%u,%u,%u,%u", pins.at(0U), pins.at(1U), pins.at(2U), pins.at(3U), pins.at(4U), pins.at(5U));
m_display = new CHD44780(rows, columns, callsign.c_str(), dmrid, pins); m_display = new CHD44780(rows, columns, callsign, dmrid, pins);
} }
#endif #endif
} else { } else {

View File

@ -44,14 +44,14 @@ const unsigned char FONT_LARGE = 3U;
// x = 0 to 159, y = 0 to 127 - Landscape // x = 0 to 159, y = 0 to 127 - Landscape
// x = 0 to 127, y = 0 to 159 - Portrait // x = 0 to 127, y = 0 to 159 - Portrait
CTFTSerial::CTFTSerial(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) : CTFTSerial::CTFTSerial(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) :
m_callsign(callsign), m_callsign(callsign),
m_dmrid(dmrid), m_dmrid(dmrid),
m_serial(port, SERIAL_9600), m_serial(port, SERIAL_9600),
m_brightness(brightness), m_brightness(brightness),
m_mode(MODE_IDLE) m_mode(MODE_IDLE)
{ {
assert(callsign != NULL); assert(callsign.c_str() != NULL);
assert(brightness >= 0U && brightness <= 100U); assert(brightness >= 0U && brightness <= 100U);
} }
@ -91,7 +91,7 @@ void CTFTSerial::setIdle()
displayBitmap(0U, 0U, "MMDVM_sm.bmp"); displayBitmap(0U, 0U, "MMDVM_sm.bmp");
char text[30]; char text[30];
::sprintf(text, "%-6s / %u", m_callsign, m_dmrid); ::sprintf(text, "%-6s / %u", m_callsign.c_str(), m_dmrid);
gotoPosPixel(18U, 55U); gotoPosPixel(18U, 55U);
displayText(text); displayText(text);

View File

@ -28,7 +28,7 @@
class CTFTSerial : public IDisplay class CTFTSerial : public IDisplay
{ {
public: public:
CTFTSerial(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness); CTFTSerial(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness);
virtual ~CTFTSerial(); virtual ~CTFTSerial();
virtual bool open(); virtual bool open();
@ -50,7 +50,7 @@ public:
virtual void close(); virtual void close();
private: private:
const char* m_callsign; std::string m_callsign;
unsigned int m_dmrid; unsigned int m_dmrid;
CSerialController m_serial; CSerialController m_serial;
unsigned int m_brightness; unsigned int m_brightness;