[SX127x] Only apply errata fix by a macro (#388)

This commit is contained in:
jgromes 2021-10-18 21:31:46 +02:00
parent 8579b2cb1b
commit d91c6d0712
2 changed files with 18 additions and 4 deletions

View file

@ -410,6 +410,20 @@
*/
#define RADIOLIB_CHECK_PARAMS
/*
* Uncomment to enable SX127x errata fix
* Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
* It should only be enabled if you really are observing some errata-related issue.
* Note: Disabled by default.
*/
//#define RADIOLIB_FIX_ERRATA_SX127X
#if defined(RADIOLIB_FIX_ERRATA_SX127X)
#define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
#else
#define RADIOLIB_ERRATA_SX127X(...) {}
#endif
/*
* Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
* Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.

View file

@ -324,7 +324,7 @@ int16_t SX127x::transmitDirect(uint32_t frf) {
RADIOLIB_ASSERT(state);
// apply fixes to errata
errataFix(false);
RADIOLIB_ERRATA_SX127X(false);
// start transmitting
return(setMode(SX127X_TX));
@ -344,7 +344,7 @@ int16_t SX127x::receiveDirect() {
RADIOLIB_ASSERT(state);
// apply fixes to errata
errataFix(true);
RADIOLIB_ERRATA_SX127X(true);
// start receiving
return(setMode(SX127X_RX));
@ -392,7 +392,7 @@ int16_t SX127x::startReceive(uint8_t len, uint8_t mode) {
}
// apply fixes to errata
errataFix(true);
RADIOLIB_ERRATA_SX127X(true);
// clear interrupt flags
clearIRQFlags();
@ -460,7 +460,7 @@ int16_t SX127x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
_mod->SPIsetRegValue(SX127X_REG_DIO_MAPPING_1, SX127X_DIO0_TX_DONE, 7, 6);
// apply fixes to errata
errataFix(false);
RADIOLIB_ERRATA_SX127X(false);
// clear interrupt flags
clearIRQFlags();