Fix preamble detected IRQ flag (#6653)

This commit is contained in:
GUVWAF
2025-04-22 21:21:29 +02:00
committed by GitHub
parent 70ced735d9
commit b1e35cd8b3
4 changed files with 7 additions and 6 deletions

View File

@@ -247,8 +247,8 @@ template <typename T> void LR11x0Interface<T>::startReceive()
lora.setPreambleLength(preambleLength); // Solve RX ack fail after direct message sent. Not sure why this is needed. lora.setPreambleLength(preambleLength); // Solve RX ack fail after direct message sent. Not sure why this is needed.
// We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly. // We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly.
// Furthermore, we need the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving int err =
int err = lora.startReceive(RADIOLIB_LR11X0_RX_TIMEOUT_INF, RADIOLIB_IRQ_RX_DEFAULT_FLAGS, RADIOLIB_IRQ_RX_DEFAULT_MASK, 0); lora.startReceive(RADIOLIB_LR11X0_RX_TIMEOUT_INF, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS, RADIOLIB_IRQ_RX_DEFAULT_MASK, 0);
assert(err == RADIOLIB_ERR_NONE); assert(err == RADIOLIB_ERR_NONE);
RadioLibInterface::startReceive(); RadioLibInterface::startReceive();

View File

@@ -16,6 +16,9 @@
#define RADIOLIB_PIN_TYPE uint32_t #define RADIOLIB_PIN_TYPE uint32_t
// In addition to the default Rx flags, we need the PREAMBLE_DETECTED flag to detect whether we are actively receiving
#define MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS (RADIOLIB_IRQ_RX_DEFAULT_FLAGS | (1 << RADIOLIB_IRQ_PREAMBLE_DETECTED))
/** /**
* We need to override the RadioLib ArduinoHal class to add mutex protection for SPI bus access * We need to override the RadioLib ArduinoHal class to add mutex protection for SPI bus access
*/ */

View File

@@ -277,8 +277,7 @@ template <typename T> void SX126xInterface<T>::startReceive()
setStandby(); setStandby();
// We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly. // We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly.
// Furthermore, we need the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS);
int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, RADIOLIB_IRQ_RX_DEFAULT_FLAGS | RADIOLIB_IRQ_PREAMBLE_DETECTED);
if (err != RADIOLIB_ERR_NONE) if (err != RADIOLIB_ERR_NONE)
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err); LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err);
assert(err == RADIOLIB_ERR_NONE); assert(err == RADIOLIB_ERR_NONE);

View File

@@ -260,8 +260,7 @@ template <typename T> void SX128xInterface<T>::startReceive()
#endif #endif
#endif #endif
// We use the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving int err = lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS);
int err = lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_IRQ_RX_DEFAULT_FLAGS | RADIOLIB_IRQ_PREAMBLE_DETECTED);
if (err != RADIOLIB_ERR_NONE) if (err != RADIOLIB_ERR_NONE)
LOG_ERROR("SX128X startReceive %s%d", radioLibErr, err); LOG_ERROR("SX128X startReceive %s%d", radioLibErr, err);