Display the RSSI on the Nextion screen.
This commit is contained in:
parent
af721f89e2
commit
3c9666e780
|
@ -227,6 +227,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
|||
if (m_netState == RS_NET_IDLE) {
|
||||
setShortLC(m_slotNo, dstId, flco, true);
|
||||
m_display->writeDMR(m_slotNo, src, flco == FLCO_GROUP, dst, "R");
|
||||
m_display->writeDMRRSSI(m_slotNo, m_rssi);
|
||||
}
|
||||
|
||||
LogMessage("DMR Slot %u, received RF voice header from %s to %s%s", m_slotNo, src.c_str(), flco == FLCO_GROUP ? "TG " : "", dst.c_str());
|
||||
|
@ -337,6 +338,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
|||
if (m_netState == RS_NET_IDLE) {
|
||||
setShortLC(m_slotNo, dstId, gi ? FLCO_GROUP : FLCO_USER_USER, false);
|
||||
m_display->writeDMR(m_slotNo, src, gi, dst, "R");
|
||||
m_display->writeDMRRSSI(m_slotNo, m_rssi);
|
||||
}
|
||||
|
||||
LogMessage("DMR Slot %u, received RF data header from %s to %s%s, %u blocks", m_slotNo, src.c_str(), gi ? "TG ": "", dst.c_str(), m_rfFrames);
|
||||
|
@ -475,6 +477,8 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
|||
writeQueueRF(data);
|
||||
|
||||
writeNetworkRF(data, DT_VOICE_SYNC, errors);
|
||||
|
||||
m_display->writeDMRRSSI(m_slotNo, m_rssi);
|
||||
} else if (m_rfState == RS_RF_LISTENING) {
|
||||
m_rfEmbeddedLC.reset();
|
||||
m_rfState = RS_RF_LATE_ENTRY;
|
||||
|
@ -614,6 +618,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
|||
if (m_netState == RS_NET_IDLE) {
|
||||
setShortLC(m_slotNo, dstId, flco, true);
|
||||
m_display->writeDMR(m_slotNo, src, flco == FLCO_GROUP, dst, "R");
|
||||
m_display->writeDMRRSSI(m_slotNo, m_rssi);
|
||||
}
|
||||
|
||||
LogMessage("DMR Slot %u, received RF late entry from %s to %s%s", m_slotNo, src.c_str(), flco == FLCO_GROUP ? "TG " : "", dst.c_str());
|
||||
|
|
|
@ -259,8 +259,10 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
|
||||
m_rfState = RS_RF_AUDIO;
|
||||
|
||||
if (m_netState == RS_NET_IDLE)
|
||||
if (m_netState == RS_NET_IDLE) {
|
||||
m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R", " ");
|
||||
m_display->writeDStarRSSI(m_rssi);
|
||||
}
|
||||
|
||||
LogMessage("D-Star, received RF header from %8.8s/%4.4s to %8.8s", my1, my2, your);
|
||||
} else if (type == TAG_EOT) {
|
||||
|
@ -304,9 +306,11 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0)
|
||||
m_rfN = 0U;
|
||||
|
||||
// Regenerate the sync
|
||||
if (m_rfN == 0U)
|
||||
// Regenerate the sync and send the RSSI data to the display
|
||||
if (m_rfN == 0U) {
|
||||
CSync::addDStarSync(data + 1U);
|
||||
m_display->writeDStarRSSI(m_rssi);
|
||||
}
|
||||
|
||||
LogDebug("D-Star, audio sequence no. %u, errs: %u/48", m_rfN, errors);
|
||||
|
||||
|
@ -438,8 +442,10 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
|
||||
m_rfN = (m_rfN + 1U) % 21U;
|
||||
|
||||
if (m_netState == RS_NET_IDLE)
|
||||
if (m_netState == RS_NET_IDLE) {
|
||||
m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R", " ");
|
||||
m_display->writeDStarRSSI(m_rssi);
|
||||
}
|
||||
|
||||
LogMessage("D-Star, received RF late entry from %8.8s/%4.4s to %8.8s", my1, my2, your);
|
||||
}
|
||||
|
|
42
Display.cpp
42
Display.cpp
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 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
|
||||
|
@ -84,6 +84,12 @@ void CDisplay::writeDStar(const char* my1, const char* my2, const char* your, co
|
|||
writeDStarInt(my1, my2, your, type, reflector);
|
||||
}
|
||||
|
||||
void CDisplay::writeDStarRSSI(unsigned char rssi)
|
||||
{
|
||||
if (rssi != 0U)
|
||||
writeDStarRSSIInt(rssi);
|
||||
}
|
||||
|
||||
void CDisplay::clearDStar()
|
||||
{
|
||||
if (m_timer1.hasExpired()) {
|
||||
|
@ -110,6 +116,12 @@ void CDisplay::writeDMR(unsigned int slotNo, const std::string& src, bool group,
|
|||
writeDMRInt(slotNo, src, group, dst, type);
|
||||
}
|
||||
|
||||
void CDisplay::writeDMRRSSI(unsigned int slotNo, unsigned char rssi)
|
||||
{
|
||||
if (rssi != 0U)
|
||||
writeDMRRSSIInt(slotNo, rssi);
|
||||
}
|
||||
|
||||
void CDisplay::clearDMR(unsigned int slotNo)
|
||||
{
|
||||
if (slotNo == 1U) {
|
||||
|
@ -144,6 +156,12 @@ void CDisplay::writeFusion(const char* source, const char* dest, const char* typ
|
|||
writeFusionInt(source, dest, type, origin);
|
||||
}
|
||||
|
||||
void CDisplay::writeFusionRSSI(unsigned char rssi)
|
||||
{
|
||||
if (rssi != 0U)
|
||||
writeFusionRSSIInt(rssi);
|
||||
}
|
||||
|
||||
void CDisplay::clearFusion()
|
||||
{
|
||||
if (m_timer1.hasExpired()) {
|
||||
|
@ -166,6 +184,12 @@ void CDisplay::writeP25(const char* source, bool group, unsigned int dest, const
|
|||
writeP25Int(source, group, dest, type);
|
||||
}
|
||||
|
||||
void CDisplay::writeP25RSSI(unsigned char rssi)
|
||||
{
|
||||
if (rssi != 0U)
|
||||
writeP25RSSIInt(rssi);
|
||||
}
|
||||
|
||||
void CDisplay::clearP25()
|
||||
{
|
||||
if (m_timer1.hasExpired()) {
|
||||
|
@ -236,3 +260,19 @@ void CDisplay::clock(unsigned int ms)
|
|||
void CDisplay::clockInt(unsigned int ms)
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplay::writeDStarRSSIInt(unsigned char rssi)
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplay::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplay::writeFusionRSSIInt(unsigned char rssi)
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplay::writeP25RSSIInt(unsigned char rssi)
|
||||
{
|
||||
}
|
||||
|
|
10
Display.h
10
Display.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 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
|
||||
|
@ -36,15 +36,19 @@ public:
|
|||
void setError(const char* text);
|
||||
|
||||
void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
|
||||
void writeDStarRSSI(unsigned char rssi);
|
||||
void clearDStar();
|
||||
|
||||
void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||
void writeDMRRSSI(unsigned int slotNo, unsigned char rssi);
|
||||
void clearDMR(unsigned int slotNo);
|
||||
|
||||
void writeFusion(const char* source, const char* dest, const char* type, const char* origin);
|
||||
void writeFusionRSSI(unsigned char rssi);
|
||||
void clearFusion();
|
||||
|
||||
void writeP25(const char* source, bool group, unsigned int dest, const char* type);
|
||||
void writeP25RSSI(unsigned char rssi);
|
||||
void clearP25();
|
||||
|
||||
void writeCW();
|
||||
|
@ -60,15 +64,19 @@ protected:
|
|||
virtual void setErrorInt(const char* text) = 0;
|
||||
|
||||
virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) = 0;
|
||||
virtual void writeDStarRSSIInt(unsigned char rssi);
|
||||
virtual void clearDStarInt() = 0;
|
||||
|
||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0;
|
||||
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
|
||||
virtual void clearDMRInt(unsigned int slotNo) = 0;
|
||||
|
||||
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin) = 0;
|
||||
virtual void writeFusionRSSIInt(unsigned char rssi);
|
||||
virtual void clearFusionInt() = 0;
|
||||
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type) = 0;
|
||||
virtual void writeP25RSSIInt(unsigned char rssi);
|
||||
virtual void clearP25Int() = 0;
|
||||
|
||||
virtual void writeCWInt() = 0;
|
||||
|
|
84
Nextion.cpp
84
Nextion.cpp
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 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
|
||||
|
@ -25,6 +25,11 @@
|
|||
#include <ctime>
|
||||
#include <clocale>
|
||||
|
||||
const unsigned int DSTAR_RSSI_COUNT = 3U; // 3 * 420ms = 1260ms
|
||||
const unsigned int DMR_RSSI_COUNT = 4U; // 4 * 360ms = 1440ms
|
||||
const unsigned int YSF_RSSI_COUNT = 13U; // 13 * 100ms = 1300ms
|
||||
const unsigned int P25_RSSI_COUNT = 7U; // 7 * 180ms = 1260ms
|
||||
|
||||
CNextion::CNextion(const std::string& callsign, unsigned int dmrid, ISerialPort* serial, unsigned int brightness, bool displayClock, bool utc, unsigned int idleBrightness) :
|
||||
CDisplay(),
|
||||
m_callsign(callsign),
|
||||
|
@ -35,7 +40,9 @@ m_mode(MODE_IDLE),
|
|||
m_displayClock(displayClock),
|
||||
m_utc(utc),
|
||||
m_idleBrightness(idleBrightness),
|
||||
m_clockDisplayTimer(1000U, 0U, 400U)
|
||||
m_clockDisplayTimer(1000U, 0U, 400U),
|
||||
m_rssiCount1(0U),
|
||||
m_rssiCount2(0U)
|
||||
{
|
||||
assert(serial != NULL);
|
||||
assert(brightness >= 0U && brightness <= 100U);
|
||||
|
@ -143,6 +150,20 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your,
|
|||
m_clockDisplayTimer.stop();
|
||||
|
||||
m_mode = MODE_DSTAR;
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::writeDStarRSSIInt(unsigned char rssi)
|
||||
{
|
||||
if (m_rssiCount1 == 0U) {
|
||||
char text[20U];
|
||||
::sprintf(text, "t3.txt=\"-%u dBm\"", rssi);
|
||||
sendCommand(text);
|
||||
}
|
||||
|
||||
m_rssiCount1++;
|
||||
if (m_rssiCount1 >= DSTAR_RSSI_COUNT)
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::clearDStarInt()
|
||||
|
@ -150,6 +171,7 @@ void CNextion::clearDStarInt()
|
|||
sendCommand("t0.txt=\"Listening\"");
|
||||
sendCommand("t1.txt=\"\"");
|
||||
sendCommand("t2.txt=\"\"");
|
||||
sendCommand("t3.txt=\"\"");
|
||||
}
|
||||
|
||||
void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
||||
|
@ -186,6 +208,33 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
|||
m_clockDisplayTimer.stop();
|
||||
|
||||
m_mode = MODE_DMR;
|
||||
m_rssiCount1 = 0U;
|
||||
m_rssiCount2 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
||||
{
|
||||
if (slotNo == 1U) {
|
||||
if (m_rssiCount1 == 0U) {
|
||||
char text[20U];
|
||||
::sprintf(text, "t4.txt=\"-%u dBm\"", rssi);
|
||||
sendCommand(text);
|
||||
}
|
||||
|
||||
m_rssiCount1++;
|
||||
if (m_rssiCount1 >= DMR_RSSI_COUNT)
|
||||
m_rssiCount1 = 0U;
|
||||
} else {
|
||||
if (m_rssiCount2 == 0U) {
|
||||
char text[20U];
|
||||
::sprintf(text, "t5.txt=\"-%u dBm\"", rssi);
|
||||
sendCommand(text);
|
||||
}
|
||||
|
||||
m_rssiCount2++;
|
||||
if (m_rssiCount2 >= DMR_RSSI_COUNT)
|
||||
m_rssiCount2 = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
void CNextion::clearDMRInt(unsigned int slotNo)
|
||||
|
@ -193,9 +242,11 @@ void CNextion::clearDMRInt(unsigned int slotNo)
|
|||
if (slotNo == 1U) {
|
||||
sendCommand("t0.txt=\"1 Listening\"");
|
||||
sendCommand("t1.txt=\"\"");
|
||||
sendCommand("t4.txt=\"\"");
|
||||
} else {
|
||||
sendCommand("t2.txt=\"2 Listening\"");
|
||||
sendCommand("t3.txt=\"\"");
|
||||
sendCommand("t5.txt=\"\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,6 +277,20 @@ void CNextion::writeFusionInt(const char* source, const char* dest, const char*
|
|||
m_clockDisplayTimer.stop();
|
||||
|
||||
m_mode = MODE_YSF;
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::writeFusionRSSIInt(unsigned char rssi)
|
||||
{
|
||||
if (m_rssiCount1 == 0U) {
|
||||
char text[20U];
|
||||
::sprintf(text, "t3.txt=\"-%u dBm\"", rssi);
|
||||
sendCommand(text);
|
||||
}
|
||||
|
||||
m_rssiCount1++;
|
||||
if (m_rssiCount1 >= YSF_RSSI_COUNT)
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::clearFusionInt()
|
||||
|
@ -233,6 +298,7 @@ void CNextion::clearFusionInt()
|
|||
sendCommand("t0.txt=\"Listening\"");
|
||||
sendCommand("t1.txt=\"\"");
|
||||
sendCommand("t2.txt=\"\"");
|
||||
sendCommand("t3.txt=\"\"");
|
||||
}
|
||||
|
||||
void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, const char* type)
|
||||
|
@ -256,6 +322,20 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co
|
|||
m_clockDisplayTimer.stop();
|
||||
|
||||
m_mode = MODE_P25;
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::writeP25RSSIInt(unsigned char rssi)
|
||||
{
|
||||
if (m_rssiCount1 == 0U) {
|
||||
char text[20U];
|
||||
::sprintf(text, "t2.txt=\"-%u dBm\"", rssi);
|
||||
sendCommand(text);
|
||||
}
|
||||
|
||||
m_rssiCount1++;
|
||||
if (m_rssiCount1 >= P25_RSSI_COUNT)
|
||||
m_rssiCount1 = 0U;
|
||||
}
|
||||
|
||||
void CNextion::clearP25Int()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017 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
|
||||
|
@ -42,15 +42,19 @@ protected:
|
|||
virtual void setLockoutInt();
|
||||
|
||||
virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
|
||||
virtual void writeDStarRSSIInt(unsigned char rssi);
|
||||
virtual void clearDStarInt();
|
||||
|
||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
|
||||
virtual void clearDMRInt(unsigned int slotNo);
|
||||
|
||||
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin);
|
||||
virtual void writeFusionRSSIInt(unsigned char rssi);
|
||||
virtual void clearFusionInt();
|
||||
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void writeP25RSSIInt(unsigned char rssi);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeCWInt();
|
||||
|
@ -68,6 +72,8 @@ private:
|
|||
bool m_utc;
|
||||
unsigned int m_idleBrightness;
|
||||
CTimer m_clockDisplayTimer;
|
||||
unsigned int m_rssiCount1;
|
||||
unsigned int m_rssiCount2;
|
||||
|
||||
void sendCommand(const char* command);
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -233,6 +233,8 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len)
|
|||
m_display->writeP25(source.c_str(), grp, dstId, "R");
|
||||
m_rfState = RS_RF_AUDIO;
|
||||
}
|
||||
|
||||
m_display->writeP25RSSI(m_rssi);
|
||||
} else if (duid == P25_DUID_LDU2) {
|
||||
if (m_rfState == RS_RF_LISTENING)
|
||||
return false;
|
||||
|
@ -274,6 +276,8 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len)
|
|||
data[1U] = 0x00U;
|
||||
writeQueueRF(data, P25_LDU_FRAME_LENGTH_BYTES + 2U);
|
||||
}
|
||||
|
||||
m_display->writeP25RSSI(m_rssi);
|
||||
} else if (duid == P25_DUID_TERM || duid == P25_DUID_TERM_LC) {
|
||||
if (m_rfState == RS_RF_LISTENING)
|
||||
return false;
|
||||
|
|
|
@ -219,6 +219,8 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||
}
|
||||
|
||||
m_rfFrames++;
|
||||
|
||||
m_display->writeFusionRSSI(m_rssi);
|
||||
} else if (valid && fi == YSF_FI_TERMINATOR) {
|
||||
CSync::addYSFSync(data + 2U);
|
||||
|
||||
|
@ -348,6 +350,8 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||
#endif
|
||||
|
||||
m_rfFrames++;
|
||||
|
||||
m_display->writeFusionRSSI(m_rssi);
|
||||
} else {
|
||||
CSync::addYSFSync(data + 2U);
|
||||
|
||||
|
@ -363,6 +367,8 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||
writeFile(data + 2U);
|
||||
#endif
|
||||
m_rfFrames++;
|
||||
|
||||
m_display->writeFusionRSSI(m_rssi);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue