mirror of https://github.com/g4klx/MMDVM.git
Add a watchdog for a crashed host.
This commit is contained in:
parent
62df65003b
commit
c468842e46
21
IO.cpp
21
IO.cpp
|
@ -119,7 +119,8 @@ m_ledCount(0U),
|
||||||
m_ledValue(true),
|
m_ledValue(true),
|
||||||
m_dcd(false),
|
m_dcd(false),
|
||||||
m_overflow(0U),
|
m_overflow(0U),
|
||||||
m_overcount(0U)
|
m_overcount(0U),
|
||||||
|
m_watchdog(0U)
|
||||||
{
|
{
|
||||||
::memset(m_C4FSKState, 0x00U, 70U * sizeof(q15_t));
|
::memset(m_C4FSKState, 0x00U, 70U * sizeof(q15_t));
|
||||||
::memset(m_GMSKState, 0x00U, 40U * sizeof(q15_t));
|
::memset(m_GMSKState, 0x00U, 40U * sizeof(q15_t));
|
||||||
|
@ -208,6 +209,17 @@ void CIO::process()
|
||||||
{
|
{
|
||||||
m_ledCount++;
|
m_ledCount++;
|
||||||
if (m_started) {
|
if (m_started) {
|
||||||
|
// Two seconds timeout
|
||||||
|
if (m_watchdog >= 48000U) {
|
||||||
|
if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF) {
|
||||||
|
if (m_modemState == STATE_DMR)
|
||||||
|
dmrTX.setStart(false);
|
||||||
|
m_modemState = STATE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_watchdog = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ledCount >= 24000U) {
|
if (m_ledCount >= 24000U) {
|
||||||
m_ledCount = 0U;
|
m_ledCount = 0U;
|
||||||
m_ledValue = !m_ledValue;
|
m_ledValue = !m_ledValue;
|
||||||
|
@ -358,6 +370,8 @@ void CIO::interrupt()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_rxBuffer.put(sample, control);
|
m_rxBuffer.put(sample, control);
|
||||||
|
|
||||||
|
m_watchdog++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::setDecode(bool dcd)
|
void CIO::setDecode(bool dcd)
|
||||||
|
@ -411,3 +425,8 @@ bool CIO::hasRXOverflow()
|
||||||
return m_rxBuffer.hasOverflowed();
|
return m_rxBuffer.hasOverflowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::resetWatchdog()
|
||||||
|
{
|
||||||
|
m_watchdog = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
4
IO.h
4
IO.h
|
@ -46,6 +46,8 @@ public:
|
||||||
bool hasTXOverflow();
|
bool hasTXOverflow();
|
||||||
bool hasRXOverflow();
|
bool hasRXOverflow();
|
||||||
|
|
||||||
|
void resetWatchdog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(__MBED__)
|
#if defined(__MBED__)
|
||||||
DigitalOut m_pinPTT;
|
DigitalOut m_pinPTT;
|
||||||
|
@ -79,6 +81,8 @@ private:
|
||||||
|
|
||||||
uint16_t m_overflow;
|
uint16_t m_overflow;
|
||||||
uint16_t m_overcount;
|
uint16_t m_overcount;
|
||||||
|
|
||||||
|
volatile uint32_t m_watchdog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -98,6 +98,8 @@ void CSerialPort::sendNAK(uint8_t err) const
|
||||||
|
|
||||||
void CSerialPort::getStatus() const
|
void CSerialPort::getStatus() const
|
||||||
{
|
{
|
||||||
|
io.resetWatchdog();
|
||||||
|
|
||||||
uint8_t reply[11U];
|
uint8_t reply[11U];
|
||||||
|
|
||||||
// Send all sorts of interesting internal values
|
// Send all sorts of interesting internal values
|
||||||
|
|
Loading…
Reference in New Issue