From 132c2b3b82982cf4a93ac3e65694abb59ad6f8cf Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 15 Dec 2022 17:37:41 +0100 Subject: [PATCH] Fixed inversion logic and inverted frame sync word (#641) --- src/protocols/Pager/Pager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/protocols/Pager/Pager.cpp b/src/protocols/Pager/Pager.cpp index 086dcf38..72a6ab59 100644 --- a/src/protocols/Pager/Pager.cpp +++ b/src/protocols/Pager/Pager.cpp @@ -235,7 +235,11 @@ int16_t PagerClient::startReceive(RADIOLIB_PIN_TYPE pin, uint32_t addr, uint32_t // now set up the direct mode reception Module* mod = _phy->getMod(); mod->pinMode(pin, INPUT); - _phy->setDirectSyncWord(RADIOLIB_PAGER_FRAME_SYNC_CODE_WORD, 32); + if(inv) { + _phy->setDirectSyncWord(~RADIOLIB_PAGER_FRAME_SYNC_CODE_WORD, 32); + } else { + _phy->setDirectSyncWord(RADIOLIB_PAGER_FRAME_SYNC_CODE_WORD, 32); + } _phy->setDirectAction(PagerClientReadBit); _phy->receiveDirect(); @@ -445,7 +449,7 @@ void PagerClient::write(uint32_t codeWord) { } // finally, check if inversion is enabled - if(inv) { + if(!inv) { change = -change; }