mirror of https://github.com/g4klx/MMDVM.git
Simplify the POCSAG calibration code.
This commit is contained in:
parent
0a634b1223
commit
000da1889f
|
@ -29,8 +29,7 @@ const q15_t sine600Hz[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
CCalPOCSAG::CCalPOCSAG() :
|
CCalPOCSAG::CCalPOCSAG() :
|
||||||
m_state(POCSAGCAL_IDLE),
|
m_state(POCSAGCAL_IDLE)
|
||||||
m_audioSeq(0U)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,22 +39,14 @@ void CCalPOCSAG::process()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint16_t space = io.getSpace();
|
uint16_t space = io.getSpace();
|
||||||
if (space == 0U)
|
if (space <= 205U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
q15_t samples[200U];
|
io.write(STATE_POCSAG, sine600Hz, 40U);
|
||||||
uint16_t length = 0U;
|
io.write(STATE_POCSAG, sine600Hz, 40U);
|
||||||
|
io.write(STATE_POCSAG, sine600Hz, 40U);
|
||||||
if (space > 200U)
|
io.write(STATE_POCSAG, sine600Hz, 40U);
|
||||||
space = 200U;
|
io.write(STATE_POCSAG, sine600Hz, 40U);
|
||||||
|
|
||||||
for (uint16_t i = 0U; i < space; i++, length++) {
|
|
||||||
samples[i] = sine600Hz[m_audioSeq++];
|
|
||||||
if (m_audioSeq >= 40U)
|
|
||||||
m_audioSeq = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
io.write(STATE_POCSAG, samples, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CCalPOCSAG::write(const uint8_t* data, uint8_t length)
|
uint8_t CCalPOCSAG::write(const uint8_t* data, uint8_t length)
|
||||||
|
@ -63,14 +54,7 @@ uint8_t CCalPOCSAG::write(const uint8_t* data, uint8_t length)
|
||||||
if (length != 1U)
|
if (length != 1U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
bool on = data[0U] == 1U;
|
m_state = data[0U] == 1U ? POCSAGCAL_TX : POCSAGCAL_IDLE;
|
||||||
|
|
||||||
if (on && m_state == POCSAGCAL_IDLE) {
|
|
||||||
m_state = POCSAGCAL_TX;
|
|
||||||
m_audioSeq = 0U;
|
|
||||||
} else if (!on && m_state == POCSAGCAL_TX) {
|
|
||||||
m_state = POCSAGCAL_IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
POCSAGCAL m_state;
|
POCSAGCAL m_state;
|
||||||
uint8_t m_audioSeq;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue