diff --git a/DStarControl.cpp b/DStarControl.cpp
index 1c418bd6..2167be5c 100644
--- a/DStarControl.cpp
+++ b/DStarControl.cpp
@@ -140,9 +140,9 @@ unsigned int CDStarControl::maybeFixupVoiceFrame(
unsigned char n,
bool blank_dtmf,
unsigned char* voice_sync_data,
- unsigned int* voice_sync_data_len,
- bool* next_frame_is_fast_data,
- unsigned int* skip_dtmf_blanking_frames
+ unsigned int& voice_sync_data_len,
+ bool& next_frame_is_fast_data,
+ unsigned int& skip_dtmf_blanking_frames
)
{
unsigned int errors = 0U;
@@ -152,37 +152,40 @@ unsigned int CDStarControl::maybeFixupVoiceFrame(
if (n == 0U) {
::memcpy(voice_sync_data, data, MODEM_DATA_LEN);
- *voice_sync_data_len = len;
+ voice_sync_data_len = len;
} else if ((n % 2U != 0U) &&
((mini_header_type == DSTAR_SLOW_DATA_TYPE_FASTDATA01) ||
(mini_header_type == DSTAR_SLOW_DATA_TYPE_FASTDATA16))) {
- *next_frame_is_fast_data = true;
+ next_frame_is_fast_data = true;
if (blank_dtmf)
- *skip_dtmf_blanking_frames = FAST_DATA_BEEP_GRACE_FRAMES;
+ skip_dtmf_blanking_frames = FAST_DATA_BEEP_GRACE_FRAMES;
if (n == 1U)
- LogDebug("D-Star, %s fastdata sequence no. 0", log_prefix);
+ LogDebug("D-Star, %s fastdata sequence no. 0", log_prefix);
LogDebug("D-Star, %s fastdata sequence no. %2u", log_prefix, n);
- } else if (*next_frame_is_fast_data == true) {
- *next_frame_is_fast_data = false;
+ } else if (next_frame_is_fast_data) {
+ next_frame_is_fast_data = false;
if (blank_dtmf)
- *skip_dtmf_blanking_frames = FAST_DATA_BEEP_GRACE_FRAMES;
+ skip_dtmf_blanking_frames = FAST_DATA_BEEP_GRACE_FRAMES;
LogDebug("D-Star, %s fastdata sequence no. %2u", log_prefix, n);
} else {
bool voice_sync_data_is_null_ambe_data = false;
bool data_is_null_ambe_data = false;
+
if ((n == 1U) && (::memcmp(voice_sync_data + offset, DSTAR_NULL_AMBE_DATA_BYTES_SCRAMBLED, DSTAR_VOICE_FRAME_LENGTH_BYTES) == 0))
voice_sync_data_is_null_ambe_data = true;
+
if (::memcmp(data + offset, DSTAR_NULL_AMBE_DATA_BYTES_SCRAMBLED, DSTAR_VOICE_FRAME_LENGTH_BYTES) == 0)
data_is_null_ambe_data = true;
if ((n == 1U) && !voice_sync_data_is_null_ambe_data)
voice_sync_errors += m_fec.regenerateDStar(voice_sync_data + offset);
+
if (!data_is_null_ambe_data)
errors += m_fec.regenerateDStar(data + offset);
- if (blank_dtmf && (*skip_dtmf_blanking_frames > 0U)) {
- (*skip_dtmf_blanking_frames)--;
- } else if (blank_dtmf && (*skip_dtmf_blanking_frames == 0U)) {
+ if (blank_dtmf && skip_dtmf_blanking_frames > 0U) {
+ skip_dtmf_blanking_frames--;
+ } else if (blank_dtmf && skip_dtmf_blanking_frames == 0U) {
if ((n == 1U) && !voice_sync_data_is_null_ambe_data)
blankDTMF(voice_sync_data + offset);
if (!data_is_null_ambe_data)
@@ -191,17 +194,16 @@ unsigned int CDStarControl::maybeFixupVoiceFrame(
if (n == 1U) {
if (voice_sync_data_is_null_ambe_data)
- LogDebug("D-Star, %s nullaudio sequence no. 0", log_prefix);
+ LogDebug("D-Star, %s nullaudio sequence no. 0", log_prefix);
else
- LogDebug("D-Star, %s audio sequence no. 0, errs: %2u/48 (%5.1f%%)", log_prefix, voice_sync_errors,
- float(voice_sync_errors) / 0.48F);
+ LogDebug("D-Star, %s audio sequence no. 0, errs: %2u/48 (%5.1f%%)", log_prefix, voice_sync_errors, float(voice_sync_errors) / 0.48F);
}
+
if (data_is_null_ambe_data)
LogDebug("D-Star, %s nullaudio sequence no. %2u", log_prefix, n);
else
- LogDebug("D-Star, %s audio sequence no. %2u, errs: %2u/48 (%5.1f%%)", log_prefix, n, errors,
- float(errors) / 0.48F);
- }
+ LogDebug("D-Star, %s audio sequence no. %2u, errs: %2u/48 (%5.1f%%)", log_prefix, n, errors, float(errors) / 0.48F);
+ }
return voice_sync_errors + errors;
}
@@ -456,8 +458,7 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
unsigned int errors = 0U;
if (!m_rfHeader.isDataPacket()) {
- errors = maybeFixupVoiceFrame(data, len, 1U, "RF", m_rfN, m_duplex, m_rfVoiceSyncData, &m_rfVoiceSyncDataLen,
- &m_rfNextFrameIsFastData, &m_rfSkipDTMFBlankingFrames);
+ errors = maybeFixupVoiceFrame(data, len, 1U, "RF", m_rfN, m_duplex, m_rfVoiceSyncData, m_rfVoiceSyncDataLen, m_rfNextFrameIsFastData, m_rfSkipDTMFBlankingFrames);
m_display->writeDStarBER(float(errors) / 0.48F);
m_rfErrs += errors;
}
@@ -589,8 +590,7 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
unsigned int errors = 0U;
if (!m_rfHeader.isDataPacket()) {
- errors = maybeFixupVoiceFrame(data, len, 1U, "RF", m_rfN, m_duplex, m_rfVoiceSyncData, &m_rfVoiceSyncDataLen,
- &m_rfNextFrameIsFastData, &m_rfSkipDTMFBlankingFrames);
+ errors = maybeFixupVoiceFrame(data, len, 1U, "RF", m_rfN, m_duplex, m_rfVoiceSyncData, m_rfVoiceSyncDataLen, m_rfNextFrameIsFastData, m_rfSkipDTMFBlankingFrames);
m_rfErrs += errors;
}
@@ -790,8 +790,7 @@ void CDStarControl::writeNetwork()
unsigned int errors = 0U;
if (!m_netHeader.isDataPacket())
- errors = maybeFixupVoiceFrame(data, length, 2U, "Net", n, true, m_netVoiceSyncData, &m_netVoiceSyncDataLen,
- &m_netNextFrameIsFastData, &m_netSkipDTMFBlankingFrames);
+ errors = maybeFixupVoiceFrame(data, length, 2U, "Net", n, true, m_netVoiceSyncData, m_netVoiceSyncDataLen, m_netNextFrameIsFastData, m_netSkipDTMFBlankingFrames);
// Insert silence and reject if in the past
bool ret = insertSilence(data + 1U, n);
@@ -1187,11 +1186,10 @@ void CDStarControl::sendAck()
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK) {
CUtils::removeChar(reflector, ' ');//remove space from reflector so all nicely fits onto 20 chars in case rssi < 99dBm
::sprintf(text, "%-8.8s %.1f%% -%udBm ", reflector, float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
- }
- else
+ } else {
::sprintf(text, "BER:%.1f%% -%udBm ", float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
- }
- else if (m_ackMessage == DSTAR_ACK_SMETER && m_rssi != 0) {
+ }
+ } else if (m_ackMessage == DSTAR_ACK_SMETER && m_rssi != 0) {
unsigned int signal, plus;
char signalText[10U];
CSMeter::getSignal(m_aveRSSI / m_rssiCount, signal, plus);
@@ -1204,13 +1202,13 @@ void CDStarControl::sendAck()
::sprintf(text, "%-8.8s %.1f%% %s ", reflector, float(m_rfErrs * 100U) / float(m_rfBits), signalText);
else
::sprintf(text, "BER:%.1f%% %s ", float(m_rfErrs * 100U) / float(m_rfBits), signalText);
- }
- else {
+ } else {
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
else
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
}
+
m_slowData.setText(text);
::memcpy(data, DSTAR_NULL_FRAME_DATA_BYTES, DSTAR_FRAME_LENGTH_BYTES + 1U);
@@ -1253,11 +1251,10 @@ void CDStarControl::sendError()
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK) {
CUtils::removeChar(reflector, ' ');//remove space from reflector so all nicely fits onto 20 chars in case rssi < 99dBm
::sprintf(text, "%-8.8s %.1f%% -%udBm ", reflector, float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
- }
- else
+ } else {
::sprintf(text, "BER:%.1f%% -%udBm ", float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
- }
- else if (m_ackMessage == DSTAR_ACK_SMETER && m_rssi != 0) {
+ }
+ } else if (m_ackMessage == DSTAR_ACK_SMETER && m_rssi != 0) {
unsigned int signal, plus;
char signalText[10U];
CSMeter::getSignal(m_aveRSSI / m_rssiCount, signal, plus);
@@ -1270,13 +1267,13 @@ void CDStarControl::sendError()
::sprintf(text, "%-8.8s %.1f%% %s ", reflector, float(m_rfErrs * 100U) / float(m_rfBits), signalText);
else
::sprintf(text, "BER:%.1f%% %s ", float(m_rfErrs * 100U) / float(m_rfBits), signalText);
- }
- else {
+ } else {
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
else
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
}
+
m_slowData.setText(text);
::memcpy(data, DSTAR_NULL_FRAME_DATA_BYTES, DSTAR_FRAME_LENGTH_BYTES + 1U);
diff --git a/DStarControl.h b/DStarControl.h
index e37f3d06..d899c68b 100644
--- a/DStarControl.h
+++ b/DStarControl.h
@@ -107,7 +107,6 @@ class CDStarControl {
unsigned int m_rfSkipDTMFBlankingFrames;
unsigned int m_netSkipDTMFBlankingFrames;
-
unsigned int maybeFixupVoiceFrame(
unsigned char* data,
unsigned int len,
@@ -116,9 +115,9 @@ class CDStarControl {
unsigned char n,
bool blank_dtmf,
unsigned char* voice_sync_data,
- unsigned int* voice_sync_data_len,
- bool* next_frame_is_fast_data,
- unsigned int* skip_dtmf_blanking_frames
+ unsigned int& voice_sync_data_len,
+ bool& next_frame_is_fast_data,
+ unsigned int& skip_dtmf_blanking_frames
);
void writeNetwork();
diff --git a/MMDVMHost.vcxproj b/MMDVMHost.vcxproj
index 8a7ebe4c..1c820cbc 100644
--- a/MMDVMHost.vcxproj
+++ b/MMDVMHost.vcxproj
@@ -233,6 +233,7 @@
+
@@ -327,6 +328,7 @@
+
diff --git a/MMDVMHost.vcxproj.filters b/MMDVMHost.vcxproj.filters
index b6aa8a8b..19a0291f 100644
--- a/MMDVMHost.vcxproj.filters
+++ b/MMDVMHost.vcxproj.filters
@@ -308,6 +308,9 @@
Header Files
+
+ Header Files
+
@@ -580,5 +583,8 @@
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/SMeter.cpp b/SMeter.cpp
index 0376c0b9..75b36f83 100644
--- a/SMeter.cpp
+++ b/SMeter.cpp
@@ -19,21 +19,19 @@
#include "SMeter.h"
-#define RSSI_S1 141U
-#define RSSI_S9 93U
+const unsigned int RSSI_S1 = 141U;
+const unsigned int RSSI_S9 = 93U;
-void CSMeter::getSignal(unsigned int rssi, unsigned int & signal, unsigned int & plus)
+void CSMeter::getSignal(unsigned int rssi, unsigned int& signal, unsigned int& plus)
{
if (rssi > RSSI_S1) {
- signal = 0;
+ signal = 0U;
plus = rssi - RSSI_S1;
- }
- else if (rssi > RSSI_S9 && rssi <= RSSI_S1) {
+ } else if (rssi > RSSI_S9 && rssi <= RSSI_S1) {
signal = ((RSSI_S1 - rssi) / 6U) + 1U;
plus = (RSSI_S1 - rssi) % 6U;
- }
- else {
+ } else {
signal = 9U;
plus = RSSI_S9 - rssi;
}
-}
\ No newline at end of file
+}
diff --git a/SMeter.h b/SMeter.h
index 5792cd53..76c4d603 100644
--- a/SMeter.h
+++ b/SMeter.h
@@ -20,13 +20,10 @@
#if !defined(SMETER_H)
#define SMETER_H
-#include
-#include
-
class CSMeter
{
public:
- static void getSignal(unsigned int rssi, unsigned int & signal, unsigned int & plus);
+ static void getSignal(unsigned int rssi, unsigned int& signal, unsigned int& plus);
};
#endif
\ No newline at end of file
diff --git a/Version.h b/Version.h
index 486d5455..39e7d8ef 100644
--- a/Version.h
+++ b/Version.h
@@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
-const char* VERSION = "20210408";
+const char* VERSION = "20210518";
#endif