diff --git a/src/app.cpp b/src/app.cpp index 380860fa..8834ea25 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -61,22 +61,20 @@ void app::setup() { mMiPayload.enableSerialDebug(mConfig->serial.debug); mMiPayload.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1)); - if(!mNrfRadio.isChipConnected()) - DPRINTLN(DBG_WARN, F("WARNING! your NRF24 module can't be reached, check the wiring")); - } - //if(mConfig->cmt.enabled) { + #if defined(ESP32) mHmsPayload.setup(this, &mSys, &mCmtRadio, &mStat, 5, &mTimestamp); mHmsPayload.enableSerialDebug(mConfig->serial.debug); mHmsPayload.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1)); - //} - + #endif /*DBGPRINTLN("--- after payload"); DBGPRINTLN(String(ESP.getFreeHeap())); DBGPRINTLN(String(ESP.getHeapFragmentation())); DBGPRINTLN(String(ESP.getMaxFreeBlockSize()));*/ - //if (!mSys.Radio.isChipConnected()) - // DPRINTLN(DBG_WARN, F("WARNING! your NRF24 module can't be reached, check the wiring")); + if(mConfig->nrf.enabled) { + if (!mSys.Radio.isChipConnected()) + DPRINTLN(DBG_WARN, F("WARNING! your NRF24 module can't be reached, check the wiring")); + } // when WiFi is in client mode, then enable mqtt broker #if !defined(AP_ONLY) @@ -371,10 +369,12 @@ void app::tickMidnight(void) { //----------------------------------------------------------------------------- void app::tickSend(void) { - /*if(!mNrfRadio.isChipConnected()) { - DPRINTLN(DBG_WARN, F("NRF24 not connected!")); - return; - }*/ + if(mConfig->nrf.enabled) { + if(!mNrfRadio.isChipConnected()) { + DPRINTLN(DBG_WARN, F("NRF24 not connected!")); + return; + } + } if (mIVCommunicationOn) { if (!mNrfRadio.mBufCtrl.empty()) { if (mConfig->serial.debug) { diff --git a/src/app.h b/src/app.h index 25fde351..24abde39 100644 --- a/src/app.h +++ b/src/app.h @@ -36,11 +36,13 @@ #define ASIN(x) (degrees(asin(x))) #define ACOS(x) (degrees(acos(x))) -typedef CmtRadio> CmtRadioType; typedef HmSystem HmSystemType; typedef HmPayload> PayloadType; typedef MiPayload> MiPayloadType; +#ifdef ESP32 +typedef CmtRadio> CmtRadioType; typedef HmsPayload HmsPayloadType; +#endif typedef Web WebType; typedef RestApi> RestApiType; typedef PubMqtt PubMqttType; @@ -66,9 +68,11 @@ class app : public IApp, public ah::Scheduler { mNrfRadio.handleIntr(); } + #ifdef ESP32 void handleHmsIntr(void) { mCmtRadio.handleIntr(); } + #endif uint32_t getUptime() { return Scheduler::getUptime(); @@ -299,7 +303,6 @@ class app : public IApp, public ah::Scheduler { HmSystemType mSys; HmRadio<> mNrfRadio; - CmtRadioType mCmtRadio; bool mShowRebootRequest; bool mIVCommunicationOn; @@ -309,8 +312,11 @@ class app : public IApp, public ah::Scheduler { RestApiType mApi; PayloadType mPayload; MiPayloadType mMiPayload; - HmsPayloadType mHmsPayload; PubSerialType mPubSerial; + #ifdef ESP32 + CmtRadioType mCmtRadio; + HmsPayloadType mHmsPayload; + #endif char mVersion[12]; settings mSettings; diff --git a/src/defines.h b/src/defines.h index 93722b6c..916977d2 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 6 -#define VERSION_PATCH 9 +#define VERSION_PATCH 10 //------------------------------------- typedef struct { diff --git a/src/main.cpp b/src/main.cpp index f780a002..c7d2a52d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,9 +14,11 @@ IRAM_ATTR void handleIntr(void) { } //----------------------------------------------------------------------------- +#ifdef ESP32 IRAM_ATTR void handleHmsIntr(void) { myApp.handleHmsIntr(); } +#endif //----------------------------------------------------------------------------- void setup() { @@ -26,10 +28,12 @@ void setup() { if(DEF_PIN_OFF != myApp.getNrfIrqPin()) attachInterrupt(digitalPinToInterrupt(myApp.getNrfIrqPin()), handleIntr, FALLING); } + #ifdef ESP32 if(myApp.getCmtEnabled()) { if(DEF_PIN_OFF != myApp.getCmtIrqPin()) attachInterrupt(digitalPinToInterrupt(myApp.getCmtIrqPin()), handleHmsIntr, RISING); } + #endif } diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 6f821faf..01ebde87 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -21,7 +21,7 @@
Dark Mode
-
(empty browser cache or use CTRL + F5 after reboot to apply this setting)
+
(empty browser cache or use CTRL + F5 after reboot to apply this setting)
@@ -33,7 +33,7 @@

Radio (CMT2300A)

-
+
(ESP32 only)

Serial Console

@@ -695,6 +695,16 @@ function parseNrfRadio(obj, type, system) { var e = document.getElementById("rf24"); + var en = inp("nrfEnable", null, null, ["cb"], "nrfEnable", "checkbox"); + en.checked = obj["en"]; + + e.replaceChildren ( + ml("div", {class: "row mb-3"}, [ + ml("div", {class: "col-8 col-sm-3 my-2"}, "NRF24 Enable"), + ml("div", {class: "col-4 col-sm-9"}, en) + ]) + ); + if ("ESP8266" == type) { pins = [['cs', 'pinCs'], ['ce', 'pinCe'], ['irq', 'pinIrq']]; } else { @@ -730,7 +740,7 @@ var en = inp("cmtEnable", null, null, ["cb"], "cmtEnable", "checkbox"); en.checked = obj["en"]; - e.append( + e.replaceChildren ( ml("div", {class: "row mb-3"}, [ ml("div", {class: "col-8 col-sm-3 my-2"}, "CMT2300A Enable"), ml("div", {class: "col-4 col-sm-9"}, en)