Skip to content

Commit

Permalink
Merge branch 'small-changes' of https://github.com/DanielR92/ahoy int…
Browse files Browse the repository at this point in the history
…o DanielR92-small-changes
  • Loading branch information
lumapu committed Aug 27, 2023
2 parents abdf218 + 55868e1 commit eee64e7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/hm/hmRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class HmRadio {
}
cnt++;
}

sendPacket(invId, cnt, isRetransmit, isNoMI);
}

Expand Down Expand Up @@ -239,6 +240,17 @@ 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();
mNrf24.read(0,0);
return goodSignal;
}

std::queue<packet_t> mBufCtrl;

uint32_t mSendCnt;
Expand Down
3 changes: 3 additions & 0 deletions src/web/RestApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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"));*/

Expand Down
4 changes: 2 additions & 2 deletions src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
)
])
Expand Down
3 changes: 2 additions & 1 deletion src/web/html/system.html
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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"]]));
Expand Down

0 comments on commit eee64e7

Please sign in to comment.