From a084e14fdf3ce55193fff9d29fdc5c11e3bfcfe1 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 12 Jun 2018 19:23:38 +0100 Subject: [PATCH] Convert POCSAG text to be multi-line. --- Nextion.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Nextion.cpp b/Nextion.cpp index 85c14ba..78c2421 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -694,7 +694,21 @@ void CNextion::writePOCSAGInt(uint32_t ric, const std::string& message) sendCommand(text); sendCommandAction(132U); - ::sprintf(text, "t1.txt=\"MSG: %s\"", message.c_str()); + // Convert the text to multi-line with \r characters between. + std::string display; + unsigned int n = 0U; + for (std::string::const_iterator it = message.cbegin(); it != message.cend(); ++it) { + char c = *it; + display.push_back(c); + n++; + + if (n == 16U) { + display.push_back('\r'); + n = 0U; + } + } + + ::sprintf(text, "t1.txt=\"%s\"", display.c_str()); sendCommand(text); sendCommandAction(133U);