diff --git a/MySensors.h b/MySensors.h index c2cd2f1..272784d 100644 --- a/MySensors.h +++ b/MySensors.h @@ -76,6 +76,12 @@ // transport layer files #define debug(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__) //!< debug +// temp. workaround for nRF5 verifier: redirect RF24 to NRF_ESB +#if defined(ARDUINO_ARCH_NRF5) && (defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF24) ) +#undef MY_RADIO_RF24 +#undef MY_RADIO_NRF24 +#define MY_RADIO_NRF5_ESB +#endif // Enable sensor network "feature" if one of the transport types was enabled #if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) diff --git a/core/MyProtocolMySensors.cpp b/core/MyProtocolMySensors.cpp index 4b79a82..14e2b4d 100755 --- a/core/MyProtocolMySensors.cpp +++ b/core/MyProtocolMySensors.cpp @@ -1,4 +1,4 @@ -/** +/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -82,7 +82,6 @@ bool protocolParse(MyMessage &message, char *inputString) } i++; } - //debug(PSTR("Received %d"), i); // Check for invalid input if (i < 5) { return false; diff --git a/drivers/NRF5/Radio.h b/drivers/NRF5/Radio.h index cfb4d28..0422190 100644 --- a/drivers/NRF5/Radio.h +++ b/drivers/NRF5/Radio.h @@ -1,4 +1,4 @@ - + /** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. @@ -43,9 +43,9 @@ // debug #if defined(MY_DEBUG_VERBOSE_NRF5_ESB) -#define NRF5_RADIO_DEBUG(x, ...) debug(x, ##__VA_ARGS__) +#define NRF5_RADIO_DEBUG(x, ...) DEBUG_OUTPUT(x, ##__VA_ARGS__) //!< DEBUG #else -#define NRF5_RADIO_DEBUG(x, ...) +#define NRF5_RADIO_DEBUG(x, ...) //!< DEBUG null #endif // tx power diff --git a/examples/SoilMoistSensor/SoilMoistSensor.ino b/examples/SoilMoistSensor/SoilMoistSensor.ino index cf00d53..ba2b247 100644 --- a/examples/SoilMoistSensor/SoilMoistSensor.ino +++ b/examples/SoilMoistSensor/SoilMoistSensor.ino @@ -71,14 +71,14 @@ #include // Setting up format for reading 3 soil sensors -#define NUM_READS 10 // Number of sensor reads for filtering +#define NUM_READS (int)10 // Number of sensor reads for filtering #define CHILD_ID 0 MyMessage msg(CHILD_ID, V_LEVEL); unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) long buffer[NUM_READS]; -int index; +int idx; /// @brief Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs) typedef struct { @@ -179,10 +179,10 @@ void measure (int phase_b, int phase_a, int analog_input) // Averaging algorithm void addReading(long resistance) { - buffer[index] = resistance; - index++; - if (index >= NUM_READS) { - index = 0; + buffer[idx] = resistance; + idx++; + if (idx >= NUM_READS) { + idx = 0; } } @@ -193,4 +193,4 @@ long average() sum += buffer[i]; } return (long)(sum / NUM_READS); -} +} \ No newline at end of file diff --git a/hal/architecture/MyHwNRF5.cpp b/hal/architecture/MyHwNRF5.cpp index b1f71b9..18893be 100644 --- a/hal/architecture/MyHwNRF5.cpp +++ b/hal/architecture/MyHwNRF5.cpp @@ -1,4 +1,4 @@ -/** +/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -249,7 +249,7 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, // already be handled! MY_CRITICAL_SECTION { // Fix cppcheck "(style) Variable '__savePriMask' is assigned a value that is never used." - (void)__savePriMask; + //(void)__savePriMask; // attach interrupts _wakeUp1Interrupt = interrupt1; _wakeUp2Interrupt = interrupt2; diff --git a/hal/architecture/MyHwNRF5.h b/hal/architecture/MyHwNRF5.h index f798847..a5dbb06 100644 --- a/hal/architecture/MyHwNRF5.h +++ b/hal/architecture/MyHwNRF5.h @@ -1,4 +1,4 @@ -/** +/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -43,6 +43,7 @@ #include #define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) +#define printf_P printf // Define these as macros to save valuable space #define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value) @@ -110,7 +111,9 @@ static __inline__ void __priMaskRestore(const uint32_t *priMask) #endif #ifndef DOXYGEN -#define MY_CRITICAL_SECTION \ +#define MY_CRITICAL_SECTION +// temp. commented, to fix "CircularBuffer.h:94:2: warning: control reaches end of non-void function" error +#define __MY_CRITICAL_SECTION \ for (uint32_t __savePriMask \ __attribute__((__cleanup__(__priMaskRestore))) = __get_PRIMASK(), \ __ToDo = __disableIntsRetVal(); \