mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2026-02-18 21:34:51 +01:00
Adding original MMDVM watchdog and LED functions
This commit is contained in:
parent
7d40e245bd
commit
e04551979d
|
|
@ -331,7 +331,6 @@ void CIO::setTX()
|
|||
|
||||
// PTT pin on
|
||||
PTT_pin(HIGH);
|
||||
LED_pin(LOW);
|
||||
}
|
||||
|
||||
//======================================================================================================================
|
||||
|
|
@ -350,7 +349,6 @@ void CIO::setRX()
|
|||
|
||||
// PTT pin off
|
||||
PTT_pin(LOW);
|
||||
LED_pin(HIGH);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
39
IO.cpp
39
IO.cpp
|
|
@ -32,7 +32,10 @@ uint8_t m_power;
|
|||
CIO::CIO():
|
||||
m_started(false),
|
||||
m_rxBuffer(RX_RINGBUFFER_SIZE),
|
||||
m_txBuffer(TX_RINGBUFFER_SIZE)
|
||||
m_txBuffer(TX_RINGBUFFER_SIZE),
|
||||
m_ledCount(0U),
|
||||
m_ledValue(true),
|
||||
m_watchdog(0U)
|
||||
{
|
||||
Init();
|
||||
|
||||
|
|
@ -57,6 +60,33 @@ m_txBuffer(TX_RINGBUFFER_SIZE)
|
|||
void CIO::process()
|
||||
{
|
||||
uint8_t bit;
|
||||
|
||||
m_ledCount++;
|
||||
|
||||
if (m_started) {
|
||||
// Two seconds timeout
|
||||
if (m_watchdog >= 19200U) {
|
||||
if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25) {
|
||||
m_modemState = STATE_IDLE;
|
||||
setMode();
|
||||
}
|
||||
|
||||
m_watchdog = 0U;
|
||||
}
|
||||
|
||||
if (m_ledCount >= 24000U) {
|
||||
m_ledCount = 0U;
|
||||
m_ledValue = !m_ledValue;
|
||||
LED_pin(m_ledValue);
|
||||
}
|
||||
} else {
|
||||
if (m_ledCount >= 240000U) {
|
||||
m_ledCount = 0U;
|
||||
m_ledValue = !m_ledValue;
|
||||
LED_pin(m_ledValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch off the transmitter if needed
|
||||
if (m_txBuffer.getData() == 0U && m_tx) {
|
||||
|
|
@ -108,6 +138,8 @@ void CIO::interrupt()
|
|||
|
||||
m_rxBuffer.put(bit);
|
||||
}
|
||||
|
||||
m_watchdog++;
|
||||
}
|
||||
|
||||
void CIO::start()
|
||||
|
|
@ -185,3 +217,8 @@ void CIO::setDecode(bool dcd)
|
|||
|
||||
m_dcd = dcd;
|
||||
}
|
||||
|
||||
void CIO::resetWatchdog()
|
||||
{
|
||||
m_watchdog = 0U;
|
||||
}
|
||||
|
|
|
|||
7
IO.h
7
IO.h
|
|
@ -47,9 +47,11 @@ public:
|
|||
bool SREAD_pin(void);
|
||||
void SLE_pin(bool on);
|
||||
bool RXD_pin(void);
|
||||
|
||||
#if defined(BIDIR_DATA_PIN)
|
||||
void RXD_pin_write(bool on);
|
||||
#endif
|
||||
|
||||
void TXD_pin(bool on);
|
||||
void PTT_pin(bool on);
|
||||
void LED_pin(bool on);
|
||||
|
|
@ -60,6 +62,7 @@ public:
|
|||
void P25_pin(bool on);
|
||||
void COS_pin(bool on);
|
||||
void interrupt(void);
|
||||
void resetWatchdog(void);
|
||||
|
||||
#if defined(BIDIR_DATA_PIN)
|
||||
void Data_dir_out(bool dir);
|
||||
|
|
@ -94,6 +97,10 @@ private:
|
|||
bool m_started;
|
||||
CBitRB m_rxBuffer;
|
||||
CBitRB m_txBuffer;
|
||||
|
||||
uint32_t m_ledCount;
|
||||
bool m_ledValue;
|
||||
volatile uint32_t m_watchdog;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const uint8_t MMDVM_DEBUG3 = 0xF3U;
|
|||
const uint8_t MMDVM_DEBUG4 = 0xF4U;
|
||||
const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||
|
||||
const uint8_t HARDWARE[] = "MMDVM 20161213-HS (D-Star/DMR/YSF/P25)";
|
||||
const uint8_t HARDWARE[] = "MMDVM-HS 20170210 (D-Star/DMR/YSF/P25)";
|
||||
|
||||
const uint8_t PROTOCOL_VERSION = 1U;
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ void CSerialPort::sendNAK(uint8_t err)
|
|||
|
||||
void CSerialPort::getStatus()
|
||||
{
|
||||
//io.resetWatchdog();
|
||||
io.resetWatchdog();
|
||||
|
||||
uint8_t reply[15U];
|
||||
|
||||
|
|
@ -212,8 +212,6 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
if (colorCode > 15U)
|
||||
return 4U;
|
||||
|
||||
// uint8_t dmrDelay = data[7U];
|
||||
|
||||
m_modemState = modemState;
|
||||
|
||||
m_dstarEnable = dstarEnable;
|
||||
|
|
|
|||
Loading…
Reference in a new issue