Hopefully fix the missing display of the first transmission in all modes.

This commit is contained in:
Jonathan Naylor 2016-04-11 12:21:46 +01:00
parent 9c283395fd
commit 4329c627db
10 changed files with 124 additions and 139 deletions

View File

@ -33,15 +33,12 @@ public:
virtual void setLockout() = 0;
virtual void setError(const char* text) = 0;
virtual void setDStar() = 0;
virtual void writeDStar(const char* my1, const char* my2, const char* your) = 0;
virtual void clearDStar() = 0;
virtual void setDMR() = 0;
virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type) = 0;
virtual void clearDMR(unsigned int slotNo) = 0;
virtual void setFusion() = 0;
virtual void writeFusion(const char* source, const char* dest) = 0;
virtual void clearFusion() = 0;

View File

@ -38,7 +38,8 @@ m_d0(pins.at(2U)),
m_d1(pins.at(3U)),
m_d2(pins.at(4U)),
m_d3(pins.at(5U)),
m_fd(-1)
m_fd(-1),
m_dmr(false)
{
assert(rows > 1U);
assert(cols > 15U);
@ -74,6 +75,8 @@ void CHD44780::setIdle()
::lcdPosition(m_fd, 0, 1);
::lcdPuts(m_fd, "MMDVM Idle");
m_dmr = false;
}
void CHD44780::setError(const char* text)
@ -87,6 +90,8 @@ void CHD44780::setError(const char* text)
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%s ERROR", text);
m_dmr = false;
}
void CHD44780::setLockout()
@ -98,17 +103,8 @@ void CHD44780::setLockout()
::lcdPosition(m_fd, 0, 1);
::lcdPuts(m_fd, "Lockout");
}
void CHD44780::setDStar()
{
::lcdClear(m_fd);
::lcdPosition(m_fd, 0, 0);
::lcdPuts(m_fd, "D-Star");
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
m_dmr = false;
}
void CHD44780::writeDStar(const char* my1, const char* my2, const char* your)
@ -117,6 +113,11 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your)
assert(my2 != NULL);
assert(your != NULL);
::lcdClear(m_fd);
::lcdPosition(m_fd, 0, 0);
::lcdPuts(m_fd, "D-Star");
if (m_rows > 2U) {
char buffer[40U];
@ -134,6 +135,8 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your)
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
}
m_dmr = false;
}
void CHD44780::clearDStar()
@ -150,30 +153,27 @@ void CHD44780::clearDStar()
}
}
void CHD44780::setDMR()
{
::lcdClear(m_fd);
int row = 0;
if (m_rows > 2U) {
::lcdPosition(m_fd, 0, row);
::lcdPuts(m_fd, "DMR");
row++;
}
::lcdPosition(m_fd, 0, row);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
row++;
::lcdPosition(m_fd, 0, row);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
}
void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
{
assert(type != NULL);
::lcdClear(m_fd);
if (m_rows > 2U) {
::lcdPosition(m_fd, 0, 0);
::lcdPuts(m_fd, "DMR");
}
if (!m_dmr) {
if (slotNo == 1U) {
::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
} else {
::lcdPosition(m_fd, 0, m_rows > 2U ? 1 : 0);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
}
}
if (slotNo == 1U) {
char buffer[40U];
if (m_cols > 16U)
@ -193,6 +193,8 @@ void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, uns
::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}
m_dmr = true;
}
void CHD44780::clearDMR(unsigned int slotNo)
@ -206,22 +208,16 @@ void CHD44780::clearDMR(unsigned int slotNo)
}
}
void CHD44780::setFusion()
{
::lcdClear(m_fd);
::lcdPosition(m_fd, 0, 0);
::lcdPuts(m_fd, "System Fusion");
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
}
void CHD44780::writeFusion(const char* source, const char* dest)
{
assert(source != NULL);
assert(dest != NULL);
::lcdClear(m_fd);
::lcdPosition(m_fd, 0, 0);
::lcdPuts(m_fd, "System Fusion");
if (m_rows > 2U) {
char buffer[40U];
@ -239,6 +235,8 @@ void CHD44780::writeFusion(const char* source, const char* dest)
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
}
m_dmr = false;
}
void CHD44780::clearFusion()

View File

@ -37,15 +37,12 @@ public:
virtual void setError(const char* text);
virtual void setLockout();
virtual void setDStar();
virtual void writeDStar(const char* my1, const char* my2, const char* your);
virtual void clearDStar();
virtual void setDMR();
virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void setFusion();
virtual void writeFusion(const char* source, const char* dest);
virtual void clearFusion();
@ -63,6 +60,7 @@ private:
unsigned int m_d2;
unsigned int m_d3;
int m_fd;
bool m_dmr;
};
#endif

View File

@ -625,7 +625,6 @@ void CMMDVMHost::setMode(unsigned char mode, bool logging)
LogMessage("Mode set to D-Star");
if (m_dmrNetwork != NULL)
m_dmrNetwork->enable(false);
m_display->setDStar();
m_modem->setMode(MODE_DSTAR);
m_mode = MODE_DSTAR;
m_modeTimer.start();
@ -636,7 +635,6 @@ void CMMDVMHost::setMode(unsigned char mode, bool logging)
LogMessage("Mode set to DMR");
if (m_dstarNetwork != NULL)
m_dstarNetwork->enable(false);
m_display->setDMR();
m_modem->setMode(MODE_DMR);
if (m_duplex)
m_modem->writeDMRStart(true);
@ -651,7 +649,6 @@ void CMMDVMHost::setMode(unsigned char mode, bool logging)
m_dstarNetwork->enable(false);
if (m_dmrNetwork != NULL)
m_dmrNetwork->enable(false);
m_display->setFusion();
m_modem->setMode(MODE_YSF);
m_mode = MODE_YSF;
m_modeTimer.start();

View File

@ -27,7 +27,8 @@ CNextion::CNextion(const char* callsign, unsigned int dmrid, const std::string&
m_callsign(callsign),
m_dmrid(dmrid),
m_serial(port, SERIAL_9600),
m_brightness(brightness)
m_brightness(brightness),
m_mode(MODE_IDLE)
{
assert(brightness >= 0U && brightness <= 100U);
}
@ -64,6 +65,8 @@ void CNextion::setIdle()
sendCommand(command);
sendCommand("t1.txt=\"MMDVM IDLE\"");
m_mode = MODE_IDLE;
}
void CNextion::setError(const char* text)
@ -77,6 +80,8 @@ void CNextion::setError(const char* text)
sendCommand(command);
sendCommand("t1.txt=\"ERROR\"");
m_mode = MODE_ERROR;
}
void CNextion::setLockout()
@ -84,13 +89,8 @@ void CNextion::setLockout()
sendCommand("page MMDVM");
sendCommand("t0.txt=\"LOCKOUT\"");
}
void CNextion::setDStar()
{
sendCommand("page DStar");
sendCommand("t0.txt=\"Listening\"");
m_mode = MODE_LOCKOUT;
}
void CNextion::writeDStar(const char* my1, const char* my2, const char* your)
@ -99,12 +99,17 @@ void CNextion::writeDStar(const char* my1, const char* my2, const char* your)
assert(my2 != NULL);
assert(your != NULL);
if (m_mode != MODE_DSTAR)
sendCommand("page DStar");
char text[30U];
::sprintf(text, "t0.txt=\"%.8s/%4.4s\"", my1, my2);
sendCommand(text);
::sprintf(text, "t1.txt=\"%.8s\"", your);
sendCommand(text);
m_mode = MODE_DSTAR;
}
void CNextion::clearDStar()
@ -113,18 +118,19 @@ void CNextion::clearDStar()
sendCommand("t1.txt=\"\"");
}
void CNextion::setDMR()
{
sendCommand("page DMR");
sendCommand("t0.txt=\"1 Listening\"");
sendCommand("t2.txt=\"2 Listening\"");
}
void CNextion::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
{
assert(type != NULL);
if (m_mode != MODE_DMR) {
sendCommand("page DMR");
if (slotNo == 1U)
sendCommand("t2.txt=\"2 Listening\"");
else
sendCommand("t0.txt=\"1 Listening\"");
}
if (slotNo == 1U) {
char text[30U];
@ -142,6 +148,8 @@ void CNextion::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, uns
::sprintf(text, "t3.txt=\"%s%u\"", group ? "TG" : "", dstId);
sendCommand(text);
}
m_mode = MODE_DMR;
}
void CNextion::clearDMR(unsigned int slotNo)
@ -155,24 +163,22 @@ void CNextion::clearDMR(unsigned int slotNo)
}
}
void CNextion::setFusion()
{
sendCommand("page YSF");
sendCommand("t0.txt=\"Listening\"");
}
void CNextion::writeFusion(const char* source, const char* dest)
{
assert(source != NULL);
assert(dest != NULL);
if (m_mode != MODE_YSF)
sendCommand("page YSF");
char text[30U];
::sprintf(text, "t0.txt=\"%.10s\"", source);
sendCommand(text);
::sprintf(text, "t1.txt=\"%.10s\"", dest);
sendCommand(text);
m_mode = MODE_YSF;
}
void CNextion::clearFusion()

View File

@ -20,6 +20,7 @@
#define NEXTION_H
#include "Display.h"
#include "Defines.h"
#include "SerialController.h"
#include <string>
@ -37,15 +38,12 @@ public:
virtual void setError(const char* text);
virtual void setLockout();
virtual void setDStar();
virtual void writeDStar(const char* my1, const char* my2, const char* your);
virtual void clearDStar();
virtual void setDMR();
virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void setFusion();
virtual void writeFusion(const char* source, const char* dest);
virtual void clearFusion();
@ -56,6 +54,7 @@ private:
unsigned int m_dmrid;
CSerialController m_serial;
unsigned int m_brightness;
unsigned char m_mode;
void sendCommand(const char* command);
};

View File

@ -43,10 +43,6 @@ void CNullDisplay::setLockout()
{
}
void CNullDisplay::setDStar()
{
}
void CNullDisplay::writeDStar(const char* my1, const char* my2, const char* your)
{
}
@ -55,10 +51,6 @@ void CNullDisplay::clearDStar()
{
}
void CNullDisplay::setDMR()
{
}
void CNullDisplay::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
{
}
@ -67,10 +59,6 @@ void CNullDisplay::clearDMR(unsigned int slotNo)
{
}
void CNullDisplay::setFusion()
{
}
void CNullDisplay::writeFusion(const char* source, const char* dest)
{
}

View File

@ -36,15 +36,12 @@ public:
virtual void setError(const char* text);
virtual void setLockout();
virtual void setDStar();
virtual void writeDStar(const char* my1, const char* my2, const char* your);
virtual void clearDStar();
virtual void setDMR();
virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void setFusion();
virtual void writeFusion(const char* source, const char* dest);
virtual void clearFusion();

View File

@ -48,7 +48,8 @@ CTFTSerial::CTFTSerial(const char* callsign, unsigned int dmrid, const std::stri
m_callsign(callsign),
m_dmrid(dmrid),
m_serial(port, SERIAL_9600),
m_brightness(brightness)
m_brightness(brightness),
m_mode(MODE_IDLE)
{
assert(brightness >= 0U && brightness <= 100U);
}
@ -96,6 +97,8 @@ void CTFTSerial::setIdle()
gotoPosPixel(45U, 90U);
displayText("IDLE");
m_mode = MODE_IDLE;
}
void CTFTSerial::setError(const char* text)
@ -119,6 +122,8 @@ void CTFTSerial::setError(const char* text)
displayText("ERROR");
setForeground(COLOUR_BLACK);
m_mode = MODE_ERROR;
}
void CTFTSerial::setLockout()
@ -133,20 +138,8 @@ void CTFTSerial::setLockout()
gotoPosPixel(20U, 60U);
displayText("LOCKOUT");
}
void CTFTSerial::setDStar()
{
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw D-Star insignia
displayBitmap(0U, 0U, "DStar_sm.bmp");
gotoPosPixel(30U, 80U);
displayText("Listening");
m_mode = MODE_LOCKOUT;
}
void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your)
@ -155,6 +148,16 @@ void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your)
assert(my2 != NULL);
assert(your != NULL);
if (m_mode != MODE_DSTAR) {
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw D-Star insignia
displayBitmap(0U, 0U, "DStar_sm.bmp");
}
char text[30U];
::sprintf(text, "%.8s/%4.4s", my1, my2);
@ -165,6 +168,8 @@ void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your)
gotoPosPixel(5U, 100U);
displayText(text);
m_mode = MODE_DSTAR;
}
void CTFTSerial::clearDStar()
@ -176,27 +181,28 @@ void CTFTSerial::clearDStar()
displayText(" ");
}
void CTFTSerial::setDMR()
{
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw DMR insignia
displayBitmap(0U, 0U, "DMR_sm.bmp");
gotoPosPixel(5U, 55U);
displayText("1 Listening");
gotoPosPixel(5U, 90U);
displayText("2 Listening");
}
void CTFTSerial::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
{
assert(type != NULL);
if (m_mode != MODE_DMR) {
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw DMR insignia
displayBitmap(0U, 0U, "DMR_sm.bmp");
if (slotNo == 1U) {
gotoPosPixel(5U, 90U);
displayText("2 Listening");
} else {
gotoPosPixel(5U, 55U);
displayText("1 Listening");
}
}
if (slotNo == 1U) {
char text[30U];
@ -218,6 +224,8 @@ void CTFTSerial::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, u
gotoPosPixel(65U, 107U);
displayText(text);
}
m_mode = MODE_DMR;
}
void CTFTSerial::clearDMR(unsigned int slotNo)
@ -237,25 +245,21 @@ void CTFTSerial::clearDMR(unsigned int slotNo)
}
}
void CTFTSerial::setFusion()
{
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw the System Fusion insignia
displayBitmap(0U, 0U, "YSF_sm.bmp");
gotoPosPixel(30U, 80U);
displayText("Listening");
}
void CTFTSerial::writeFusion(const char* source, const char* dest)
{
assert(source != NULL);
assert(dest != NULL);
if (m_mode != MODE_YSF) {
// Clear the screen
clearScreen();
setFontSize(FONT_MEDIUM);
// Draw the System Fusion insignia
displayBitmap(0U, 0U, "YSF_sm.bmp");
}
char text[30U];
::sprintf(text, "%.10s", source);
@ -266,6 +270,8 @@ void CTFTSerial::writeFusion(const char* source, const char* dest)
gotoPosPixel(5U, 100U);
displayText(text);
m_mode = MODE_YSF;
}
void CTFTSerial::clearFusion()

View File

@ -20,6 +20,7 @@
#define TFTSERIAL_H
#include "Display.h"
#include "Defines.h"
#include "SerialController.h"
#include <string>
@ -37,15 +38,12 @@ public:
virtual void setError(const char* text);
virtual void setLockout();
virtual void setDStar();
virtual void writeDStar(const char* my1, const char* my2, const char* your);
virtual void clearDStar();
virtual void setDMR();
virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void setFusion();
virtual void writeFusion(const char* source, const char* dest);
virtual void clearFusion();
@ -56,6 +54,7 @@ private:
unsigned int m_dmrid;
CSerialController m_serial;
unsigned int m_brightness;
unsigned char m_mode;
void clearScreen();
void setBackground(unsigned char colour);