Remove support for the Hobbytronics TFT display.
10
Display.cpp
|
@ -21,7 +21,6 @@
|
|||
#include "SerialController.h"
|
||||
#include "ModemSerialPort.h"
|
||||
#include "NullDisplay.h"
|
||||
#include "TFTSerial.h"
|
||||
#include "TFTSurenoo.h"
|
||||
#include "LCDproc.h"
|
||||
#include "Nextion.h"
|
||||
|
@ -546,7 +545,7 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, IModem* modem)
|
|||
LogInfo("Display Parameters");
|
||||
LogInfo(" Type: %s", type.c_str());
|
||||
|
||||
if (type == "TFT Serial" || type == "TFT Surenoo") {
|
||||
if (type == "TFT Surenoo") {
|
||||
std::string port = conf.getTFTSerialPort();
|
||||
unsigned int brightness = conf.getTFTSerialBrightness();
|
||||
|
||||
|
@ -557,12 +556,9 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, IModem* modem)
|
|||
if (port == "modem")
|
||||
serial = new IModemSerialPort(modem);
|
||||
else
|
||||
serial = new CSerialController(port, (type == "TFT Serial") ? 9600U : 115200U);
|
||||
serial = new CSerialController(port, 115200U);
|
||||
|
||||
if (type == "TFT Surenoo")
|
||||
display = new CTFTSurenoo(conf.getCallsign(), dmrid, serial, brightness, conf.getDuplex());
|
||||
else
|
||||
display = new CTFTSerial(conf.getCallsign(), dmrid, serial, brightness);
|
||||
display = new CTFTSurenoo(conf.getCallsign(), dmrid, serial, brightness, conf.getDuplex());
|
||||
} else if (type == "Nextion") {
|
||||
std::string port = conf.getNextionPort();
|
||||
unsigned int brightness = conf.getNextionBrightness();
|
||||
|
|
|
@ -246,7 +246,6 @@
|
|||
<ClInclude Include="SerialPort.h" />
|
||||
<ClInclude Include="StopWatch.h" />
|
||||
<ClInclude Include="Sync.h" />
|
||||
<ClInclude Include="TFTSerial.h" />
|
||||
<ClInclude Include="TFTSurenoo.h" />
|
||||
<ClInclude Include="Thread.h" />
|
||||
<ClInclude Include="Timer.h" />
|
||||
|
@ -348,7 +347,6 @@
|
|||
<ClCompile Include="M17Utils.cpp" />
|
||||
<ClCompile Include="StopWatch.cpp" />
|
||||
<ClCompile Include="Sync.cpp" />
|
||||
<ClCompile Include="TFTSerial.cpp" />
|
||||
<ClCompile Include="TFTSurenoo.cpp" />
|
||||
<ClCompile Include="Thread.cpp" />
|
||||
<ClCompile Include="Timer.cpp" />
|
||||
|
|
|
@ -80,9 +80,6 @@
|
|||
<ClInclude Include="StopWatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TFTSerial.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Timer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -397,9 +394,6 @@
|
|||
<ClCompile Include="StopWatch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TFTSerial.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Timer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
4
Makefile
|
@ -14,8 +14,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \
|
||||
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \
|
||||
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \
|
||||
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \
|
||||
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o OLED.o P25Audio.o P25Control.o P25Data.o \
|
||||
P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o \
|
||||
RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o \
|
||||
UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ OBJECTS = \
|
|||
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
|
||||
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \
|
||||
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \
|
||||
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||
|
||||
all: MMDVMHost RemoteCommand
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ these are:
|
|||
- Adafruit 16x2 LCD+Keypad Kits (I2C)
|
||||
- Connection via PCF8574 GPIO Extender (I2C)
|
||||
- Nextion TFTs (all sizes, both Basic and Enhanced versions)
|
||||
- TFT display sold by Hobbytronics in UK
|
||||
- OLED 128x64 (SSD1306)
|
||||
- LCDproc
|
||||
|
||||
|
|
630
TFTSerial.cpp
|
@ -1,630 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "TFTSerial.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
const unsigned char ROTATION_PORTRAIT_LEFT = 0U;
|
||||
const unsigned char ROTATION_LANDSCAPE_UD = 1U;
|
||||
const unsigned char ROTATION_PORTRAIT_RIGHT = 2U;
|
||||
const unsigned char ROTATION_LANDSCAPE = 3U;
|
||||
|
||||
const unsigned char COLOUR_BLACK = 0U;
|
||||
const unsigned char COLOUR_BLUE = 1U;
|
||||
const unsigned char COLOUR_RED = 2U;
|
||||
const unsigned char COLOUR_GREEN = 3U;
|
||||
const unsigned char COLOUR_CYAN = 4U;
|
||||
const unsigned char COLOUR_MAGENTA = 5U;
|
||||
const unsigned char COLOUR_YELLOW = 6U;
|
||||
const unsigned char COLOUR_WHITE = 7U;
|
||||
|
||||
const unsigned char FONT_SMALL = 1U;
|
||||
const unsigned char FONT_MEDIUM = 2U;
|
||||
const unsigned char FONT_LARGE = 3U;
|
||||
|
||||
// x = 0 to 159, y = 0 to 127 - Landscape
|
||||
// x = 0 to 127, y = 0 to 159 - Portrait
|
||||
|
||||
CTFTSerial::CTFTSerial(const std::string& callsign, unsigned int dmrid, ISerialPort* serial, unsigned int brightness) :
|
||||
CDisplay(),
|
||||
m_callsign(callsign),
|
||||
m_dmrid(dmrid),
|
||||
m_serial(serial),
|
||||
m_brightness(brightness),
|
||||
m_mode(MODE_IDLE)
|
||||
{
|
||||
assert(serial != NULL);
|
||||
assert(brightness >= 0U && brightness <= 100U);
|
||||
}
|
||||
|
||||
CTFTSerial::~CTFTSerial()
|
||||
{
|
||||
}
|
||||
|
||||
bool CTFTSerial::open()
|
||||
{
|
||||
bool ret = m_serial->open();
|
||||
if (!ret) {
|
||||
LogError("Cannot open the port for the TFT Serial");
|
||||
delete m_serial;
|
||||
return false;
|
||||
}
|
||||
|
||||
setRotation(ROTATION_LANDSCAPE);
|
||||
|
||||
setBrightness(m_brightness);
|
||||
|
||||
setBackground(COLOUR_WHITE);
|
||||
|
||||
setForeground(COLOUR_BLACK);
|
||||
|
||||
setIdle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CTFTSerial::setIdleInt()
|
||||
{
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_LARGE);
|
||||
|
||||
// Draw MMDVM logo
|
||||
displayBitmap(0U, 0U, "MMDVM_sm.bmp");
|
||||
|
||||
char text[30];
|
||||
::sprintf(text, "%-6s / %u", m_callsign.c_str(), m_dmrid);
|
||||
|
||||
gotoPosPixel(18U, 55U);
|
||||
displayText(text);
|
||||
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("IDLE");
|
||||
|
||||
m_mode = MODE_IDLE;
|
||||
}
|
||||
|
||||
void CTFTSerial::setErrorInt(const char* text)
|
||||
{
|
||||
assert(text != NULL);
|
||||
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_MEDIUM);
|
||||
|
||||
// Draw MMDVM logo
|
||||
displayBitmap(0U, 0U, "MMDVM_sm.bmp");
|
||||
|
||||
setForeground(COLOUR_RED);
|
||||
|
||||
gotoPosPixel(18U, 55U);
|
||||
displayText(text);
|
||||
|
||||
gotoPosPixel(18U, 90U);
|
||||
displayText("ERROR");
|
||||
|
||||
setForeground(COLOUR_BLACK);
|
||||
|
||||
m_mode = MODE_ERROR;
|
||||
}
|
||||
|
||||
void CTFTSerial::setLockoutInt()
|
||||
{
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_LARGE);
|
||||
|
||||
// Draw MMDVM logo
|
||||
displayBitmap(0U, 0U, "MMDVM_sm.bmp");
|
||||
|
||||
gotoPosPixel(20U, 60U);
|
||||
displayText("LOCKOUT");
|
||||
|
||||
m_mode = MODE_LOCKOUT;
|
||||
}
|
||||
|
||||
void CTFTSerial::setQuitInt()
|
||||
{
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_LARGE);
|
||||
|
||||
// Draw MMDVM logo
|
||||
displayBitmap(0U, 0U, "MMDVM_sm.bmp");
|
||||
|
||||
gotoPosPixel(20U, 60U);
|
||||
displayText("STOPPED");
|
||||
|
||||
m_mode = MODE_QUIT;
|
||||
}
|
||||
|
||||
void CTFTSerial::setFMInt()
|
||||
{
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_LARGE);
|
||||
|
||||
// Draw MMDVM logo
|
||||
displayBitmap(0U, 0U, "MMDVM_sm.bmp");
|
||||
|
||||
gotoPosPixel(20U, 60U);
|
||||
displayText("FM");
|
||||
|
||||
m_mode = MODE_FM;
|
||||
}
|
||||
|
||||
void CTFTSerial::writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector)
|
||||
{
|
||||
assert(my1 != NULL);
|
||||
assert(my2 != NULL);
|
||||
assert(your != NULL);
|
||||
assert(type != NULL);
|
||||
assert(reflector != 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, "%s %.8s/%4.4s", type, my1, my2);
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, "%.8s", your);
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
if (::strcmp(reflector, " ") != 0) {
|
||||
::sprintf(text, "via %.8s", reflector);
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(text);
|
||||
} else {
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
m_mode = MODE_DSTAR;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearDStarInt()
|
||||
{
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(" Listening ");
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(" ");
|
||||
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, 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];
|
||||
|
||||
::sprintf(text, "1 %s %s", type, src.c_str());
|
||||
gotoPosPixel(5U, 55U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, "%s%s", group ? "TG" : "", dst.c_str());
|
||||
gotoPosPixel(65U, 72U);
|
||||
displayText(text);
|
||||
} else {
|
||||
char text[30U];
|
||||
|
||||
::sprintf(text, "2 %s %s", type, src.c_str());
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, "%s%s", group ? "TG" : "", dst.c_str());
|
||||
gotoPosPixel(65U, 107U);
|
||||
displayText(text);
|
||||
}
|
||||
|
||||
m_mode = MODE_DMR;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearDMRInt(unsigned int slotNo)
|
||||
{
|
||||
if (slotNo == 1U) {
|
||||
gotoPosPixel(5U, 55U);
|
||||
displayText("1 Listening ");
|
||||
|
||||
gotoPosPixel(65U, 72U);
|
||||
displayText(" ");
|
||||
} else {
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText("2 Listening ");
|
||||
|
||||
gotoPosPixel(65U, 107U);
|
||||
displayText(" ");
|
||||
}
|
||||
}
|
||||
|
||||
void CTFTSerial::writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin)
|
||||
{
|
||||
assert(source != NULL);
|
||||
assert(dest != NULL);
|
||||
assert(type != NULL);
|
||||
assert(origin != 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, "%s %.10s", type, source);
|
||||
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, " DG-ID %u", dgid);
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
if (::strcmp(origin, " ") != 0) {
|
||||
::sprintf(text, "at %.10s", origin);
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(text);
|
||||
} else {
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
m_mode = MODE_YSF;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearFusionInt()
|
||||
{
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(" Listening ");
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(" ");
|
||||
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeP25Int(const char* source, bool group, unsigned int dest, const char* type)
|
||||
{
|
||||
assert(source != NULL);
|
||||
assert(type != NULL);
|
||||
|
||||
if (m_mode != MODE_P25) {
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_MEDIUM);
|
||||
|
||||
// Draw the P25 insignia
|
||||
displayBitmap(0U, 0U, "P25_sm.bmp");
|
||||
}
|
||||
|
||||
char text[30U];
|
||||
::sprintf(text, "%s %.10s", type, source);
|
||||
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, " %s%u", group ? "TG" : "", dest);
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
m_mode = MODE_P25;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearP25Int()
|
||||
{
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(" Listening ");
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(" ");
|
||||
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type)
|
||||
{
|
||||
assert(source != NULL);
|
||||
assert(type != NULL);
|
||||
|
||||
if (m_mode != MODE_NXDN) {
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_MEDIUM);
|
||||
|
||||
// Draw the NXDN insignia
|
||||
displayBitmap(0U, 0U, "NXDN_sm.bmp");
|
||||
}
|
||||
|
||||
char text[30U];
|
||||
::sprintf(text, "%s %.10s", type, source);
|
||||
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, " %s%u", group ? "TG" : "", dest);
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
m_mode = MODE_NXDN;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearNXDNInt()
|
||||
{
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(" Listening ");
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(" ");
|
||||
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeM17Int(const char* source, const char* dest, const char* type)
|
||||
{
|
||||
assert(source != NULL);
|
||||
assert(dest != NULL);
|
||||
assert(type != NULL);
|
||||
|
||||
if (m_mode != MODE_M17) {
|
||||
// Clear the screen
|
||||
clearScreen();
|
||||
|
||||
setFontSize(FONT_MEDIUM);
|
||||
|
||||
// Draw the M17 insignia
|
||||
displayBitmap(0U, 0U, "M17_sm.bmp");
|
||||
}
|
||||
|
||||
char text[30U];
|
||||
::sprintf(text, "%s %.10s", type, source);
|
||||
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(text);
|
||||
|
||||
::sprintf(text, " %s", dest);
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(text);
|
||||
|
||||
m_mode = MODE_M17;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearM17Int()
|
||||
{
|
||||
gotoPosPixel(5U, 70U);
|
||||
displayText(" Listening ");
|
||||
|
||||
gotoPosPixel(5U, 90U);
|
||||
displayText(" ");
|
||||
|
||||
gotoPosPixel(5U, 110U);
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writePOCSAGInt(uint32_t ric, const std::string& message)
|
||||
{
|
||||
gotoPosPixel(15U, 90U);
|
||||
displayText("POCSAG TX");
|
||||
|
||||
m_mode = MODE_CW;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearPOCSAGInt()
|
||||
{
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("IDLE");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeCWInt()
|
||||
{
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("CW TX");
|
||||
|
||||
m_mode = MODE_CW;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearCWInt()
|
||||
{
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("IDLE");
|
||||
}
|
||||
|
||||
void CTFTSerial::close()
|
||||
{
|
||||
m_serial->close();
|
||||
delete m_serial;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearScreen()
|
||||
{
|
||||
m_serial->write((unsigned char*)"\x1B\x00\xFF", 3U);
|
||||
}
|
||||
|
||||
void CTFTSerial::setForeground(unsigned char colour)
|
||||
{
|
||||
assert(colour >= 0U && colour <= 7U);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x01", 2U);
|
||||
m_serial->write(&colour, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::setBackground(unsigned char colour)
|
||||
{
|
||||
assert(colour >= 0U && colour <= 7U);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x02", 2U);
|
||||
m_serial->write(&colour, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::setRotation(unsigned char rotation)
|
||||
{
|
||||
assert(rotation >= 0U && rotation <= 3U);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x03", 2U);
|
||||
m_serial->write(&rotation, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::setFontSize(unsigned char size)
|
||||
{
|
||||
assert(size >= 1U && size <= 3U);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x04", 2U);
|
||||
m_serial->write(&size, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::gotoBegOfLine()
|
||||
{
|
||||
m_serial->write((unsigned char*)"\x1B\x05\xFF", 3U);
|
||||
}
|
||||
|
||||
void CTFTSerial::gotoPosText(unsigned char x, unsigned char y)
|
||||
{
|
||||
m_serial->write((unsigned char*)"\x1B\x06", 2U);
|
||||
m_serial->write(&x, 1U);
|
||||
m_serial->write(&y, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::gotoPosPixel(unsigned char x, unsigned char y)
|
||||
{
|
||||
m_serial->write((unsigned char*)"\x1B\x07", 2U);
|
||||
m_serial->write(&x, 1U);
|
||||
m_serial->write(&y, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::drawLine(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2)
|
||||
{
|
||||
m_serial->write((unsigned char*)"\x1B\x08", 2U);
|
||||
m_serial->write(&x1, 1U);
|
||||
m_serial->write(&y1, 1U);
|
||||
m_serial->write(&x2, 1U);
|
||||
m_serial->write(&y2, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::drawBox(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, bool filled)
|
||||
{
|
||||
if (filled)
|
||||
m_serial->write((unsigned char*)"\x1B\x0A", 2U);
|
||||
else
|
||||
m_serial->write((unsigned char*)"\x1B\x09", 2U);
|
||||
|
||||
m_serial->write(&x1, 1U);
|
||||
m_serial->write(&y1, 1U);
|
||||
m_serial->write(&x2, 1U);
|
||||
m_serial->write(&y2, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::drawCircle(unsigned char x, unsigned char y, unsigned char radius, bool filled)
|
||||
{
|
||||
if (filled)
|
||||
m_serial->write((unsigned char*)"\x1B\x0C", 2U);
|
||||
else
|
||||
m_serial->write((unsigned char*)"\x1B\x0B", 2U);
|
||||
|
||||
m_serial->write(&x, 1U);
|
||||
m_serial->write(&y, 1U);
|
||||
m_serial->write(&radius, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::displayBitmap(unsigned char x, unsigned char y, const char* filename)
|
||||
{
|
||||
assert(filename != NULL);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x0D", 2U);
|
||||
m_serial->write(&x, 1U);
|
||||
m_serial->write(&y, 1U);
|
||||
m_serial->write((unsigned char*)filename, (unsigned int)::strlen(filename));
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::setBrightness(unsigned char brightness)
|
||||
{
|
||||
assert(brightness >= 0U && brightness <= 100U);
|
||||
|
||||
m_serial->write((unsigned char*)"\x1B\x0E", 2U);
|
||||
m_serial->write(&brightness, 1U);
|
||||
m_serial->write((unsigned char*)"\xFF", 1U);
|
||||
}
|
||||
|
||||
void CTFTSerial::displayText(const char* text)
|
||||
{
|
||||
assert(text != NULL);
|
||||
|
||||
m_serial->write((unsigned char*)text, (unsigned int)::strlen(text));
|
||||
}
|
92
TFTSerial.h
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(TFTSERIAL_H)
|
||||
#define TFTSERIAL_H
|
||||
|
||||
#include "Display.h"
|
||||
#include "Defines.h"
|
||||
#include "SerialPort.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class CTFTSerial : public CDisplay
|
||||
{
|
||||
public:
|
||||
CTFTSerial(const std::string& callsign, unsigned int dmrid, ISerialPort* serial, unsigned int brightness);
|
||||
virtual ~CTFTSerial();
|
||||
|
||||
virtual bool open();
|
||||
|
||||
virtual void close();
|
||||
|
||||
protected:
|
||||
virtual void setIdleInt();
|
||||
virtual void setErrorInt(const char* text);
|
||||
virtual void setLockoutInt();
|
||||
virtual void setQuitInt();
|
||||
virtual void setFMInt();
|
||||
|
||||
virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
|
||||
virtual void clearDStarInt();
|
||||
|
||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||
virtual void clearDMRInt(unsigned int slotNo);
|
||||
|
||||
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
||||
virtual void clearFusionInt();
|
||||
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearNXDNInt();
|
||||
|
||||
virtual void writeM17Int(const char* source, const char* dest, const char* type);
|
||||
virtual void clearM17Int();
|
||||
|
||||
virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
|
||||
virtual void clearPOCSAGInt();
|
||||
|
||||
virtual void writeCWInt();
|
||||
virtual void clearCWInt();
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
unsigned int m_dmrid;
|
||||
ISerialPort* m_serial;
|
||||
unsigned int m_brightness;
|
||||
unsigned char m_mode;
|
||||
|
||||
void clearScreen();
|
||||
void setBackground(unsigned char colour);
|
||||
void setForeground(unsigned char colour);
|
||||
void setRotation(unsigned char rotation);
|
||||
void setFontSize(unsigned char size);
|
||||
void gotoBegOfLine();
|
||||
void gotoPosText(unsigned char x, unsigned char y);
|
||||
void gotoPosPixel(unsigned char x, unsigned char y);
|
||||
void drawLine(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2);
|
||||
void drawBox(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, bool filled);
|
||||
void drawCircle(unsigned char x, unsigned char y, unsigned char radius, bool filled);
|
||||
void displayBitmap(unsigned char x, unsigned char y, const char* filename);
|
||||
void setBrightness(unsigned char brightness);
|
||||
void displayText(const char* text);
|
||||
};
|
||||
|
||||
#endif
|
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |