Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PQT = 0 in setPromiscuous #1033

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/modules/CC1101/CC1101.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,22 @@ int16_t CC1101::setCrcFiltering(bool enable) {
}
}

int16_t CC1101::setPromiscuousMode(bool enable) {
int16_t CC1101::setPromiscuousMode(bool enable, bool requireCarrierSense) {
int16_t state = RADIOLIB_ERR_NONE;

if(this->promiscuous == enable) {
return(state);
}

if(enable) {
// Lets set PQT to 0 with Promiscuous too
// We have to set the length to set PQT, but it should get disabled with disableSyncWordFiltering()
state = setPreambleLength(16, 0);
RADIOLIB_ASSERT(state);
// disable sync word filtering and insertion
// this also disables preamble
state = disableSyncWordFiltering();
// Can enable Sync Mode with carriersense when promiscuous is enabled. Default is false: Sync Mode None
state = disableSyncWordFiltering(requireCarrierSense);
RADIOLIB_ASSERT(state);

// disable CRC filtering
Expand Down
3 changes: 2 additions & 1 deletion src/modules/CC1101/CC1101.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,10 @@ class CC1101: public PhysicalLayer {
/*!
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
\param enable Set or unset promiscuous mode.
\param defaults to false: no carriersense, true: sets carriersense above threshold
\returns \ref status_codes
*/
int16_t setPromiscuousMode(bool enable = true);
int16_t setPromiscuousMode(bool enable = true, bool requireCarrierSense = false);

/*!
\brief Get whether the modem is in promiscuous mode: no packet filtering
Expand Down
Loading