mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-28 17:56:21 +02:00
fix NRF24 patch
This commit is contained in:
parent
668e3e667d
commit
58c57524fb
5 changed files with 68 additions and 42 deletions
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/RF24.cpp b/RF24.cpp
|
diff --git a/RF24.cpp b/RF24.cpp
|
||||||
index 2e500b6..af00758 100644
|
index 9e5b4a8..af00758 100644
|
||||||
--- a/RF24.cpp
|
--- a/RF24.cpp
|
||||||
+++ b/RF24.cpp
|
+++ b/RF24.cpp
|
||||||
@@ -12,228 +12,24 @@
|
@@ -12,228 +12,24 @@
|
||||||
|
@ -605,7 +605,8 @@ index 2e500b6..af00758 100644
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
-bool RF24::begin(_SPI* spiBus, rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin)
|
-bool RF24::begin(_SPI* spiBus, rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin)
|
||||||
-{
|
+bool RF24::begin(RF24_hal* _hal)
|
||||||
|
{
|
||||||
- ce_pin = _cepin;
|
- ce_pin = _cepin;
|
||||||
- csn_pin = _cspin;
|
- csn_pin = _cspin;
|
||||||
- return begin(spiBus);
|
- return begin(spiBus);
|
||||||
|
@ -616,8 +617,7 @@ index 2e500b6..af00758 100644
|
||||||
-/****************************************************************************/
|
-/****************************************************************************/
|
||||||
-
|
-
|
||||||
-bool RF24::begin(rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin)
|
-bool RF24::begin(rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin)
|
||||||
+bool RF24::begin(RF24_hal* _hal)
|
-{
|
||||||
{
|
|
||||||
- ce_pin = _cepin;
|
- ce_pin = _cepin;
|
||||||
- csn_pin = _cspin;
|
- csn_pin = _cspin;
|
||||||
+ hal = _hal;
|
+ hal = _hal;
|
||||||
|
@ -670,12 +670,17 @@ index 2e500b6..af00758 100644
|
||||||
bool RF24::_init_pins()
|
bool RF24::_init_pins()
|
||||||
{
|
{
|
||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
@@ -1028,41 +527,7 @@ bool RF24::_init_pins()
|
@@ -1028,46 +527,7 @@ bool RF24::_init_pins()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
-#if defined(RF24_LINUX)
|
-#if defined(RF24_LINUX)
|
||||||
-
|
-
|
||||||
|
- #if defined(MRAA)
|
||||||
|
- GPIO();
|
||||||
|
- gpio.begin(ce_pin, csn_pin);
|
||||||
|
- #endif
|
||||||
|
-
|
||||||
- pinMode(ce_pin, OUTPUT);
|
- pinMode(ce_pin, OUTPUT);
|
||||||
- ce(LOW);
|
- ce(LOW);
|
||||||
- delay(100);
|
- delay(100);
|
||||||
|
@ -713,7 +718,7 @@ index 2e500b6..af00758 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -1146,7 +611,7 @@ bool RF24::isChipConnected()
|
@@ -1151,7 +611,7 @@ bool RF24::isChipConnected()
|
||||||
|
|
||||||
bool RF24::isValid()
|
bool RF24::isValid()
|
||||||
{
|
{
|
||||||
|
@ -722,7 +727,7 @@ index 2e500b6..af00758 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -1670,15 +1135,8 @@ void RF24::closeReadingPipe(uint8_t pipe)
|
@@ -1675,15 +1135,8 @@ void RF24::closeReadingPipe(uint8_t pipe)
|
||||||
|
|
||||||
void RF24::toggle_features(void)
|
void RF24::toggle_features(void)
|
||||||
{
|
{
|
||||||
|
@ -740,7 +745,7 @@ index 2e500b6..af00758 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -1866,6 +1324,11 @@ uint8_t RF24::getARC(void)
|
@@ -1871,6 +1324,11 @@ uint8_t RF24::getARC(void)
|
||||||
return read_register(OBSERVE_TX) & 0x0F;
|
return read_register(OBSERVE_TX) & 0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,7 +758,7 @@ index 2e500b6..af00758 100644
|
||||||
|
|
||||||
bool RF24::setDataRate(rf24_datarate_e speed)
|
bool RF24::setDataRate(rf24_datarate_e speed)
|
||||||
diff --git a/RF24.h b/RF24.h
|
diff --git a/RF24.h b/RF24.h
|
||||||
index c029c8e..c9d612a 100644
|
index dbd32ae..74ae35d 100644
|
||||||
--- a/RF24.h
|
--- a/RF24.h
|
||||||
+++ b/RF24.h
|
+++ b/RF24.h
|
||||||
@@ -16,12 +16,7 @@
|
@@ -16,12 +16,7 @@
|
||||||
|
@ -770,7 +775,7 @@ index c029c8e..c9d612a 100644
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup PALevel Power Amplifier level
|
* @defgroup PALevel Power Amplifier level
|
||||||
@@ -115,26 +110,8 @@ typedef enum
|
@@ -115,29 +110,8 @@ typedef enum
|
||||||
class RF24
|
class RF24
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -779,15 +784,18 @@ index c029c8e..c9d612a 100644
|
||||||
-#elif defined(SPI_UART)
|
-#elif defined(SPI_UART)
|
||||||
- SPIUARTClass uspi;
|
- SPIUARTClass uspi;
|
||||||
-#endif
|
-#endif
|
||||||
+ RF24_hal *hal;
|
-
|
||||||
|
|
||||||
-#if defined(RF24_LINUX) || defined(XMEGA_D3) /* XMEGA can use SPI class */
|
-#if defined(RF24_LINUX) || defined(XMEGA_D3) /* XMEGA can use SPI class */
|
||||||
- SPI spi;
|
- SPI spi;
|
||||||
-#endif // defined (RF24_LINUX) || defined (XMEGA_D3)
|
-#endif // defined (RF24_LINUX) || defined (XMEGA_D3)
|
||||||
-#if defined(RF24_SPI_PTR)
|
-#if defined(RF24_SPI_PTR)
|
||||||
- _SPI* _spi;
|
- _SPI* _spi;
|
||||||
-#endif // defined (RF24_SPI_PTR)
|
-#endif // defined (RF24_SPI_PTR)
|
||||||
-
|
-#if defined(MRAA)
|
||||||
|
- GPIO gpio;
|
||||||
|
-#endif
|
||||||
|
+ RF24_hal *hal;
|
||||||
|
|
||||||
- rf24_gpio_pin_t ce_pin; /* "Chip Enable" pin, activates the RX or TX role */
|
- rf24_gpio_pin_t ce_pin; /* "Chip Enable" pin, activates the RX or TX role */
|
||||||
- rf24_gpio_pin_t csn_pin; /* SPI Chip select */
|
- rf24_gpio_pin_t csn_pin; /* SPI Chip select */
|
||||||
- uint32_t spi_speed; /* SPI Bus Speed */
|
- uint32_t spi_speed; /* SPI Bus Speed */
|
||||||
|
@ -798,7 +806,7 @@ index c029c8e..c9d612a 100644
|
||||||
uint8_t status; /* The status byte returned from every SPI transaction */
|
uint8_t status; /* The status byte returned from every SPI transaction */
|
||||||
uint8_t payload_size; /* Fixed size of payloads */
|
uint8_t payload_size; /* Fixed size of payloads */
|
||||||
uint8_t pipe0_reading_address[5]; /* Last address set on pipe 0 for reading. */
|
uint8_t pipe0_reading_address[5]; /* Last address set on pipe 0 for reading. */
|
||||||
@@ -143,16 +120,6 @@ private:
|
@@ -146,16 +120,6 @@ private:
|
||||||
bool _is_p0_rx; /* For keeping track of pipe 0's usage in user-triggered RX mode. */
|
bool _is_p0_rx; /* For keeping track of pipe 0's usage in user-triggered RX mode. */
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -815,7 +823,7 @@ index c029c8e..c9d612a 100644
|
||||||
/** Whether ack payloads are enabled. */
|
/** Whether ack payloads are enabled. */
|
||||||
bool ack_payloads_enabled;
|
bool ack_payloads_enabled;
|
||||||
/** The address width to use (3, 4 or 5 bytes). */
|
/** The address width to use (3, 4 or 5 bytes). */
|
||||||
@@ -195,30 +162,15 @@ public:
|
@@ -198,30 +162,15 @@ public:
|
||||||
*
|
*
|
||||||
* See [Related Pages](pages.html) for device specific information
|
* See [Related Pages](pages.html) for device specific information
|
||||||
*
|
*
|
||||||
|
@ -850,7 +858,7 @@ index c029c8e..c9d612a 100644
|
||||||
|
|
||||||
#if defined(RF24_LINUX)
|
#if defined(RF24_LINUX)
|
||||||
virtual ~RF24() {};
|
virtual ~RF24() {};
|
||||||
@@ -240,58 +192,16 @@ public:
|
@@ -243,58 +192,16 @@ public:
|
||||||
*/
|
*/
|
||||||
bool begin(void);
|
bool begin(void);
|
||||||
|
|
||||||
|
@ -861,16 +869,15 @@ index c029c8e..c9d612a 100644
|
||||||
- * @note This function assumes the `SPI::begin()` method was called before to
|
- * @note This function assumes the `SPI::begin()` method was called before to
|
||||||
- * calling this function.
|
- * calling this function.
|
||||||
- *
|
- *
|
||||||
* @warning This function is for the Arduino platforms only
|
- * @warning This function is for the Arduino platforms only
|
||||||
*
|
- *
|
||||||
- * @param spiBus A pointer or reference to an instantiated SPI bus object.
|
- * @param spiBus A pointer or reference to an instantiated SPI bus object.
|
||||||
- * The `_SPI` datatype is a "wrapped" definition that will represent
|
- * The `_SPI` datatype is a "wrapped" definition that will represent
|
||||||
- * various SPI implementations based on the specified platform.
|
- * various SPI implementations based on the specified platform.
|
||||||
- * @see Review the [Arduino support page](md_docs_arduino.html).
|
- * @see Review the [Arduino support page](md_docs_arduino.html).
|
||||||
+ * @param _hal A pointer to the device specific hardware abstraction layer
|
- *
|
||||||
*
|
- * @return same result as begin()
|
||||||
* @return same result as begin()
|
- */
|
||||||
*/
|
|
||||||
- bool begin(_SPI* spiBus);
|
- bool begin(_SPI* spiBus);
|
||||||
-
|
-
|
||||||
- /**
|
- /**
|
||||||
|
@ -880,8 +887,8 @@ index c029c8e..c9d612a 100644
|
||||||
- * @note This function assumes the `SPI::begin()` method was called before to
|
- * @note This function assumes the `SPI::begin()` method was called before to
|
||||||
- * calling this function.
|
- * calling this function.
|
||||||
- *
|
- *
|
||||||
- * @warning This function is for the Arduino platforms only
|
* @warning This function is for the Arduino platforms only
|
||||||
- *
|
*
|
||||||
- * @param spiBus A pointer or reference to an instantiated SPI bus object.
|
- * @param spiBus A pointer or reference to an instantiated SPI bus object.
|
||||||
- * The `_SPI` datatype is a "wrapped" definition that will represent
|
- * The `_SPI` datatype is a "wrapped" definition that will represent
|
||||||
- * various SPI implementations based on the specified platform.
|
- * various SPI implementations based on the specified platform.
|
||||||
|
@ -889,7 +896,8 @@ index c029c8e..c9d612a 100644
|
||||||
- * @param _cspin The pin attached to Chip Select (often labeled CSN) on the radio module.
|
- * @param _cspin The pin attached to Chip Select (often labeled CSN) on the radio module.
|
||||||
- * - For the Arduino Due board, the [Arduino Due extended SPI feature](https://www.arduino.cc/en/Reference/DueExtendedSPI)
|
- * - For the Arduino Due board, the [Arduino Due extended SPI feature](https://www.arduino.cc/en/Reference/DueExtendedSPI)
|
||||||
- * is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin.
|
- * is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin.
|
||||||
- *
|
+ * @param _hal A pointer to the device specific hardware abstraction layer
|
||||||
|
*
|
||||||
- * @see Review the [Arduino support page](md_docs_arduino.html).
|
- * @see Review the [Arduino support page](md_docs_arduino.html).
|
||||||
- *
|
- *
|
||||||
- * @return same result as begin()
|
- * @return same result as begin()
|
||||||
|
@ -904,14 +912,14 @@ index c029c8e..c9d612a 100644
|
||||||
- * @param _cspin The pin attached to Chip Select (often labeled CSN) on the radio module.
|
- * @param _cspin The pin attached to Chip Select (often labeled CSN) on the radio module.
|
||||||
- * - For the Arduino Due board, the [Arduino Due extended SPI feature](https://www.arduino.cc/en/Reference/DueExtendedSPI)
|
- * - For the Arduino Due board, the [Arduino Due extended SPI feature](https://www.arduino.cc/en/Reference/DueExtendedSPI)
|
||||||
- * is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin.
|
- * is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin.
|
||||||
- * @return same result as begin()
|
* @return same result as begin()
|
||||||
- */
|
*/
|
||||||
- bool begin(rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin);
|
- bool begin(rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin);
|
||||||
+ bool begin(RF24_hal* _hal);
|
+ bool begin(RF24_hal* _hal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the chip is connected to the SPI bus
|
* Checks if the chip is connected to the SPI bus
|
||||||
@@ -664,12 +574,12 @@ public:
|
@@ -667,12 +574,12 @@ public:
|
||||||
* This function uses much less ram than other `*print*Details()` methods.
|
* This function uses much less ram than other `*print*Details()` methods.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
|
@ -926,7 +934,17 @@ index c029c8e..c9d612a 100644
|
||||||
* cause undefined behavior.
|
* cause undefined behavior.
|
||||||
*
|
*
|
||||||
* Registers names and/or data corresponding to the index of the `encoded_details` array:
|
* Registers names and/or data corresponding to the index of the `encoded_details` array:
|
||||||
@@ -1641,6 +1551,7 @@ public:
|
@@ -704,9 +611,6 @@ public:
|
||||||
|
* | 35 | FIFO_STATUS |
|
||||||
|
* | 36 | DYNPD |
|
||||||
|
* | 37 | FEATURE |
|
||||||
|
- * | 38-39 | ce_pin |
|
||||||
|
- * | 40-41 | csn_pin |
|
||||||
|
- * | 42 | SPI speed (in MHz) or'd with (isPlusVariant << 4) |
|
||||||
|
*/
|
||||||
|
void encodeRadioDetails(uint8_t* encoded_status);
|
||||||
|
|
||||||
|
@@ -1644,6 +1548,7 @@ public:
|
||||||
* @return Returns values from 0 to 15.
|
* @return Returns values from 0 to 15.
|
||||||
*/
|
*/
|
||||||
uint8_t getARC(void);
|
uint8_t getARC(void);
|
||||||
|
@ -934,7 +952,7 @@ index c029c8e..c9d612a 100644
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the transmission @ref Datarate
|
* Set the transmission @ref Datarate
|
||||||
@@ -1893,17 +1804,6 @@ private:
|
@@ -1896,18 +1801,6 @@ private:
|
||||||
*/
|
*/
|
||||||
bool _init_pins();
|
bool _init_pins();
|
||||||
|
|
||||||
|
@ -949,16 +967,17 @@ index c029c8e..c9d612a 100644
|
||||||
- * @param mode HIGH to take this unit off the SPI bus, LOW to put it on
|
- * @param mode HIGH to take this unit off the SPI bus, LOW to put it on
|
||||||
- */
|
- */
|
||||||
- void csn(bool mode);
|
- void csn(bool mode);
|
||||||
|
-
|
||||||
/**
|
/**
|
||||||
* Set chip enable
|
* Set chip enable
|
||||||
@@ -2412,4 +2312,4 @@ private:
|
*
|
||||||
* Use `ctrl+c` to quit at any time.
|
diff --git a/RF24_hal.cpp b/RF24_hal.cpp
|
||||||
*/
|
new file mode 100644
|
||||||
|
index 0000000..3cc78e4
|
||||||
-#endif // __RF24_H__
|
--- /dev/null
|
||||||
\ No newline at end of file
|
+++ b/RF24_hal.cpp
|
||||||
+#endif // __RF24_H__
|
@@ -0,0 +1 @@
|
||||||
|
+#include "RF24_hal.h"
|
||||||
diff --git a/RF24_hal.h b/RF24_hal.h
|
diff --git a/RF24_hal.h b/RF24_hal.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..baceab3
|
index 0000000..baceab3
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.8.109 - 2024-04-09
|
||||||
|
* fix hal patch
|
||||||
|
|
||||||
|
## 0.8.108 - 2024-04-09
|
||||||
|
* point to git SHA for `NRF24` library
|
||||||
|
|
||||||
## 0.8.107 - 2024-04-08
|
## 0.8.107 - 2024-04-08
|
||||||
* fix boot loop on `reboot on midnight` feature #1542, #1599, #1566, #1571
|
* fix boot loop on `reboot on midnight` feature #1542, #1599, #1566, #1571
|
||||||
* fix German translation #1569
|
* fix German translation #1569
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 107
|
#define VERSION_PATCH 108
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
|
|
|
@ -93,8 +93,8 @@ class AhoyNetwork {
|
||||||
bool getAvailNetworks(JsonObject obj) {
|
bool getAvailNetworks(JsonObject obj) {
|
||||||
if(!mScanActive) {
|
if(!mScanActive) {
|
||||||
mScanActive = true;
|
mScanActive = true;
|
||||||
//if(NetworkState::GOT_IP != mStatus)
|
if(NetworkState::GOT_IP != mStatus)
|
||||||
// WiFi.disconnect();
|
WiFi.disconnect();
|
||||||
WiFi.scanNetworks(true, true);
|
WiFi.scanNetworks(true, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ extra_scripts =
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/esphome/ESPAsyncWebServer @ ^3.1.0
|
https://github.com/esphome/ESPAsyncWebServer @ ^3.1.0
|
||||||
https://github.com/nRF24/RF24 @ 1.4.8
|
https://github.com/nRF24/RF24.git#v1.4.8
|
||||||
|
|
||||||
paulstoffregen/Time @ ^1.6.1
|
paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.6.0
|
https://github.com/bertmelis/espMqttClient#v1.6.0
|
||||||
bblanchon/ArduinoJson @ ^6.21.3
|
bblanchon/ArduinoJson @ ^6.21.3
|
||||||
|
|
Loading…
Add table
Reference in a new issue