Skip to content

Commit

Permalink
[CC1101] PQT = 0 in setPromiscuous (#1033)
Browse files Browse the repository at this point in the history
* PQT = 0 in setPromiscuous

* Carriersense in promiscuous

* carriersense to promiscuous

* Fix explanation
  • Loading branch information
Crsarmv7l authored Mar 26, 2024
1 parent 648b455 commit b3ed84a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit b3ed84a

Please sign in to comment.