Simplify gateway code (handles interrupts internally) and remove external dependencies. Ledmode is now always "enabled".
Remove unused libraries. Add default CS/CE pin to Config.h Add new variebles for voltage and current. Add new internal command sent to controller when gateway is ready and online
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "MySensor.h"
|
||||
|
||||
#define MAX_RECEIVE_LENGTH 100 // Max buffersize needed for messages coming from vera
|
||||
#define MAX_SEND_LENGTH 120 // Max buffersize needed for messages coming from vera
|
||||
#define MAX_RECEIVE_LENGTH 100 // Max buffersize needed for messages coming from controller
|
||||
#define MAX_SEND_LENGTH 120 // Max buffersize needed for messages destined for controller
|
||||
|
||||
class MyGateway : public MySensor
|
||||
{
|
||||
@@ -36,43 +36,27 @@ class MyGateway : public MySensor
|
||||
* @param _er Digital pin for error led
|
||||
*
|
||||
*/
|
||||
MyGateway(uint8_t _cepin=9, uint8_t _cspin=10, uint8_t _inclusion_time = 1);
|
||||
MyGateway(uint8_t _cepin, uint8_t _cspin, uint8_t _inclusion_time, uint8_t _inclusion_pin, uint8_t _rx, uint8_t _tx, uint8_t _er);
|
||||
MyGateway(uint8_t _cepin=DEFAULT_CE_PIN, uint8_t _cspin=DEFAULT_CS_PIN, uint8_t _inclusion_time = 1, uint8_t _inclusion_pin = 3, uint8_t _rx=6, uint8_t _tx=5, uint8_t _er=4);
|
||||
|
||||
/* 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_LEVEL_GW, uint8_t channel=RF24_CHANNEL, rf24_datarate_e dataRate=RF24_DATARATE, void (*dataCallback)(char *)=NULL);
|
||||
|
||||
void processRadioMessage();
|
||||
void parseAndSend(char *inputString);
|
||||
boolean isLedMode();
|
||||
void ledTimersInterrupt();
|
||||
void startInclusionInterrupt();
|
||||
|
||||
private:
|
||||
char convBuf[MAX_PAYLOAD*2+1];
|
||||
char serialBuffer[MAX_SEND_LENGTH]; // Buffer for building string when sending data to vera
|
||||
unsigned long inclusionStartTime;
|
||||
boolean inclusionMode; // Keeps track on inclusion mode
|
||||
boolean buttonTriggeredInclusion;
|
||||
volatile uint8_t countRx;
|
||||
volatile uint8_t countTx;
|
||||
volatile uint8_t countErr;
|
||||
boolean ledMode;
|
||||
boolean useWriteCallback;
|
||||
void (*dataCallback)(char *);
|
||||
|
||||
|
||||
uint8_t pinInclusion;
|
||||
uint8_t inclusionTime;
|
||||
uint8_t pinRx;
|
||||
uint8_t pinTx;
|
||||
uint8_t pinEr;
|
||||
|
||||
uint8_t h2i(char c);
|
||||
|
||||
void serial(const char *fmt, ... );
|
||||
void serial(MyMessage &msg);
|
||||
void interruptStartInclusion();
|
||||
void checkButtonTriggeredInclusion();
|
||||
void setInclusionMode(boolean newMode);
|
||||
void checkInclusionFinished();
|
||||
@@ -82,6 +66,7 @@ class MyGateway : public MySensor
|
||||
void errBlink(uint8_t cnt);
|
||||
};
|
||||
|
||||
|
||||
void ledTimersInterrupt();
|
||||
void startInclusionInterrupt();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user