Added the forgotten dataRate to begin() default speed is 2MBPS
This commit is contained in:
@@ -93,7 +93,7 @@ int inputPos = 0;
|
||||
void setup()
|
||||
{
|
||||
// Initialize gateway at maximum PA level, channel 70 and callback for write operations
|
||||
gw.begin(RF24_PA_MAX, 70, writeEthernet);
|
||||
gw.begin(RF24_PA_MAX, 70, RF24_2MBPS, writeEthernet);
|
||||
|
||||
Ethernet.begin(mac, myIp);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Gateway::Gateway(uint8_t _cepin, uint8_t _cspin, uint8_t _inclusion_time, uint8_
|
||||
pinEr = _er;
|
||||
}
|
||||
|
||||
void Gateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, void (*inDataCallback)(char *)) {
|
||||
void Gateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate, void (*inDataCallback)(char *)) {
|
||||
Serial.begin(BAUD_RATE);
|
||||
|
||||
if (inDataCallback != NULL) {
|
||||
@@ -66,7 +66,7 @@ void Gateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, void (*inDataCallbac
|
||||
}
|
||||
|
||||
// Start up the radio library
|
||||
setupRadio(paLevel, channel);
|
||||
setupRadio(paLevel, channel, dataRate);
|
||||
RF24::openReadingPipe(CURRENT_NODE_PIPE, BASE_RADIO_ID);
|
||||
RF24::startListening();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Gateway : public Relay
|
||||
Gateway(uint8_t _cepin, uint8_t _cspin, uint8_t _inclusion_time, uint8_t _inclusion_pin, uint8_t _rx, uint8_t _tx, uint8_t _er);
|
||||
|
||||
/* Use this and pass a function that should be called when you want to process commands that arrive from radio network */
|
||||
void begin(rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76, void (*dataCallback)(char *)=NULL);
|
||||
void begin(rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76, rf24_datarate_e dataRate=RF24_2MBPS, void (*dataCallback)(char *)=NULL);
|
||||
|
||||
void processRadioMessage();
|
||||
void parseAndSend(char *inputString);
|
||||
|
||||
@@ -16,8 +16,8 @@ Relay::Relay(uint8_t _cepin, uint8_t _cspin) : Sensor(_cepin, _cspin) {
|
||||
}
|
||||
|
||||
|
||||
void Relay::begin(uint8_t radioId, rf24_pa_dbm_e paLevel, uint8_t channel) {
|
||||
Sensor::begin(radioId, paLevel, channel);
|
||||
void Relay::begin(uint8_t radioId, rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate) {
|
||||
Sensor::begin(radioId, paLevel, channel, dataRate);
|
||||
// Read routing table from EEPROM
|
||||
for (unsigned int i=0;i<sizeof(childNodeTable);i++) {
|
||||
childNodeTable[i] = EEPROM.read(EEPROM_ROUTES_ADDRESS+i);
|
||||
|
||||
@@ -35,11 +35,11 @@ class Relay : public Sensor
|
||||
* Creates a new instance of Relay class.
|
||||
*
|
||||
* @param _cepin The pin attached to RF24 Chip Enable on the RF module (default 9)
|
||||
* @param _cspin The pin attached to RF24 Chip Select (defualt 10)
|
||||
* @param _cspin The pin attached to RF24 Chip Select (default 10)
|
||||
*/
|
||||
Relay(uint8_t _cepin = 9, uint8_t _cspin = 10);
|
||||
|
||||
void begin(uint8_t radioId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76);
|
||||
void begin(uint8_t radioId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76, rf24_datarate_e dataRate=RF24_2MBPS);
|
||||
boolean messageAvailable();
|
||||
boolean send(message_s message, int length);
|
||||
|
||||
|
||||
+546
-546
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define DEBUG
|
||||
//#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define debug(x,...) debugPrint(x, ##__VA_ARGS__)
|
||||
@@ -129,14 +129,15 @@ class Sensor : public RF24
|
||||
Sensor(uint8_t _cepin=9, uint8_t _cspin=10);
|
||||
|
||||
/**
|
||||
* Begin operation of the sensor net library
|
||||
* Begin operation of the MySensors library
|
||||
*
|
||||
* Call this in setup(), before calling any other sensor net library methods.
|
||||
* @param radioId The unique id (1-254) for this sensor. Default 255 (auto mode).
|
||||
* @param paLevel Radio PA Level for this sensor. Default RF24_PA_MAX
|
||||
* @param channel Radio channel. Default RF24_PA_MAX
|
||||
* @param channel Radio channel. Default is channel 76
|
||||
* @param dataRate Radio transmission speed. Default RF24_2MBPS
|
||||
*/
|
||||
void begin(uint8_t radioId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76);
|
||||
void begin(uint8_t radioId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_MAX, uint8_t channel=76, rf24_datarate_e dataRate=RF24_2MBPS);
|
||||
|
||||
uint8_t getRadioId();
|
||||
|
||||
@@ -257,7 +258,7 @@ class Sensor : public RF24
|
||||
message_s msg; // Buffer for incoming messages.
|
||||
char convBuffer[20];
|
||||
|
||||
void setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel);
|
||||
void setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate);
|
||||
void findRelay();
|
||||
boolean send(message_s message, int length);
|
||||
boolean sendWrite(uint8_t dest, message_s message, int length);
|
||||
|
||||
Reference in New Issue
Block a user