Skip to content

Commit

Permalink
Add even more debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Dec 6, 2023
1 parent 08ccf14 commit 3337578
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 9 additions & 1 deletion M17Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,13 @@ void CM17Control::writeNetwork()
if (!exists)
return;

if (!m_enabled)
if (!m_enabled) {
LogMessage("M17 not enabled");
return;
}

if (m_rfState != RS_RF_LISTENING && m_rfState != RS_RF_LATE_ENTRY && m_netState == RS_NET_IDLE) {
LogMessage("M17 status is incorrect %d,%d", m_rfState, m_netState);
m_network->reset();
return;
}
Expand All @@ -552,6 +555,7 @@ void CM17Control::writeNetwork()
if (!m_allowEncryption) {
unsigned char type = m_netLSF.getEncryptionType();
if (type != M17_ENCRYPTION_TYPE_NONE) {
LogMessage("M17 encryption rejection");
m_network->reset();
return;
}
Expand Down Expand Up @@ -616,6 +620,8 @@ void CM17Control::writeNetwork()
decorrelator(temp, start + 2U);

writeQueueNet(start);
} else {
LogMessage("M17 in an odd state 1 %d", m_netState);
}

if (m_netState == RS_NET_AUDIO || m_netState == RS_NET_DATA_AUDIO) {
Expand Down Expand Up @@ -728,6 +734,8 @@ void CM17Control::writeNetwork()

writeEndNet();
}
} else {
LogMessage("M17 in an odd state 2 %d", m_netState);
}
}

Expand Down
14 changes: 10 additions & 4 deletions M17Network.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020,2021 by Jonathan Naylor G4KLX
* Copyright (C) 2020,2021,2023 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
Expand Down Expand Up @@ -133,8 +133,10 @@ void CM17Network::clock(unsigned int ms)
if (m_debug)
CUtils::dump(1U, "M17 Network Received", buffer, length);

if (!m_enabled)
if (!m_enabled) {
LogMessage("M17 Network not enabled");
return;
}

if (::memcmp(buffer + 0U, "PING", 4U) == 0)
return;
Expand All @@ -148,8 +150,10 @@ void CM17Network::clock(unsigned int ms)
if (m_inId == 0U) {
m_inId = id;
} else {
if (id != m_inId)
if (id != m_inId) {
LogMessage("M17 Network id rejection");
return;
}
}

unsigned char c = length - 6U;
Expand Down Expand Up @@ -188,7 +192,9 @@ void CM17Network::reset()

void CM17Network::enable(bool enabled)
{
if (!enabled && m_enabled)
if (enabled && !m_enabled)
reset();
else if (!enabled && m_enabled)
m_buffer.clear();

m_enabled = enabled;
Expand Down
2 changes: 1 addition & 1 deletion Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H

const char* VERSION = "20231025";
const char* VERSION = "20231206";

#endif

0 comments on commit 3337578

Please sign in to comment.