From 55b087ba7745e56c7bb9194df3eaeac929c1277d Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Wed, 23 Aug 2023 19:01:47 +0200 Subject: [PATCH 1/3] change rf24Power names --- src/web/html/setup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 536cf2ca..55bd964a 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -778,10 +778,10 @@ ml("div", {class: "col-12 col-sm-3 my-2"}, "Power Level"), ml("div", {class: "col-12 col-sm-9"}, sel("rf24Power", [ - [0, "MIN"], + [0, "MIN (recommended)"], [1, "LOW"], [2, "HIGH"], - [3, "MAX"] + [3, "MAX (experimental)"] ], obj["power_level"]) ) ]) From df2b0120933a8841d5a03ff319ae615aa81424fc Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Thu, 24 Aug 2023 14:02:13 +0200 Subject: [PATCH 2/3] NRF signal quality aprox --- src/hm/hmRadio.h | 11 ++++++++++- src/web/RestApi.h | 3 +++ src/web/html/system.html | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index 583479e8..dc282910 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -21,7 +21,7 @@ #define ALL_FRAMES 0x80 #define SINGLE_FRAME 0x81 -const char* const rf24AmpPowerNames[] = {"MIN", "LOW", "HIGH", "MAX"}; +const char* const rf24AmpPowerNames[] = {"MIN (recommended)", "LOW", "HIGH", "MAX (experimental)"}; //----------------------------------------------------------------------------- @@ -205,6 +205,7 @@ class HmRadio { } cnt++; } + sendPacket(invId, cnt, isRetransmit, isNoMI); } @@ -239,6 +240,14 @@ class HmRadio { return mNrf24.isPVariant(); } + bool goodSignal(void) { + bool goodSignal = mNrf24.testRPD(); + DPRINT(DBG_INFO, F("NRF Signal: ")); + DPRINT(DBG_INFO, String(goodSignal)); + mNrf24.read(0,0); + return goodSignal; + } + std::queue mBufCtrl; uint32_t mSendCnt; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index a0a457d1..4fb4b53f 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -502,6 +502,7 @@ class RestApi { obj[F("isconnected")] = mRadio->isChipConnected(); obj[F("DataRate")] = mRadio->getDataRate(); obj[F("isPVariant")] = mRadio->isPVariant(); + obj[F("goodSignal")] = mRadio->goodSignal(); obj[F("en")] = (bool) mConfig->nrf.enabled; } @@ -570,6 +571,8 @@ class RestApi { warn.add(F("reboot your ESP to apply all your configuration changes")); if(0 == mApp->getTimestamp()) warn.add(F("time not set. No communication to inverter possible")); + + /*if(0 == mSys->getNumInverters()) warn.add(F("no inverter configured"));*/ diff --git a/src/web/html/system.html b/src/web/html/system.html index 0f1df319..4ab63931 100644 --- a/src/web/html/system.html +++ b/src/web/html/system.html @@ -50,7 +50,7 @@ } function parseRadio(obj, stat) { - const pa = ["MIN", "LOW", "HIGH", "MAX"]; + const pa = ["MIN (recommended)", "LOW", "HIGH", "MAX"]; const datarate = ["1 MBps", "2 MBps", "250 kbps"]; var main = document.getElementById("radio"); @@ -61,6 +61,7 @@ main.appendChild(h); main.appendChild(genTabRow("nrf24l01" + (obj["isPVariant"] ? "+ " : ""), (obj["isconnected"] ? "is connected " : "is not connected "))); + main.appendChild(genTabRow("NRF Signal: ", (obj["goodSignal"] ? "Strong signal > 64dBm" : "Weak signal < 64dBm"))); if(obj["isconnected"]) { main.appendChild(genTabRow("Datarate", datarate[obj["DataRate"]])); From 55868e10903c7aa8a10ba024560ef5ec5881e4a9 Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Sat, 26 Aug 2023 18:03:38 +0200 Subject: [PATCH 3/3] Update some lines, remove dbg --- src/hm/hmRadio.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index dc282910..3c4fc29d 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -21,7 +21,7 @@ #define ALL_FRAMES 0x80 #define SINGLE_FRAME 0x81 -const char* const rf24AmpPowerNames[] = {"MIN (recommended)", "LOW", "HIGH", "MAX (experimental)"}; +const char* const rf24AmpPowerNames[] = {"MIN", "LOW", "HIGH", "MAX"}; //----------------------------------------------------------------------------- @@ -240,10 +240,13 @@ class HmRadio { return mNrf24.isPVariant(); } + /* Test whether a signal (carrier or otherwise) greater than or equal to -64dBm is present on the channel. + Valid only on nRF24L01P (+) hardware. On nRF24L01, use testCarrier(). + Useful to check for interference on the current channel and channel hopping strategies. + bool goodSignal = radio.testRPD(); + if(radio.available()){ Serial.println(goodSignal ? "Strong signal > 64dBm" : "Weak signal < 64dBm" ); radio.read(0,0); } */ bool goodSignal(void) { bool goodSignal = mNrf24.testRPD(); - DPRINT(DBG_INFO, F("NRF Signal: ")); - DPRINT(DBG_INFO, String(goodSignal)); mNrf24.read(0,0); return goodSignal; }