Browse Source

0.8.16

* fix crash if NRF is not enabled
pull/1262/head
lumapu 1 year ago
parent
commit
4afd63184d
  1. 3
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 19
      src/hm/hmRadio.h

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Development Changes # Development Changes
## 0.8.16 - 2023-12-09
* fix crash if NRF is not enabled
## 0.8.15 - 2023-12-09 ## 0.8.15 - 2023-12-09
* added support for opendtufusion fusion ethernet shield #886 * added support for opendtufusion fusion ethernet shield #886
* fixed range of HMS / HMT frequencies to 863 to 870 MHz #1238 * fixed range of HMS / HMT frequencies to 863 to 870 MHz #1238

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 15 #define VERSION_PATCH 16
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

19
src/hm/hmRadio.h

@ -35,16 +35,17 @@ class HmRadio : public Radio {
HmRadio() { HmRadio() {
mDtuSn = DTU_SN; mDtuSn = DTU_SN;
mIrqRcvd = false; mIrqRcvd = false;
mNrf24.reset(new RF24(CE_PIN, CS_PIN, SPI_SPEED));
} }
~HmRadio() {} ~HmRadio() {}
void setup(bool *serialDebug, bool *privacyMode, bool *printWholeTrace, uint8_t irq = IRQ_PIN, uint8_t ce = CE_PIN, uint8_t cs = CS_PIN, uint8_t sclk = SCLK_PIN, uint8_t mosi = MOSI_PIN, uint8_t miso = MISO_PIN) { void setup(bool *serialDebug, bool *privacyMode, bool *printWholeTrace, uint8_t irq = IRQ_PIN, uint8_t ce = CE_PIN, uint8_t cs = CS_PIN, uint8_t sclk = SCLK_PIN, uint8_t mosi = MOSI_PIN, uint8_t miso = MISO_PIN) {
DPRINTLN(DBG_VERBOSE, F("hmRadio.h:setup")); DPRINTLN(DBG_VERBOSE, F("hmRadio.h:setup"));
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET) #if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
// replace object
mNrfHal.init(mosi, miso, sclk, cs, ce); mNrfHal.init(mosi, miso, sclk, cs, ce);
mNrf24 = new RF24(&mNrfHal); mNrf24.reset(new RF24(&mNrfHal));
#else
mNrf24 = new RF24(CE_PIN, CS_PIN, SPI_SPEED);
#endif #endif
pinMode(irq, INPUT_PULLUP); pinMode(irq, INPUT_PULLUP);
@ -70,22 +71,22 @@ class HmRadio : public Radio {
// //
#else #else
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
mSpi = new SPIClass(HSPI); mSpi.reset(new SPIClass(HSPI));
#else #else
mSpi = new SPIClass(VSPI); mSpi.reset(new SPIClass(VSPI));
#endif #endif
mSpi->begin(sclk, miso, mosi, cs); mSpi->begin(sclk, miso, mosi, cs);
#endif #endif
#else #else
//the old ESP82xx cannot freely place their SPI pins //the old ESP82xx cannot freely place their SPI pins
mSpi = new SPIClass(); mSpi.reset(new SPIClass());
mSpi->begin(); mSpi->begin();
#endif #endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) #if defined(CONFIG_IDF_TARGET_ESP32S3)
mNrf24->begin(); mNrf24->begin();
#else #else
mNrf24->begin(mSpi, ce, cs); mNrf24->begin(mSpi.get(), ce, cs);
#endif #endif
mNrf24->setRetries(3, 15); // 3*250us + 250us and 15 loops -> 15ms mNrf24->setRetries(3, 15); // 3*250us + 250us and 15 loops -> 15ms
@ -353,8 +354,8 @@ class HmRadio : public Radio {
bool mGotLastMsg = false; bool mGotLastMsg = false;
uint32_t mMillis; uint32_t mMillis;
SPIClass* mSpi; std::unique_ptr<SPIClass> mSpi;
RF24 *mNrf24; std::unique_ptr<RF24> mNrf24;
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET) #if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
nrfHal mNrfHal; nrfHal mNrfHal;
#endif #endif

Loading…
Cancel
Save