mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Calculate the RSSI and BER correctly on the Nextion.
This commit is contained in:
114
Nextion.cpp
114
Nextion.cpp
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -205,15 +205,6 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your,
|
|||||||
|
|
||||||
void CNextion::writeDStarRSSIInt(unsigned char rssi)
|
void CNextion::writeDStarRSSIInt(unsigned char rssi)
|
||||||
{
|
{
|
||||||
if (m_rssiCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t3.txt=\"-%udBm\"", rssi);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(47U);
|
|
||||||
m_rssiCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssiAccum1 += rssi;
|
m_rssiAccum1 += rssi;
|
||||||
m_rssiCount1++;
|
m_rssiCount1++;
|
||||||
|
|
||||||
@@ -223,21 +214,12 @@ void CNextion::writeDStarRSSIInt(unsigned char rssi)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(47U);
|
sendCommandAction(47U);
|
||||||
m_rssiAccum1 = 0U;
|
m_rssiAccum1 = 0U;
|
||||||
m_rssiCount1 = 1U;
|
m_rssiCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNextion::writeDStarBERInt(float ber)
|
void CNextion::writeDStarBERInt(float ber)
|
||||||
{
|
{
|
||||||
if (m_berCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t4.txt=\"%.1f%%\"", ber);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(48U);
|
|
||||||
m_berCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_berAccum1 += ber;
|
m_berAccum1 += ber;
|
||||||
m_berCount1++;
|
m_berCount1++;
|
||||||
|
|
||||||
@@ -247,7 +229,7 @@ void CNextion::writeDStarBERInt(float ber)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(48U);
|
sendCommandAction(48U);
|
||||||
m_berAccum1 = 0.0F;
|
m_berAccum1 = 0.0F;
|
||||||
m_berCount1 = 1U;
|
m_berCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,15 +321,6 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
|||||||
void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
||||||
{
|
{
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
if (m_rssiCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t4.txt=\"-%udBm\"", rssi);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(66U);
|
|
||||||
m_rssiCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssiAccum1 += rssi;
|
m_rssiAccum1 += rssi;
|
||||||
m_rssiCount1++;
|
m_rssiCount1++;
|
||||||
|
|
||||||
@@ -357,18 +330,9 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(66U);
|
sendCommandAction(66U);
|
||||||
m_rssiAccum1 = 0U;
|
m_rssiAccum1 = 0U;
|
||||||
m_rssiCount1 = 1U;
|
m_rssiCount1 = 0U;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_rssiCount2 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t5.txt=\"-%udBm\"", rssi);
|
|
||||||
sendCommandAction(74U);
|
|
||||||
sendCommand(text);
|
|
||||||
m_rssiCount2 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssiAccum2 += rssi;
|
m_rssiAccum2 += rssi;
|
||||||
m_rssiCount2++;
|
m_rssiCount2++;
|
||||||
|
|
||||||
@@ -378,7 +342,7 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(74U);
|
sendCommandAction(74U);
|
||||||
m_rssiAccum2 = 0U;
|
m_rssiAccum2 = 0U;
|
||||||
m_rssiCount2 = 1U;
|
m_rssiCount2 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,6 +360,7 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co
|
|||||||
if (m_screenLayout == 2U) sendCommand("t2.pco=33808");
|
if (m_screenLayout == 2U) sendCommand("t2.pco=33808");
|
||||||
sendCommandAction(72U);
|
sendCommandAction(72U);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +378,7 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co
|
|||||||
|
|
||||||
sendCommand("t0.pco=1024");
|
sendCommand("t0.pco=1024");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(63U);
|
sendCommandAction(63U);
|
||||||
} else {
|
} else {
|
||||||
@@ -437,15 +403,6 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co
|
|||||||
void CNextion::writeDMRBERInt(unsigned int slotNo, float ber)
|
void CNextion::writeDMRBERInt(unsigned int slotNo, float ber)
|
||||||
{
|
{
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
if (m_berCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t6.txt=\"%.1f%%\"", ber);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(67U);
|
|
||||||
m_berCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_berAccum1 += ber;
|
m_berAccum1 += ber;
|
||||||
m_berCount1++;
|
m_berCount1++;
|
||||||
|
|
||||||
@@ -455,18 +412,9 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(67U);
|
sendCommandAction(67U);
|
||||||
m_berAccum1 = 0U;
|
m_berAccum1 = 0U;
|
||||||
m_berCount1 = 1U;
|
m_berCount1 = 0U;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_berCount2 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t7.txt=\"%.1f%%\"", ber);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(75U);
|
|
||||||
m_berCount2 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_berAccum2 += ber;
|
m_berAccum2 += ber;
|
||||||
m_berCount2++;
|
m_berCount2++;
|
||||||
|
|
||||||
@@ -476,7 +424,7 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(75U);
|
sendCommandAction(75U);
|
||||||
m_berAccum2 = 0U;
|
m_berAccum2 = 0U;
|
||||||
m_berCount2 = 1U;
|
m_berCount2 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -551,15 +499,6 @@ void CNextion::writeFusionInt(const char* source, const char* dest, const char*
|
|||||||
|
|
||||||
void CNextion::writeFusionRSSIInt(unsigned char rssi)
|
void CNextion::writeFusionRSSIInt(unsigned char rssi)
|
||||||
{
|
{
|
||||||
if (m_rssiCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t3.txt=\"-%udBm\"", rssi);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(85U);
|
|
||||||
m_rssiCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssiAccum1 += rssi;
|
m_rssiAccum1 += rssi;
|
||||||
m_rssiCount1++;
|
m_rssiCount1++;
|
||||||
|
|
||||||
@@ -569,21 +508,12 @@ void CNextion::writeFusionRSSIInt(unsigned char rssi)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(85U);
|
sendCommandAction(85U);
|
||||||
m_rssiAccum1 = 0U;
|
m_rssiAccum1 = 0U;
|
||||||
m_rssiCount1 = 1U;
|
m_rssiCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNextion::writeFusionBERInt(float ber)
|
void CNextion::writeFusionBERInt(float ber)
|
||||||
{
|
{
|
||||||
if (m_berCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t4.txt=\"%.1f%%\"", ber);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(86U);
|
|
||||||
m_berCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_berAccum1 += ber;
|
m_berAccum1 += ber;
|
||||||
m_berCount1++;
|
m_berCount1++;
|
||||||
|
|
||||||
@@ -593,7 +523,7 @@ void CNextion::writeFusionBERInt(float ber)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(86U);
|
sendCommandAction(86U);
|
||||||
m_berAccum1 = 0.0F;
|
m_berAccum1 = 0.0F;
|
||||||
m_berCount1 = 1U;
|
m_berCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,15 +570,6 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co
|
|||||||
|
|
||||||
void CNextion::writeP25RSSIInt(unsigned char rssi)
|
void CNextion::writeP25RSSIInt(unsigned char rssi)
|
||||||
{
|
{
|
||||||
if (m_rssiCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t2.txt=\"-%udBm\"", rssi);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(104U);
|
|
||||||
m_rssiCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssiAccum1 += rssi;
|
m_rssiAccum1 += rssi;
|
||||||
m_rssiCount1++;
|
m_rssiCount1++;
|
||||||
|
|
||||||
@@ -658,21 +579,12 @@ void CNextion::writeP25RSSIInt(unsigned char rssi)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(104U);
|
sendCommandAction(104U);
|
||||||
m_rssiAccum1 = 0U;
|
m_rssiAccum1 = 0U;
|
||||||
m_rssiCount1 = 1U;
|
m_rssiCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNextion::writeP25BERInt(float ber)
|
void CNextion::writeP25BERInt(float ber)
|
||||||
{
|
{
|
||||||
if (m_berCount1 == 0U) {
|
|
||||||
char text[20U];
|
|
||||||
::sprintf(text, "t3.txt=\"%.1f%%\"", ber);
|
|
||||||
sendCommand(text);
|
|
||||||
sendCommandAction(105U);
|
|
||||||
m_berCount1 = 1U;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_berAccum1 += ber;
|
m_berAccum1 += ber;
|
||||||
m_berCount1++;
|
m_berCount1++;
|
||||||
|
|
||||||
@@ -682,7 +594,7 @@ void CNextion::writeP25BERInt(float ber)
|
|||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(105U);
|
sendCommandAction(105U);
|
||||||
m_berAccum1 = 0.0F;
|
m_berAccum1 = 0.0F;
|
||||||
m_berCount1 = 1U;
|
m_berCount1 = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user