[Pager] Added optional custom frequnecy shift
This commit is contained in:
parent
4667c26448
commit
00fc7cd5b9
2 changed files with 6 additions and 4 deletions
|
@ -19,7 +19,7 @@ PagerClient::PagerClient(PhysicalLayer* phy) {
|
||||||
_readBitInstance = _phy;
|
_readBitInstance = _phy;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PagerClient::begin(float base, uint16_t speed) {
|
int16_t PagerClient::begin(float base, uint16_t speed, uint16_t shift) {
|
||||||
// calculate duration of 1 bit in us
|
// calculate duration of 1 bit in us
|
||||||
_speed = (float)speed/1000.0f;
|
_speed = (float)speed/1000.0f;
|
||||||
_bitDuration = (uint32_t)1000000/speed;
|
_bitDuration = (uint32_t)1000000/speed;
|
||||||
|
@ -32,7 +32,8 @@ int16_t PagerClient::begin(float base, uint16_t speed) {
|
||||||
uint16_t step = round(_phy->getFreqStep());
|
uint16_t step = round(_phy->getFreqStep());
|
||||||
|
|
||||||
// calculate raw frequency shift
|
// calculate raw frequency shift
|
||||||
_shift = RADIOLIB_PAGER_FREQ_SHIFT_HZ/step;
|
_shiftHz = shift;
|
||||||
|
_shift = _shiftHz/step;
|
||||||
|
|
||||||
// initialize BCH encoder
|
// initialize BCH encoder
|
||||||
encoderInit();
|
encoderInit();
|
||||||
|
@ -226,7 +227,7 @@ int16_t PagerClient::startReceive(RADIOLIB_PIN_TYPE pin, uint32_t addr, uint32_t
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set frequency deviation to 4.5 khz
|
// set frequency deviation to 4.5 khz
|
||||||
state = _phy->setFrequencyDeviation((float)RADIOLIB_PAGER_FREQ_SHIFT_HZ / 1000.0f);
|
state = _phy->setFrequencyDeviation((float)_shiftHz / 1000.0f);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// now set up the direct mode reception
|
// now set up the direct mode reception
|
||||||
|
|
|
@ -86,7 +86,7 @@ class PagerClient {
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t begin(float base, uint16_t speed);
|
int16_t begin(float base, uint16_t speed, uint16_t shift = RADIOLIB_PAGER_FREQ_SHIFT_HZ);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Method to send a tone-only alert to a destination pager.
|
\brief Method to send a tone-only alert to a destination pager.
|
||||||
|
@ -192,6 +192,7 @@ class PagerClient {
|
||||||
float _speed;
|
float _speed;
|
||||||
uint32_t _baseRaw;
|
uint32_t _baseRaw;
|
||||||
uint16_t _shift;
|
uint16_t _shift;
|
||||||
|
uint16_t _shiftHz;
|
||||||
uint16_t _bitDuration;
|
uint16_t _bitDuration;
|
||||||
uint32_t _readBatchPos;
|
uint32_t _readBatchPos;
|
||||||
uint32_t _filterAddr;
|
uint32_t _filterAddr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue