Port V24 pre-#7 startup baseline onto master

pull/116/head
Tim Sawyer 3 weeks ago
parent d05a593b36
commit 7b4101b975

3
.gitignore vendored

@ -23,6 +23,9 @@ _deps
# Ignore thumbnails created by windows
Thumbs.db
# Ignore macOS Finder metadata files
.DS_Store
# Ignore files created by clang-check
*.plist

@ -255,6 +255,11 @@ void* Host::threadP25Writer(void* arg)
if (nextLen > 0U) {
bool ret = host->m_modem->hasP25Space(nextLen);
// V.24 modem status space can lag at call start; do not block
// initial Net->RF voice frames on stale p25Space accounting.
if (!ret && host->m_modem->isV24Connected()) {
ret = true;
}
if (ret) {
bool imm = false;
uint32_t len = host->m_p25->getFrame(data, &imm);
@ -267,7 +272,7 @@ void* Host::threadP25Writer(void* arg)
// if the state is P25; write P25 frame data
if (host->m_state == STATE_P25) {
host->m_modem->writeP25Frame(data, len);
host->m_modem->writeP25Frame(data, len, imm);
afterWriteCallback();

@ -1517,7 +1517,10 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length, bool imm)
uint32_t len = length + 2U;
// write or buffer P25 data to air interface
if (m_p25Space >= length) {
//
// For V.24/DFSI, the modem status space value may lag call startup; do
// not block initial Net->RF frames solely on stale p25Space.
if (m_p25Space >= length || isV24Connected()) {
if (m_debug)
LogDebugEx(LOG_MODEM, "Modem::writeP25Frame()", "immediate write (len %u)", length);
if (m_trace)
@ -1529,7 +1532,9 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length, bool imm)
return false;
}
m_p25Space -= length;
if (m_p25Space >= length) {
m_p25Space -= length;
}
}
else {
return false;

@ -394,10 +394,11 @@ void ModemV24::clock(uint32_t ms)
int len = 0;
// write anything waiting to the serial port
if (!m_txImmP25Queue.isEmpty())
//
// Keep normal queue first for startup consistency with older behavior.
len = writeSerial(&m_txP25Queue);
if (len == 0 && !m_txImmP25Queue.isEmpty())
len = writeSerial(&m_txImmP25Queue);
else
len = writeSerial(&m_txP25Queue);
if (m_debug && len > 0) {
LogDebug(LOG_MODEM, "Wrote %u-byte message to the serial V24 device", len);
} else if (len < 0) {
@ -496,10 +497,6 @@ int ModemV24::writeSerial(RingBuffer<uint8_t>* queue)
return 0U;
}
// check available modem space
if (m_p25Space < len)
return 0U;
std::lock_guard<std::mutex> lock(m_txP25QueueLock);
// get current timestamp

Loading…
Cancel
Save

Powered by TurnKey Linux.