Reset the mode's state machines when going to the disabled state.

This commit is contained in:
Jonathan Naylor
2019-01-19 17:15:24 +00:00
parent b16aaa653c
commit ae9e6ea6ab
15 changed files with 286 additions and 2 deletions

View File

@@ -80,6 +80,7 @@ m_maxRSSI(0U),
m_minRSSI(0U),
m_aveRSSI(0U),
m_rssiCount(0U),
m_enabled(true),
m_fp(NULL)
{
assert(display != NULL);
@@ -1160,3 +1161,23 @@ bool CP25Control::isBusy() const
{
return m_rfState != RS_RF_LISTENING || m_netState != RS_NET_IDLE;
}
void CP25Control::enable(bool enabled)
{
if (!enabled && m_enabled) {
m_queue.clear();
// Reset the RF section
m_rfState = RS_RF_LISTENING;
m_rfTimeout.stop();
m_rfData.reset();
// Reset the networking section
m_netTimeout.stop();
m_networkWatchdog.stop();
m_netData.reset();
m_netState = RS_NET_IDLE;
}
m_enabled = enabled;
}