Merge pull request #101 from thozza/development
Fix for debug messages in MyTransport and removing executable bit from sources
This commit is contained in:
Executable → Regular
Executable → Regular
+3
-1
@@ -101,7 +101,9 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
|
|||||||
isGateway = _nodeId == GATEWAY_ADDRESS;
|
isGateway = _nodeId == GATEWAY_ADDRESS;
|
||||||
|
|
||||||
// Setup radio
|
// Setup radio
|
||||||
radio.init();
|
if (!radio.init()) {
|
||||||
|
debug(PSTR("radio initialization failed!"));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MY_SIGNING_FEATURE
|
#ifdef MY_SIGNING_FEATURE
|
||||||
// Read out the signing requirements from EEPROM
|
// Read out the signing requirements from EEPROM
|
||||||
|
|||||||
@@ -22,12 +22,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define debug(x,...) debugPrint(x, ##__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define debug(x,...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define AUTO 0xFF // 0-254. Id 255 is reserved for auto initialization of nodeId.
|
#define AUTO 0xFF // 0-254. Id 255 is reserved for auto initialization of nodeId.
|
||||||
#define NODE_SENSOR_ID 0xFF // Node child id is always created for when a node
|
#define NODE_SENSOR_ID 0xFF // Node child id is always created for when a node
|
||||||
|
|
||||||
@@ -45,7 +39,7 @@ public:
|
|||||||
// init()
|
// init()
|
||||||
// different parameters would be needed depending on radio module (e.g. channel, power, crc, etc.)
|
// different parameters would be needed depending on radio module (e.g. channel, power, crc, etc.)
|
||||||
// keeping these parameters as #define's in MyConfig to streamline the driver interface
|
// keeping these parameters as #define's in MyConfig to streamline the driver interface
|
||||||
virtual void init() = 0;
|
virtual bool init() = 0;
|
||||||
// setAddress(address)
|
// setAddress(address)
|
||||||
// set the node address and start listening to that address (and the broadcast address)
|
// set the node address and start listening to that address (and the broadcast address)
|
||||||
virtual void setAddress(uint8_t address) = 0;
|
virtual void setAddress(uint8_t address) = 0;
|
||||||
|
|||||||
@@ -28,13 +28,12 @@ MyTransportNRF24::MyTransportNRF24(uint8_t ce, uint8_t cs, uint8_t paLevel)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTransportNRF24::init() {
|
bool MyTransportNRF24::init() {
|
||||||
// Start up the radio library
|
// Start up the radio library
|
||||||
rf24.begin();
|
rf24.begin();
|
||||||
|
|
||||||
if (!rf24.isPVariant()) {
|
if (!rf24.isPVariant()) {
|
||||||
debug(PSTR("check wires\n"));
|
return false;
|
||||||
while(1);
|
|
||||||
}
|
}
|
||||||
rf24.setAutoAck(1);
|
rf24.setAutoAck(1);
|
||||||
rf24.setAutoAck(BROADCAST_PIPE,false); // Turn off auto ack for broadcast
|
rf24.setAutoAck(BROADCAST_PIPE,false); // Turn off auto ack for broadcast
|
||||||
@@ -48,6 +47,7 @@ void MyTransportNRF24::init() {
|
|||||||
|
|
||||||
// All nodes listen to broadcast pipe (for FIND_PARENT_RESPONSE messages)
|
// All nodes listen to broadcast pipe (for FIND_PARENT_RESPONSE messages)
|
||||||
rf24.openReadingPipe(BROADCAST_PIPE, TO_ADDR(BROADCAST_ADDRESS));
|
rf24.openReadingPipe(BROADCAST_PIPE, TO_ADDR(BROADCAST_ADDRESS));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTransportNRF24::setAddress(uint8_t address) {
|
void MyTransportNRF24::setAddress(uint8_t address) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class MyTransportNRF24 : public MyTransport
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyTransportNRF24(uint8_t ce=RF24_CE_PIN, uint8_t cs=RF24_CS_PIN, uint8_t paLevel=RF24_PA_LEVEL);
|
MyTransportNRF24(uint8_t ce=RF24_CE_PIN, uint8_t cs=RF24_CS_PIN, uint8_t paLevel=RF24_PA_LEVEL);
|
||||||
void init();
|
bool init();
|
||||||
void setAddress(uint8_t address);
|
void setAddress(uint8_t address);
|
||||||
uint8_t getAddress();
|
uint8_t getAddress();
|
||||||
bool send(uint8_t to, const void* data, uint8_t len);
|
bool send(uint8_t to, const void* data, uint8_t len);
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ MyTransportRFM69::MyTransportRFM69(uint8_t freqBand, uint8_t networkId, uint8_t
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTransportRFM69::init() {
|
bool MyTransportRFM69::init() {
|
||||||
// Start up the radio library (_address will be set later by the MySensors library)
|
// Start up the radio library (_address will be set later by the MySensors library)
|
||||||
radio.initialize(_freqBand, _address, _networkId);
|
radio.initialize(_freqBand, _address, _networkId);
|
||||||
#ifdef RFM69_ENABLE_ENCRYPTION
|
#ifdef RFM69_ENABLE_ENCRYPTION
|
||||||
radio.encrypt(ENCRYPTKEY);
|
radio.encrypt(ENCRYPTKEY);
|
||||||
#endif
|
#endif
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTransportRFM69::setAddress(uint8_t address) {
|
void MyTransportRFM69::setAddress(uint8_t address) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class MyTransportRFM69 : public MyTransport
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyTransportRFM69(uint8_t freqBand=RFM69_FREQUENCY, uint8_t networkId=RFM69_NETWORKID, uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, uint8_t interruptNum=RF69_IRQ_NUM);
|
MyTransportRFM69(uint8_t freqBand=RFM69_FREQUENCY, uint8_t networkId=RFM69_NETWORKID, uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, uint8_t interruptNum=RF69_IRQ_NUM);
|
||||||
void init();
|
bool init();
|
||||||
void setAddress(uint8_t address);
|
void setAddress(uint8_t address);
|
||||||
uint8_t getAddress();
|
uint8_t getAddress();
|
||||||
bool send(uint8_t to, const void* data, uint8_t len);
|
bool send(uint8_t to, const void* data, uint8_t len);
|
||||||
|
|||||||
Executable → Regular
Executable → Regular
Executable → Regular
Reference in New Issue
Block a user