Browse Source

0.8.64

add `getPLOS` (NRF24 Debug)
pull/1512/head
lumapu 1 year ago
parent
commit
7f386f07df
  1. 35
      patches/RF24.patch
  2. 28
      patches/RF24_Hal.patch
  3. 2
      scripts/applyPatches.py
  4. 1
      src/defines.h
  5. 6
      src/hm/Communication.h
  6. 5
      src/hm/hmRadio.h
  7. 1
      src/hm/radio.h
  8. 9
      src/platformio.ini

35
patches/RF24.patch

@ -0,0 +1,35 @@
diff --git a/RF24.cpp b/RF24.cpp
index 9e5b4a8..a4de63c 100644
--- a/RF24.cpp
+++ b/RF24.cpp
@@ -1871,6 +1871,11 @@ uint8_t RF24::getARC(void)
return read_register(OBSERVE_TX) & 0x0F;
}
+uint8_t RF24::getPLOS(void)
+{
+ return read_register(OBSERVE_TX) & 0x0F;
+}
+
/****************************************************************************/
bool RF24::setDataRate(rf24_datarate_e speed)
diff --git a/RF24.h b/RF24.h
index dbd32ae..a3d6b52 100644
--- a/RF24.h
+++ b/RF24.h
@@ -1644,6 +1644,7 @@ public:
* @return Returns values from 0 to 15.
*/
uint8_t getARC(void);
+ uint8_t getPLOS(void);
/**
* Set the transmission @ref Datarate
@@ -2415,4 +2416,4 @@ private:
* Use `ctrl+c` to quit at any time.
*/
-#endif // __RF24_H__
\ No newline at end of file
+#endif // __RF24_H__

28
patches/RF24_Hal.patch

@ -1,5 +1,5 @@
diff --git a/RF24.cpp b/RF24.cpp
index c0cc732..b6708d9 100644
index 9e5b4a8..af00758 100644
--- a/RF24.cpp
+++ b/RF24.cpp
@@ -12,228 +12,24 @@
@ -727,7 +727,7 @@ index c0cc732..b6708d9 100644
}
/****************************************************************************/
@@ -1676,15 +1136,8 @@ void RF24::closeReadingPipe(uint8_t pipe)
@@ -1675,15 +1135,8 @@ void RF24::closeReadingPipe(uint8_t pipe)
void RF24::toggle_features(void)
{
@ -745,8 +745,20 @@ index c0cc732..b6708d9 100644
}
/****************************************************************************/
@@ -1871,6 +1324,11 @@ uint8_t RF24::getARC(void)
return read_register(OBSERVE_TX) & 0x0F;
}
+uint8_t RF24::getPLOS(void)
+{
+ return (read_register(OBSERVE_TX) >> 4) & 0x0F;
+}
+
/****************************************************************************/
bool RF24::setDataRate(rf24_datarate_e speed)
diff --git a/RF24.h b/RF24.h
index dbd32ae..f774bba 100644
index dbd32ae..74ae35d 100644
--- a/RF24.h
+++ b/RF24.h
@@ -16,12 +16,7 @@
@ -932,7 +944,15 @@ index dbd32ae..f774bba 100644
*/
void encodeRadioDetails(uint8_t* encoded_status);
@@ -1896,18 +1800,6 @@ private:
@@ -1644,6 +1548,7 @@ public:
* @return Returns values from 0 to 15.
*/
uint8_t getARC(void);
+ uint8_t getPLOS(void);
/**
* Set the transmission @ref Datarate
@@ -1896,18 +1801,6 @@ private:
*/
bool _init_pins();

2
scripts/applyPatches.py

@ -32,3 +32,5 @@ if env['PIOENV'][:22] != "opendtufusion-ethernet":
if env['PIOENV'][:13] == "opendtufusion":
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
applyPatch("RF24", "../patches/RF24_Hal.patch")
else:
applyPatch("RF24", "../patches/RF24.patch")

1
src/defines.h

@ -23,6 +23,7 @@ typedef struct {
uint8_t packet[MAX_RF_PAYLOAD_SIZE];
uint16_t millis;
uint8_t arc;
uint8_t plos;
} packet_t;
typedef enum {

6
src/hm/Communication.h

@ -137,7 +137,9 @@ class Communication : public CommQueue<> {
DBGPRINT(F("ms"));
if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) {
DBGPRINT(F(", ARC "));
DBGPRINTLN(String(q->iv->radio->getARC()));
DBGPRINT(String(q->iv->radio->getARC()));
DBGPRINT(F(", PLOS "));
DBGPRINTLN(String(q->iv->radio->getPLOS()));
} else
DBGPRINTLN("");
}
@ -291,6 +293,8 @@ class Communication : public CommQueue<> {
DBGPRINT(String(p->len));
DBGPRINT(F(", ARC "));
DBGPRINT(String(p->arc));
DBGPRINT(F(", PLOS "));
DBGPRINT(String(p->plos));
DBGPRINT(F(" |"));
if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) {
DBGPRINT(F(" CH"));

5
src/hm/hmRadio.h

@ -297,6 +297,10 @@ class HmRadio : public Radio {
return mNrf24->getARC();
}
uint8_t getPLOS(void) {
return mNrf24->getPLOS();
}
private:
inline bool getReceived(void) {
bool isLastPackage = false;
@ -312,6 +316,7 @@ class HmRadio : public Radio {
p.rssi = mNrf24->testRPD() ? -64 : -75;
p.millis = millis() - mMillis;
p.arc = mNrf24->getARC();
p.plos = mNrf24->getPLOS();
mNrf24->read(p.packet, p.len);
if (p.packet[0] != 0x00) {

1
src/hm/radio.h

@ -30,6 +30,7 @@ class Radio {
virtual bool isChipConnected(void) { return false; }
virtual bool loop(void) = 0;
virtual uint8_t getARC(void) { return 0xff; }
virtual uint8_t getPLOS(void) { return 0xff; }
void handleIntr(void) {
mIrqRcvd = true;

9
src/platformio.ini

@ -26,7 +26,7 @@ extra_scripts =
lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer
nrf24/RF24 @ 1.4.8
https://github.com/nRF24/RF24 @ 1.4.8
paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.5.0
bblanchon/ArduinoJson @ ^6.21.3
@ -195,7 +195,7 @@ board = esp32dev
lib_deps =
khoih-prog/AsyncWebServer_ESP32_W5500
khoih-prog/AsyncUDP_ESP32_W5500
nrf24/RF24 @ ^1.4.8
https://github.com/nRF24/RF24 @ ^1.4.8
paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.5.0
bblanchon/ArduinoJson @ ^6.21.3
@ -218,7 +218,7 @@ board = esp32dev
lib_deps =
khoih-prog/AsyncWebServer_ESP32_W5500
khoih-prog/AsyncUDP_ESP32_W5500
nrf24/RF24 @ ^1.4.8
https://github.com/nRF24/RF24 @ ^1.4.8
paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.5.0
bblanchon/ArduinoJson @ ^6.21.3
@ -334,6 +334,7 @@ build_flags = ${env.build_flags}
-DENABLE_MQTT
-DPLUGIN_DISPLAY
-DENABLE_HISTORY
-DSPI_HAL
-DDEF_NRF_CS_PIN=37
-DDEF_NRF_CE_PIN=38
-DDEF_NRF_IRQ_PIN=47
@ -362,6 +363,7 @@ build_flags = ${env.build_flags}
-DENABLE_MQTT
-DPLUGIN_DISPLAY
-DENABLE_HISTORY
-DSPI_HAL
-DDEF_NRF_CS_PIN=37
-DDEF_NRF_CE_PIN=38
-DDEF_NRF_IRQ_PIN=47
@ -385,6 +387,7 @@ platform = espressif32@6.5.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
build_flags = ${env.build_flags}
-DSPI_HAL
-DDEF_NRF_CS_PIN=37
-DDEF_NRF_CE_PIN=38
-DDEF_NRF_IRQ_PIN=47

Loading…
Cancel
Save