From 8cf3d106304e129477b5c2636e9bed622e461349 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 5 May 2021 14:02:46 +0000 Subject: [PATCH] slightly alter timing constants in Host to better control CPU usage while idle; remove unnecessary debug code; --- host/Host.cpp | 16 ++++++++++++---- p25/Control.cpp | 11 ----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/host/Host.cpp b/host/Host.cpp index 548af8e0..464ffe2e 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -61,6 +61,13 @@ using namespace lookups; #include #endif +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +#define IDLE_SLEEP_MS 5U +#define ACTIVE_SLEEP_MS 1U + // --------------------------------------------------------------------------- // Public Class Members // --------------------------------------------------------------------------- @@ -526,8 +533,7 @@ int Host::run() if (m_network != NULL) m_network->clock(ms); - if (ms < 2U) - Thread::sleep(1U); + Thread::sleep(IDLE_SLEEP_MS); if (elapsedMs > 15000U) break; @@ -1118,8 +1124,10 @@ int Host::run() m_modeTimer.clock(ms); - if (ms < 2U) - Thread::sleep(1U); + if ((m_state != STATE_IDLE) && ms <= 1U) + Thread::sleep(ACTIVE_SLEEP_MS); + if (m_state == STATE_IDLE) + Thread::sleep(IDLE_SLEEP_MS); } setState(HOST_STATE_QUIT); diff --git a/p25/Control.cpp b/p25/Control.cpp index c9fa9b25..524bddd0 100644 --- a/p25/Control.cpp +++ b/p25/Control.cpp @@ -644,17 +644,6 @@ void Control::clock(uint32_t ms) } m_trunk->clock(ms); - - // if the states are "idle" ensure LC data isn't being held in memory - if (m_rfState == RS_RF_LISTENING && m_netState == RS_NET_IDLE) { - m_voice->resetRF(); - m_voice->resetNet(); - - m_data->resetRF(); - - m_trunk->m_rfTSBK = lc::TSBK(m_siteData, m_idenEntry); - m_trunk->m_netTSBK = lc::TSBK(m_siteData, m_idenEntry); - } } ///