Add the default constructors to gateway sketches

This commit is contained in:
Henrik Ekblad
2015-03-09 22:58:05 +01:00
parent ec5e64b6bf
commit 7e6aa8bda8
4 changed files with 26 additions and 4 deletions
+1
View File
@@ -31,6 +31,7 @@
#define RF24_CE_PIN 9
#define RF24_CS_PIN 10
#define RF24_PA_LEVEL RF24_PA_MAX
#define RF24_PA_LEVEL_GW RF24_PA_LOW
#define RF24_CHANNEL 76 //RF channel for the sensor net, 0-127
#define RF24_DATARATE RF24_250KBPS //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
#define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
@@ -43,6 +43,8 @@
#include <DigitalIO.h> // This include can be removed when using UIPEthernet module
#include <SPI.h>
#include <MySigningDriverNone.h>
#include <MyRFDriverNRF24.h>
#include <MyParserSerial.h>
#include <MySensor.h>
#include <stdarg.h>
@@ -69,8 +71,12 @@
#define RADIO_TX_LED_PIN 9 // the PCB, on board LED
MySensor gw;
// NRFRF24L01 radio driver (set low transmit power by default)
MyRFDriverNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
// Message signing driver (none default)
MySigningDriverNone signer;
// Construct MySensors library
MySensor gw(radio, signer);
#define IP_PORT 5003 // The port you want to open
IPAddress myIp (192, 168, 178, 66); // Configure your static ip-address here COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
@@ -56,6 +56,8 @@ http://forum.mysensors.org/topic/303/mqtt-broker-gateway
*/
#include <MySigningDriverNone.h>
#include <MyRFDriverNRF24.h>
#include <SPI.h>
#include <MySensor.h>
#include <MsTimer2.h>
@@ -89,7 +91,13 @@ uint8_t TCP_MAC[] = { 0x02, 0xDE, 0xAD, 0x00, 0x00, 0x42 }; // Mac-address - You
//////////////////////////////////////////////////////////////////
MySensor gw;
// NRFRF24L01 radio driver (set low transmit power by default)
MyRFDriverNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
// Message signing driver (none default)
MySigningDriverNone signer;
// Construct MySensors library
MySensor gw(radio, signer);
EthernetServer server = EthernetServer(TCP_PORT);
MyMessage msg;
char convBuf[MAX_PAYLOAD*2+1];
@@ -23,6 +23,8 @@
#define NO_PORTB_PINCHANGES
#include <MySigningDriverNone.h>
#include <MyRFDriverNRF24.h>
#include <SPI.h>
#include <MyParserSerial.h>
#include <MySensor.h>
@@ -38,7 +40,12 @@
#define RADIO_TX_LED_PIN 5 // the PCB, on board LED
MySensor gw;
// NRFRF24L01 radio driver (set low transmit power by default)
MyRFDriverNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
// Message signing driver (none default)
MySigningDriverNone signer;
// Construct MySensors library
MySensor gw(radio, signer);
char inputString[MAX_RECEIVE_LENGTH] = ""; // A string to hold incoming commands from serial/ethernet interface
int inputPos = 0;