scmd,rcmd in inputs may contain not only cmd but values, minimal dimmers volume treshhold for ON command, remote command execute on MQTT command (new Cmd.h required), bat-files to flash DUE and start CLI added

This commit is contained in:
2018-05-25 09:29:47 +03:00
parent b8861d895a
commit 8e38095177
10 changed files with 154 additions and 144 deletions

View File

@@ -19,17 +19,17 @@ e-mail anklimov@gmail.com
*/
#include "options.h"
#define CH_DIMMER 0 //DMX 1 ch
#define CH_DIMMER 0 //DMX 1 ch
#define CH_RGBW 1 //DMX 4 ch
#define CH_RGB 2 //DMX 3 ch
#define CH_PWM 3 //PWM output directly to PIN
#define CH_MODBUS 4 //Modbus AC Dimmer
#define CH_THERMO 5 //Simple ON/OFF thermostat
#define CH_THERMO 5 //Simple ON/OFF thermostat
#define CH_RELAY 6 //ON_OFF relay output
#define CH_GROUP 7 //Group pseudochannel
#define CH_VCTEMP 8 //Vacom PID regulator
#define CH_VC 9 //Vacom modbus motor regulator
#define CH_WHITE 127//
#define CH_VC 9 //Vacom modbus motor regulator
#define CH_WHITE 127//
#define CMD_ON 1
#define CMD_OFF 2
@@ -42,7 +42,7 @@ e-mail anklimov@gmail.com
#define CMD_REPORT 32
#define I_TYPE 0 //Type of item
#define I_ARG 1 //Chanel-type depended argument or array of arguments (pin, address etc)
#define I_ARG 1 //Chanel-type depended argument or array of arguments (pin, address etc)
#define I_VAL 2 //Latest preset (int or array of presets)
#define I_CMD 3 //Latest CMD received
#define I_EXT 4 //Chanell-depended extension - array
@@ -50,22 +50,22 @@ e-mail anklimov@gmail.com
#include "aJSON.h"
extern aJsonObject *items;
int txt2cmd (char * payload);
typedef union
typedef union
{
long int aslong;
struct
{
int16_t h;
int8_t s;
int8_t v;
int8_t v;
};
} HSVstore;
typedef union
typedef union
{
long int aslong;
struct
@@ -73,21 +73,23 @@ typedef union
int8_t r;
int8_t g;
int8_t b;
int8_t v;
int8_t v;
};
} RGBVstore;
class Item
class Item
{
public:
aJsonObject *itemArr, *itemArg,*itemVal;
uint8_t itemType;
Item(char * name);
Item(aJsonObject * obj);
boolean isValid ();
virtual int Ctrl(short cmd, short n=0, int * Parameters=NULL, boolean send=true);
virtual int Ctrl(char * payload, boolean send=true);
int getArg(short n=0);
boolean getEnableCMD(int delta);
//int getVal(short n); //From VAL array. Negative if no array
@@ -102,8 +104,8 @@ class Item
inline int Toggle(){Ctrl(CMD_TOGGLE);};
int Poll();
int SendStatus(short cmd, short n=0, int * Par=NULL, boolean deferred = false);
protected:
protected:
int VacomSetFan (int8_t val, int8_t cmd=0);
int VacomSetHeat(int addr, int8_t val, int8_t cmd=0);
int modbusDimmerSet(int addr, uint16_t _reg, int _mask, uint16_t value);
@@ -131,7 +133,7 @@ class PooledItem : public Item
int PoolingInterval;
unsigned long next;
virtual int Pool() =0;
};
@@ -143,7 +145,7 @@ class Vacon : public Item
public:
int Pool ();
virtual int Ctrl(short cmd, short n=0, int * Par=NULL);
protected:
protected:
};
*/