2016-01-14 18:45:04 +00:00
|
|
|
/*
|
2020-04-11 19:42:05 +00:00
|
|
|
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
2016-01-14 18:45:04 +00:00
|
|
|
*
|
|
|
|
* 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 "Display.h"
|
2016-05-09 17:14:27 +00:00
|
|
|
#include "Defines.h"
|
2018-07-31 06:54:27 +00:00
|
|
|
#include "SerialController.h"
|
|
|
|
#include "ModemSerialPort.h"
|
|
|
|
#include "NullDisplay.h"
|
2019-12-01 07:33:19 +00:00
|
|
|
#include "TFTSurenoo.h"
|
2018-07-31 06:54:27 +00:00
|
|
|
#include "LCDproc.h"
|
|
|
|
#include "Nextion.h"
|
2019-05-10 18:44:01 +00:00
|
|
|
#include "CASTInfo.h"
|
2018-07-31 06:54:27 +00:00
|
|
|
#include "Conf.h"
|
|
|
|
#include "Modem.h"
|
2020-11-15 18:12:38 +00:00
|
|
|
#include "OLED.h"
|
2017-11-13 20:48:47 +00:00
|
|
|
#include "Log.h"
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2018-07-31 06:54:27 +00:00
|
|
|
#if defined(HD44780)
|
|
|
|
#include "HD44780.h"
|
|
|
|
#endif
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cassert>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
CDisplay::CDisplay() :
|
2017-11-13 20:48:47 +00:00
|
|
|
m_timer1(3000U, 3U),
|
|
|
|
m_timer2(3000U, 3U),
|
2016-05-09 17:14:27 +00:00
|
|
|
m_mode1(MODE_IDLE),
|
|
|
|
m_mode2(MODE_IDLE)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CDisplay::~CDisplay()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::setIdle()
|
|
|
|
{
|
|
|
|
m_timer1.stop();
|
|
|
|
m_timer2.stop();
|
|
|
|
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
|
|
|
|
setIdleInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::setLockout()
|
|
|
|
{
|
|
|
|
m_timer1.stop();
|
|
|
|
m_timer2.stop();
|
|
|
|
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
|
|
|
|
setLockoutInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::setError(const char* text)
|
|
|
|
{
|
|
|
|
assert(text != NULL);
|
|
|
|
|
|
|
|
m_timer1.stop();
|
|
|
|
m_timer2.stop();
|
|
|
|
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
|
|
|
|
setErrorInt(text);
|
|
|
|
}
|
|
|
|
|
2018-08-15 16:17:42 +00:00
|
|
|
void CDisplay::setQuit()
|
|
|
|
{
|
|
|
|
m_timer1.stop();
|
|
|
|
m_timer2.stop();
|
|
|
|
|
|
|
|
m_mode1 = MODE_QUIT;
|
|
|
|
m_mode2 = MODE_QUIT;
|
|
|
|
|
|
|
|
setQuitInt();
|
|
|
|
}
|
|
|
|
|
2020-04-11 19:42:05 +00:00
|
|
|
void CDisplay::setFM()
|
|
|
|
{
|
|
|
|
m_timer1.stop();
|
|
|
|
m_timer2.stop();
|
|
|
|
|
|
|
|
m_mode1 = MODE_FM;
|
|
|
|
m_mode2 = MODE_FM;
|
|
|
|
|
|
|
|
setFMInt();
|
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CDisplay::writeDStar(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);
|
|
|
|
|
|
|
|
m_timer1.start();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
|
|
|
|
writeDStarInt(my1, my2, your, type, reflector);
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeDStarRSSI(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeDStarRSSIInt(rssi);
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeDStarBER(float ber)
|
|
|
|
{
|
2017-02-13 08:54:25 +00:00
|
|
|
writeDStarBERInt(ber);
|
2017-02-12 18:37:00 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CDisplay::clearDStar()
|
2016-01-14 18:45:04 +00:00
|
|
|
{
|
2016-05-09 17:14:27 +00:00
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearDStarInt();
|
|
|
|
m_timer1.stop();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_DSTAR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
|
|
|
{
|
|
|
|
assert(type != NULL);
|
|
|
|
|
2016-05-10 12:28:00 +00:00
|
|
|
if (slotNo == 1U) {
|
2016-05-09 17:14:27 +00:00
|
|
|
m_timer1.start();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
2016-05-09 17:14:27 +00:00
|
|
|
m_timer2.start();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
}
|
2016-05-09 17:14:27 +00:00
|
|
|
writeDMRInt(slotNo, src, group, dst, type);
|
|
|
|
}
|
|
|
|
|
2020-03-07 23:06:27 +00:00
|
|
|
void CDisplay::writeDMR(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
|
|
|
{
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
|
|
|
m_timer2.start();
|
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
}
|
|
|
|
|
2020-03-09 20:46:24 +00:00
|
|
|
if (int err = writeDMRIntEx(slotNo, src, group, dst, type)) {
|
|
|
|
std::string src_str = src.get(keyCALLSIGN);
|
|
|
|
if (err < 0 && !src.get(keyFIRST_NAME).empty()) {
|
|
|
|
// emulate the result of old CDMRLookup::findWithName()
|
|
|
|
// (it returned callsign and firstname)
|
2020-03-07 23:06:27 +00:00
|
|
|
src_str += " " + src.get(keyFIRST_NAME);
|
2020-03-09 20:46:24 +00:00
|
|
|
}
|
2020-03-07 23:06:27 +00:00
|
|
|
writeDMRInt(slotNo, src_str, group, dst, type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeDMRRSSI(unsigned int slotNo, unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeDMRRSSIInt(slotNo, rssi);
|
|
|
|
}
|
|
|
|
|
2017-11-13 20:48:47 +00:00
|
|
|
void CDisplay::writeDMRTA(unsigned int slotNo, unsigned char* talkerAlias, const char* type)
|
|
|
|
{
|
2018-12-08 14:09:59 +00:00
|
|
|
if (strcmp(type," ")==0) { writeDMRTAInt(slotNo, (unsigned char*)"", type); return; }
|
|
|
|
if (strlen((char*)talkerAlias)>=4U) writeDMRTAInt(slotNo, (unsigned char*)talkerAlias, type);
|
2017-11-13 20:48:47 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeDMRBER(unsigned int slotNo, float ber)
|
|
|
|
{
|
2017-02-13 08:54:25 +00:00
|
|
|
writeDMRBERInt(slotNo, ber);
|
2017-02-12 18:37:00 +00:00
|
|
|
}
|
2020-04-11 19:42:05 +00:00
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CDisplay::clearDMR(unsigned int slotNo)
|
|
|
|
{
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearDMRInt(slotNo);
|
|
|
|
m_timer1.stop();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_DMR;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (m_timer2.hasExpired()) {
|
|
|
|
clearDMRInt(slotNo);
|
|
|
|
m_timer2.stop();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode2 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
} else {
|
|
|
|
m_mode2 = MODE_DMR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-09 14:09:08 +00:00
|
|
|
void CDisplay::writeFusion(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin)
|
2016-05-09 17:14:27 +00:00
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(dest != NULL);
|
2016-05-16 20:57:32 +00:00
|
|
|
assert(type != NULL);
|
2016-05-19 18:08:48 +00:00
|
|
|
assert(origin != NULL);
|
2016-05-09 17:14:27 +00:00
|
|
|
|
|
|
|
m_timer1.start();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
|
2020-08-09 14:09:08 +00:00
|
|
|
writeFusionInt(source, dest, dgid, type, origin);
|
2016-05-09 17:14:27 +00:00
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeFusionRSSI(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeFusionRSSIInt(rssi);
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeFusionBER(float ber)
|
|
|
|
{
|
2017-02-13 08:54:25 +00:00
|
|
|
writeFusionBERInt(ber);
|
2017-02-12 18:37:00 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CDisplay::clearFusion()
|
|
|
|
{
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearFusionInt();
|
|
|
|
m_timer1.stop();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
2016-05-09 17:14:27 +00:00
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_YSF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-12 19:23:50 +00:00
|
|
|
void CDisplay::writeP25(const char* source, bool group, unsigned int dest, const char* type)
|
2016-09-12 17:12:32 +00:00
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
|
|
|
|
writeP25Int(source, group, dest, type);
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeP25RSSI(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeP25RSSIInt(rssi);
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeP25BER(float ber)
|
|
|
|
{
|
2017-02-13 08:54:25 +00:00
|
|
|
writeP25BERInt(ber);
|
2017-02-12 18:37:00 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 17:12:32 +00:00
|
|
|
void CDisplay::clearP25()
|
|
|
|
{
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearP25Int();
|
|
|
|
m_timer1.stop();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_P25;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 19:04:00 +00:00
|
|
|
void CDisplay::writeNXDN(const char* source, bool group, unsigned int dest, const char* type)
|
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
|
|
|
|
writeNXDNInt(source, group, dest, type);
|
|
|
|
}
|
|
|
|
|
2020-03-09 20:46:24 +00:00
|
|
|
void CDisplay::writeNXDN(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
|
|
|
{
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
|
|
|
|
if (writeNXDNIntEx(source, group, dest, type))
|
|
|
|
writeNXDNInt(source.get(keyCALLSIGN).c_str(), group, dest, type);
|
|
|
|
}
|
|
|
|
|
2018-01-17 19:04:00 +00:00
|
|
|
void CDisplay::writeNXDNRSSI(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeNXDNRSSIInt(rssi);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeNXDNBER(float ber)
|
|
|
|
{
|
|
|
|
writeNXDNBERInt(ber);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::clearNXDN()
|
|
|
|
{
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearNXDNInt();
|
|
|
|
m_timer1.stop();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_NXDN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-15 13:32:56 +00:00
|
|
|
void CDisplay::writeM17(const char* source, const char* dest, const char* type)
|
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(dest != NULL);
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
|
|
|
|
writeM17Int(source, dest, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeM17RSSI(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (rssi != 0U)
|
|
|
|
writeM17RSSIInt(rssi);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeM17BER(float ber)
|
|
|
|
{
|
|
|
|
writeM17BERInt(ber);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::clearM17()
|
|
|
|
{
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearM17Int();
|
|
|
|
m_timer1.stop();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_M17;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-11 20:30:49 +00:00
|
|
|
void CDisplay::writePOCSAG(uint32_t ric, const std::string& message)
|
|
|
|
{
|
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_POCSAG;
|
|
|
|
|
|
|
|
writePOCSAGInt(ric, message);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::clearPOCSAG()
|
|
|
|
{
|
|
|
|
if (m_timer1.hasExpired()) {
|
|
|
|
clearPOCSAGInt();
|
|
|
|
m_timer1.stop();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
} else {
|
|
|
|
m_mode1 = MODE_POCSAG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-15 09:50:35 +00:00
|
|
|
void CDisplay::writeCW()
|
|
|
|
{
|
2016-09-15 13:17:51 +00:00
|
|
|
m_timer1.start();
|
|
|
|
m_mode1 = MODE_CW;
|
|
|
|
|
2016-09-15 09:50:35 +00:00
|
|
|
writeCWInt();
|
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CDisplay::clock(unsigned int ms)
|
|
|
|
{
|
|
|
|
m_timer1.clock(ms);
|
|
|
|
if (m_timer1.isRunning() && m_timer1.hasExpired()) {
|
|
|
|
switch (m_mode1) {
|
|
|
|
case MODE_DSTAR:
|
|
|
|
clearDStarInt();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
2016-05-09 17:14:27 +00:00
|
|
|
break;
|
|
|
|
case MODE_DMR:
|
|
|
|
clearDMRInt(1U);
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
2016-05-09 17:14:27 +00:00
|
|
|
break;
|
|
|
|
case MODE_YSF:
|
|
|
|
clearFusionInt();
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2016-09-12 17:12:32 +00:00
|
|
|
case MODE_P25:
|
|
|
|
clearP25Int();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2018-01-17 19:04:00 +00:00
|
|
|
case MODE_NXDN:
|
|
|
|
clearNXDNInt();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2020-10-15 13:32:56 +00:00
|
|
|
case MODE_M17:
|
|
|
|
clearM17Int();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2018-06-11 20:30:49 +00:00
|
|
|
case MODE_POCSAG:
|
|
|
|
clearPOCSAGInt();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2016-09-15 13:17:51 +00:00
|
|
|
case MODE_CW:
|
|
|
|
clearCWInt();
|
|
|
|
m_mode1 = MODE_IDLE;
|
|
|
|
m_timer1.stop();
|
|
|
|
break;
|
2016-05-10 12:28:00 +00:00
|
|
|
default:
|
2016-05-09 17:14:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-10 12:28:00 +00:00
|
|
|
// Timer/mode 2 are only used for DMR
|
2016-05-09 17:14:27 +00:00
|
|
|
m_timer2.clock(ms);
|
|
|
|
if (m_timer2.isRunning() && m_timer2.hasExpired()) {
|
2016-05-10 12:28:00 +00:00
|
|
|
if (m_mode2 == MODE_DMR) {
|
2016-05-09 17:14:27 +00:00
|
|
|
clearDMRInt(2U);
|
2016-05-10 12:28:00 +00:00
|
|
|
m_mode2 = MODE_IDLE;
|
|
|
|
m_timer2.stop();
|
2016-05-09 17:14:27 +00:00
|
|
|
}
|
|
|
|
}
|
2016-05-21 11:28:09 +00:00
|
|
|
|
|
|
|
clockInt(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::clockInt(unsigned int ms)
|
|
|
|
{
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
2017-01-05 19:44:52 +00:00
|
|
|
|
|
|
|
void CDisplay::writeDStarRSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeDStarBERInt(float ber)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-03-07 23:06:27 +00:00
|
|
|
int CDisplay::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
|
|
|
{
|
2020-03-09 11:48:14 +00:00
|
|
|
/*
|
|
|
|
* return value:
|
|
|
|
* < 0 error condition (i.e. not supported)
|
2020-03-09 20:46:24 +00:00
|
|
|
* -> call writeXXXXInt() to display
|
|
|
|
* = 0 no error, writeXXXXIntEx() displayed whole status
|
|
|
|
* = 1 no error, writeXXXXIntEx() displayed partial status
|
|
|
|
* -> call writeXXXXInt() to display remain part
|
|
|
|
* > 1 reserved for future use
|
2020-03-09 11:48:14 +00:00
|
|
|
*/
|
2020-03-07 23:06:27 +00:00
|
|
|
return -1; // not supported
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-11-13 20:48:47 +00:00
|
|
|
void CDisplay::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, const char* type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeDMRBERInt(unsigned int slotNo, float ber)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeFusionRSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-02-12 18:37:00 +00:00
|
|
|
void CDisplay::writeFusionBERInt(float ber)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-05 19:44:52 +00:00
|
|
|
void CDisplay::writeP25RSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
2017-02-12 18:37:00 +00:00
|
|
|
|
|
|
|
void CDisplay::writeP25BERInt(float ber)
|
|
|
|
{
|
|
|
|
}
|
2018-01-17 19:04:00 +00:00
|
|
|
|
|
|
|
void CDisplay::writeNXDNRSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeNXDNBERInt(float ber)
|
|
|
|
{
|
|
|
|
}
|
2020-03-09 20:46:24 +00:00
|
|
|
|
2020-10-15 13:32:56 +00:00
|
|
|
void CDisplay::writeM17RSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDisplay::writeM17BERInt(float ber)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-03-09 20:46:24 +00:00
|
|
|
int CDisplay::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
|
|
|
{
|
|
|
|
/* return value definition is same as writeDMRIntEx() */
|
|
|
|
return -1; // not supported
|
|
|
|
}
|
|
|
|
|
2018-09-05 20:12:12 +00:00
|
|
|
|
2018-07-31 03:36:37 +00:00
|
|
|
/* Factory method extracted from MMDVMHost.cpp - BG5HHP */
|
2020-11-10 09:58:10 +00:00
|
|
|
CDisplay* CDisplay::createDisplay(const CConf& conf, IModem* modem)
|
2018-07-31 06:54:27 +00:00
|
|
|
{
|
2020-11-10 09:58:10 +00:00
|
|
|
CDisplay *display = NULL;
|
2018-07-31 03:36:37 +00:00
|
|
|
|
2020-11-10 09:58:10 +00:00
|
|
|
std::string type = conf.getDisplay();
|
2018-07-31 03:36:37 +00:00
|
|
|
unsigned int dmrid = conf.getDMRId();
|
|
|
|
|
|
|
|
LogInfo("Display Parameters");
|
|
|
|
LogInfo(" Type: %s", type.c_str());
|
|
|
|
|
2020-11-10 10:08:59 +00:00
|
|
|
if (type == "TFT Surenoo") {
|
2018-07-31 03:36:37 +00:00
|
|
|
std::string port = conf.getTFTSerialPort();
|
|
|
|
unsigned int brightness = conf.getTFTSerialBrightness();
|
|
|
|
|
|
|
|
LogInfo(" Port: %s", port.c_str());
|
|
|
|
LogInfo(" Brightness: %u", brightness);
|
|
|
|
|
|
|
|
ISerialPort* serial = NULL;
|
|
|
|
if (port == "modem")
|
2020-06-30 11:35:03 +00:00
|
|
|
serial = new IModemSerialPort(modem);
|
2018-07-31 03:36:37 +00:00
|
|
|
else
|
2020-11-10 10:08:59 +00:00
|
|
|
serial = new CSerialController(port, 115200U);
|
2018-07-31 03:36:37 +00:00
|
|
|
|
2020-11-10 10:08:59 +00:00
|
|
|
display = new CTFTSurenoo(conf.getCallsign(), dmrid, serial, brightness, conf.getDuplex());
|
2018-07-31 03:36:37 +00:00
|
|
|
} else if (type == "Nextion") {
|
|
|
|
std::string port = conf.getNextionPort();
|
|
|
|
unsigned int brightness = conf.getNextionBrightness();
|
|
|
|
bool displayClock = conf.getNextionDisplayClock();
|
|
|
|
bool utc = conf.getNextionUTC();
|
|
|
|
unsigned int idleBrightness = conf.getNextionIdleBrightness();
|
|
|
|
unsigned int screenLayout = conf.getNextionScreenLayout();
|
2018-09-05 20:12:12 +00:00
|
|
|
unsigned int txFrequency = conf.getTXFrequency();
|
|
|
|
unsigned int rxFrequency = conf.getRXFrequency();
|
|
|
|
bool displayTempInF = conf.getNextionTempInFahrenheit();
|
2018-07-31 03:36:37 +00:00
|
|
|
|
|
|
|
LogInfo(" Port: %s", port.c_str());
|
|
|
|
LogInfo(" Brightness: %u", brightness);
|
|
|
|
LogInfo(" Clock Display: %s", displayClock ? "yes" : "no");
|
|
|
|
if (displayClock)
|
|
|
|
LogInfo(" Display UTC: %s", utc ? "yes" : "no");
|
|
|
|
LogInfo(" Idle Brightness: %u", idleBrightness);
|
2018-09-05 20:12:12 +00:00
|
|
|
LogInfo(" Temperature in Fahrenheit: %s ", displayTempInF ? "yes" : "no");
|
|
|
|
|
2018-07-31 03:36:37 +00:00
|
|
|
switch (screenLayout) {
|
|
|
|
case 0U:
|
|
|
|
LogInfo(" Screen Layout: G4KLX (Default)");
|
|
|
|
break;
|
|
|
|
case 2U:
|
|
|
|
LogInfo(" Screen Layout: ON7LDS");
|
|
|
|
break;
|
|
|
|
case 3U:
|
|
|
|
LogInfo(" Screen Layout: DIY by ON7LDS");
|
|
|
|
break;
|
|
|
|
case 4U:
|
|
|
|
LogInfo(" Screen Layout: DIY by ON7LDS (High speed)");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LogInfo(" Screen Layout: %u (Unknown)", screenLayout);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (port == "modem") {
|
2020-06-30 11:35:03 +00:00
|
|
|
ISerialPort* serial = new IModemSerialPort(modem);
|
2020-08-27 09:13:02 +00:00
|
|
|
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF);
|
2018-07-31 03:36:37 +00:00
|
|
|
} else {
|
2020-05-23 12:03:55 +00:00
|
|
|
unsigned int baudrate = 9600U;
|
|
|
|
if (screenLayout == 4U)
|
|
|
|
baudrate = 115200U;
|
2018-09-05 20:12:12 +00:00
|
|
|
|
2020-05-23 12:03:55 +00:00
|
|
|
LogInfo(" Display baudrate: %u ", baudrate);
|
2018-07-31 03:36:37 +00:00
|
|
|
ISerialPort* serial = new CSerialController(port, baudrate);
|
2020-08-27 09:13:02 +00:00
|
|
|
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF);
|
2018-07-31 03:36:37 +00:00
|
|
|
}
|
|
|
|
} else if (type == "LCDproc") {
|
|
|
|
std::string address = conf.getLCDprocAddress();
|
|
|
|
unsigned int port = conf.getLCDprocPort();
|
|
|
|
unsigned int localPort = conf.getLCDprocLocalPort();
|
|
|
|
bool displayClock = conf.getLCDprocDisplayClock();
|
|
|
|
bool utc = conf.getLCDprocUTC();
|
|
|
|
bool dimOnIdle = conf.getLCDprocDimOnIdle();
|
|
|
|
|
|
|
|
LogInfo(" Address: %s", address.c_str());
|
|
|
|
LogInfo(" Port: %u", port);
|
|
|
|
|
|
|
|
if (localPort == 0 )
|
|
|
|
LogInfo(" Local Port: random");
|
|
|
|
else
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
|
|
|
|
|
|
|
LogInfo(" Dim Display on Idle: %s", dimOnIdle ? "yes" : "no");
|
|
|
|
LogInfo(" Clock Display: %s", displayClock ? "yes" : "no");
|
|
|
|
|
|
|
|
if (displayClock)
|
|
|
|
LogInfo(" Display UTC: %s", utc ? "yes" : "no");
|
|
|
|
|
|
|
|
display = new CLCDproc(address.c_str(), port, localPort, conf.getCallsign(), dmrid, displayClock, utc, conf.getDuplex(), dimOnIdle);
|
|
|
|
#if defined(HD44780)
|
|
|
|
} else if (type == "HD44780") {
|
|
|
|
unsigned int rows = conf.getHD44780Rows();
|
|
|
|
unsigned int columns = conf.getHD44780Columns();
|
|
|
|
std::vector<unsigned int> pins = conf.getHD44780Pins();
|
|
|
|
unsigned int i2cAddress = conf.getHD44780i2cAddress();
|
|
|
|
bool pwm = conf.getHD44780PWM();
|
|
|
|
unsigned int pwmPin = conf.getHD44780PWMPin();
|
|
|
|
unsigned int pwmBright = conf.getHD44780PWMBright();
|
|
|
|
unsigned int pwmDim = conf.getHD44780PWMDim();
|
|
|
|
bool displayClock = conf.getHD44780DisplayClock();
|
|
|
|
bool utc = conf.getHD44780UTC();
|
|
|
|
|
|
|
|
if (pins.size() == 6U) {
|
|
|
|
LogInfo(" Rows: %u", rows);
|
|
|
|
LogInfo(" Columns: %u", columns);
|
|
|
|
|
|
|
|
#if defined(ADAFRUIT_DISPLAY) || defined(PCF8574_DISPLAY)
|
|
|
|
LogInfo(" Device Address: %#x", i2cAddress);
|
|
|
|
#else
|
|
|
|
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));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
LogInfo(" PWM Backlight: %s", pwm ? "yes" : "no");
|
|
|
|
if (pwm) {
|
|
|
|
LogInfo(" PWM Pin: %u", pwmPin);
|
|
|
|
LogInfo(" PWM Bright: %u", pwmBright);
|
|
|
|
LogInfo(" PWM Dim: %u", pwmDim);
|
|
|
|
}
|
|
|
|
|
|
|
|
LogInfo(" Clock Display: %s", displayClock ? "yes" : "no");
|
|
|
|
if (displayClock)
|
|
|
|
LogInfo(" Display UTC: %s", utc ? "yes" : "no");
|
|
|
|
|
Fix compile error:
Compile time error:
# make -f Makefile.Pi.PCF8574
g++ -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include -c -o Display.o Display.cpp
Display.cpp: In static member function ‘static CDisplay* CDisplay::createDisplay(const CConf&, CUMP*, CModem*)’:
Display.cpp:581:4: error: ‘m_display’ was not declared in this scope
m_display = new CHD44780(rows, columns, conf.getCallsign(), dmrid, pins, i2cAddress, pwm, pwmPin, pwmBright, pwmDim, displayClock, utc, conf.getDuplex());
^
Makefile.Pi.PCF8574:24: recipe for target 'Display.o' failed
make: *** [Display.o] Error 1
looks like every other instance of "m_display" was changed to "display" apart from line 581.
2018-08-02 21:50:15 +00:00
|
|
|
display = new CHD44780(rows, columns, conf.getCallsign(), dmrid, pins, i2cAddress, pwm, pwmPin, pwmBright, pwmDim, displayClock, utc, conf.getDuplex());
|
2018-07-31 03:36:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
} else if (type == "OLED") {
|
2020-11-15 18:12:38 +00:00
|
|
|
unsigned char type = conf.getOLEDType();
|
|
|
|
unsigned char brightness = conf.getOLEDBrightness();
|
|
|
|
bool invert = conf.getOLEDInvert();
|
|
|
|
bool scroll = conf.getOLEDScroll();
|
2018-10-31 16:54:57 +00:00
|
|
|
bool rotate = conf.getOLEDRotate();
|
2019-09-27 20:28:57 +00:00
|
|
|
bool logosaver = conf.getOLEDLogoScreensaver();
|
2018-10-31 16:54:57 +00:00
|
|
|
|
2019-09-27 20:28:57 +00:00
|
|
|
display = new COLED(type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2());
|
2019-05-10 18:44:01 +00:00
|
|
|
} else if (type == "CAST") {
|
|
|
|
display = new CCASTInfo(modem);
|
2018-07-31 03:36:37 +00:00
|
|
|
} else {
|
|
|
|
display = new CNullDisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ret = display->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete display;
|
|
|
|
display = new CNullDisplay;
|
|
|
|
}
|
2018-07-31 06:54:27 +00:00
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|