mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
static ip CLI command/EEPROM saving; reconnection logic refined; new ETHERNET2 lib required
This commit is contained in:
@@ -265,7 +265,23 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
break;
|
||||
|
||||
case CMD_ON:
|
||||
if (itemType!=CH_RGBW || getCmd() != CMD_ON) {
|
||||
if (itemType==CH_RGBW && getCmd() == CMD_ON && getEnableCMD(500)) {
|
||||
Serial.println(F("Force White"));
|
||||
itemType = CH_WHITE;
|
||||
Par[1] = 0; //Zero saturation
|
||||
Par[2] = 100; //Full power
|
||||
// Store
|
||||
st.h = Par[0];
|
||||
st.s = Par[1];
|
||||
st.v = Par[2];
|
||||
setVal(st.aslong);
|
||||
//Send to OH
|
||||
if (send) SendStatus(0, 3, Par);
|
||||
break;
|
||||
} // if forcewhite
|
||||
|
||||
// if (itemType!=CH_RGBW || getCmd() != CMD_ON) {
|
||||
{
|
||||
short params = 0;
|
||||
setCmd(cmd);
|
||||
//retrive stored values
|
||||
@@ -303,8 +319,8 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
break;
|
||||
default:
|
||||
if (send) SendStatus(cmd); // Just send ON
|
||||
}//itemtype
|
||||
else {// Default settings
|
||||
}//itemtype switch
|
||||
else {// Default settings, values not stored yet
|
||||
Serial.print(st.aslong);
|
||||
Serial.println(F(": No stored values - default"));
|
||||
|
||||
@@ -323,18 +339,24 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
params = 3;
|
||||
SendStatus(0, params, Par,true);
|
||||
break;
|
||||
case CH_RELAY:
|
||||
Par[0] = 100;
|
||||
params = 1;
|
||||
if (send) SendStatus(CMD_ON);
|
||||
break;
|
||||
default:
|
||||
Par[0] = 100;
|
||||
params = 1;
|
||||
SendStatus(0, params, Par);
|
||||
}
|
||||
}
|
||||
} // default handler
|
||||
for (short i = 0; i < params; i++) {
|
||||
Serial.print(F("Restored: "));
|
||||
Serial.print(i);
|
||||
Serial.print(F("="));
|
||||
Serial.println(Par[i]);
|
||||
}
|
||||
/*
|
||||
} else { //Double ON - apply special preset - clean white full power
|
||||
if (getEnableCMD(500)) switch (itemType) {
|
||||
case CH_RGBW:
|
||||
@@ -354,10 +376,10 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
break;
|
||||
} //itemtype
|
||||
} //else
|
||||
|
||||
*/
|
||||
//Serial.print("Sa:");Serial.println(Par[1]);
|
||||
if ((itemType == CH_RGBW) && (Par[1] == 0)) itemType = CH_WHITE;
|
||||
|
||||
}
|
||||
|
||||
break; //CMD_ON
|
||||
|
||||
@@ -1084,4 +1106,3 @@ void Item::sendDelayedStatus(){
|
||||
setCmd(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved.
|
||||
*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -71,7 +66,7 @@ PWM Out
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
|
||||
@@ -86,6 +81,8 @@ EthernetClient ethClient;
|
||||
|
||||
const char outprefix[] PROGMEM = OUTTOPIC;
|
||||
const char inprefix[] PROGMEM = INTOPIC;
|
||||
const char configserver[] PROGMEM = CONFIG_SERVER;
|
||||
|
||||
|
||||
aJsonObject *root = NULL;
|
||||
aJsonObject *items = NULL;
|
||||
@@ -104,6 +101,7 @@ unsigned long nextThermostatCheck = 0;
|
||||
aJsonObject *pollingItem = NULL;
|
||||
|
||||
bool owReady = false;
|
||||
bool configOk = false;
|
||||
int lanStatus = 0;
|
||||
|
||||
#ifdef _modbus
|
||||
@@ -118,15 +116,17 @@ PubSubClient mqttClient(ethClient);
|
||||
|
||||
void watchdogSetup(void) {} //Do not remove - strong re-definition WDT Init for DUE
|
||||
|
||||
|
||||
// MQTT Callback routine
|
||||
#define MQTT_SUBJECT_LENGTH 20
|
||||
#define MQTT_TOPIC_LENGTH 20
|
||||
|
||||
|
||||
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||
payload[length] = 0;
|
||||
|
||||
Serial.print(F("\n["));
|
||||
Serial.print(topic);
|
||||
Serial.print(F("] "));
|
||||
if (!payload) return;
|
||||
payload[length] = 0;
|
||||
|
||||
int fr = freeRam();
|
||||
if (fr < 250) {
|
||||
@@ -266,15 +266,30 @@ int lanLoop() {
|
||||
switch (lanStatus) {
|
||||
//Initial state
|
||||
case 0: //Ethernet.begin(mac,ip);
|
||||
|
||||
{
|
||||
#ifdef __ESP__
|
||||
//WiFi.mode(WIFI_STA);
|
||||
//wifiMulti.addAP("Smartbox", "");
|
||||
if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
#else
|
||||
IPAddress ip;
|
||||
IPAddress dns;
|
||||
IPAddress gw;
|
||||
IPAddress mask;
|
||||
int res = 1;
|
||||
Serial.println(F("Starting lan"));
|
||||
if (loadFlash(OFFSET_IP,ip))
|
||||
if (loadFlash(OFFSET_DNS,dns))
|
||||
if (loadFlash(OFFSET_GW,gw))
|
||||
if (loadFlash(OFFSET_MASK,mask)) Ethernet.begin(mac,ip,dns,gw,mask);
|
||||
else Ethernet.begin(mac,ip,dns,gw);
|
||||
else Ethernet.begin(mac,ip,dns);
|
||||
else Ethernet.begin(mac,ip);
|
||||
else res = Ethernet.begin(mac, 12000);
|
||||
|
||||
|
||||
wdt_dis();
|
||||
if (Ethernet.begin(mac, 12000) == 0) {
|
||||
if (res == 0) {
|
||||
Serial.println(F("Failed to configure Ethernet using DHCP"));
|
||||
lanStatus = -10;
|
||||
lanCheck = millis() + 60000;
|
||||
@@ -284,12 +299,15 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
}
|
||||
wdt_en();
|
||||
wdt_res();
|
||||
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
//Have IP address
|
||||
case 1:
|
||||
|
||||
if (!configOk)
|
||||
lanStatus = getConfig(0, NULL); //got config from server or load from NVRAM
|
||||
else lanStatus = 2;
|
||||
#ifdef _artnet
|
||||
if (artnet) artnet->begin();
|
||||
#endif
|
||||
@@ -313,6 +331,7 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
if (n >= 5) password = aJson.getArrayItem(mqttArr, 4)->valuestring;
|
||||
|
||||
mqttClient.setServer(servername, port);
|
||||
mqttClient.setCallback(mqttCallback);
|
||||
|
||||
Serial.print(F("Attempting MQTT connection to "));
|
||||
Serial.print(servername);
|
||||
@@ -322,11 +341,12 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
Serial.print(user);
|
||||
Serial.print(F(" ..."));
|
||||
|
||||
wdt_dis(); //potential unsafe for ethernetIdle(), but needed to avoid cyclic reboot if mosquitto out of order
|
||||
if (mqttClient.connect(client_id, user, password)) {
|
||||
Serial.print(F("connected as "));
|
||||
Serial.println(client_id);
|
||||
|
||||
|
||||
wdt_en();
|
||||
configOk=true;
|
||||
// ... Temporary subscribe to status topic
|
||||
char buf[MQTT_TOPIC_LENGTH];
|
||||
|
||||
@@ -349,7 +369,7 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
Serial.print(mqttClient.state());
|
||||
Serial.println(F(" try again in 5 seconds"));
|
||||
lanCheck = millis() + 5000;
|
||||
lanStatus = -12;
|
||||
lanStatus = 12;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -379,7 +399,7 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
lanStatus = 0;
|
||||
break;
|
||||
//Reconnect
|
||||
case -12:
|
||||
case 12:
|
||||
if (millis() > lanCheck)
|
||||
|
||||
lanStatus = 2;
|
||||
@@ -403,9 +423,15 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
wdt_dis();
|
||||
if (lanStatus > 0)
|
||||
switch (Ethernet.maintain()) {
|
||||
case NO_LINK:
|
||||
Serial.println(F("No link"));
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
lanStatus = -10;
|
||||
break;
|
||||
case DHCP_CHECK_RENEW_FAIL:
|
||||
//renewed fail
|
||||
Serial.println(F("Error: renewed fail"));
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
lanStatus = -10;
|
||||
break;
|
||||
|
||||
@@ -416,6 +442,7 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
|
||||
case DHCP_CHECK_REBIND_FAIL:
|
||||
Serial.println(F("Error: rebind fail"));
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
lanStatus = -10;
|
||||
break;
|
||||
|
||||
@@ -530,21 +557,23 @@ void cmdFunctionHelp(int arg_cnt, char **args)
|
||||
{
|
||||
printFirmwareVersionAndBuildOptions();
|
||||
Serial.println(F("Use the commands: 'help' - this text\n"
|
||||
"'set de:ad:be:ef:fe:00' set and store MAC-address in EEPROM\n"
|
||||
"'mac de:ad:be:ef:fe:00' set and store MAC-address in EEPROM\n"
|
||||
"'ip [ip[,dns[,gw[,subnet]]]]'\n"
|
||||
"'save' - save config in NVRAM\n"
|
||||
"'get' - get config from pre-configured URL\n"
|
||||
"'get' [config addr]' - get config from pre-configured URL\n"
|
||||
"'load' - load config from NVRAM\n"
|
||||
"'kill' - test watchdog"));
|
||||
}
|
||||
|
||||
void cmdFunctionKill(int arg_cnt, char **args) {
|
||||
for (short i = 17; i > 0; i--) {
|
||||
for (short i = 1; i < 20; i++) {
|
||||
delay(1000);
|
||||
Serial.println(i);
|
||||
};
|
||||
}
|
||||
|
||||
void applyConfig() {
|
||||
if (!root) return;
|
||||
#ifdef _dmxout
|
||||
int maxChannels;
|
||||
aJsonObject *dmxoutArr = aJson.getObjectItem(root, "dmx");
|
||||
@@ -591,17 +620,19 @@ void applyConfig() {
|
||||
items = aJson.getObjectItem(root, "items");
|
||||
|
||||
// Digital output related Items initialization
|
||||
{
|
||||
pollingItem=NULL;
|
||||
if (items) {
|
||||
aJsonObject * item = items->child;
|
||||
while (items && item)
|
||||
if (item->type == aJson_Array && aJson.getArraySize(item)>1) {
|
||||
int cmd = CMD_OFF;
|
||||
int pin = aJson.getArrayItem(item, I_ARG)->valueint;
|
||||
if (aJson.getArraySize(item) > I_CMD) cmd = aJson.getArrayItem(item, I_CMD)->valueint;
|
||||
|
||||
switch (aJson.getArrayItem(item, I_TYPE)->valueint) {
|
||||
case CH_RELAY:
|
||||
Item it(item);
|
||||
if (it.isValid()) {
|
||||
int pin=it.getArg();
|
||||
int cmd = it.getCmd();
|
||||
switch (it.itemType) {
|
||||
case CH_THERMO:
|
||||
if (cmd<1) it.setCmd(CMD_OFF);
|
||||
case CH_RELAY:
|
||||
{
|
||||
int k;
|
||||
pinMode(pin, OUTPUT);
|
||||
@@ -613,11 +644,11 @@ while (items && item)
|
||||
}
|
||||
break;
|
||||
} //switch
|
||||
} //isValid
|
||||
item = item->next;
|
||||
} //if
|
||||
|
||||
}
|
||||
pollingItem = items->child;
|
||||
}
|
||||
inputs = aJson.getObjectItem(root, "in");
|
||||
mqttArr = aJson.getObjectItem(root, "mqtt");
|
||||
printConfigSummary();
|
||||
@@ -660,6 +691,7 @@ int loadConfigFromEEPROM(int arg_cnt, char **args)
|
||||
}
|
||||
Serial.println(F("Loaded"));
|
||||
applyConfig();
|
||||
ethClient.stop(); //Refresh MQTT connect to get retained info
|
||||
return 1;
|
||||
} else {
|
||||
Serial.println(F("No stored config"));
|
||||
@@ -719,6 +751,23 @@ void cmdFunctionSave(int arg_cnt, char **args)
|
||||
Serial.println(F("Saved to EEPROM"));
|
||||
}
|
||||
|
||||
void cmdFunctionIp(int arg_cnt, char **args)
|
||||
//(char* tokens)
|
||||
{ IPAddress ip0 (0,0,0,0);
|
||||
IPAddress ip;
|
||||
DNSClient dns;
|
||||
switch (arg_cnt) {
|
||||
case 5: if (dns.inet_aton(args[4],ip)) saveFlash(OFFSET_MASK,ip); else saveFlash(OFFSET_MASK,ip0);
|
||||
case 4: if (dns.inet_aton(args[3],ip)) saveFlash(OFFSET_GW,ip); else saveFlash(OFFSET_GW,ip0);
|
||||
case 3: if (dns.inet_aton(args[2],ip)) saveFlash(OFFSET_DNS,ip); else saveFlash(OFFSET_DNS,ip0);
|
||||
case 2: if (dns.inet_aton(args[1],ip)) saveFlash(OFFSET_IP,ip); else saveFlash(OFFSET_IP,ip0);
|
||||
break;
|
||||
case 1: //dynamic IP
|
||||
saveFlash(OFFSET_IP,ip0);
|
||||
}
|
||||
Serial.println(F("Saved"));
|
||||
}
|
||||
|
||||
|
||||
void cmdFunctionSetMac(int arg_cnt, char **args) {
|
||||
|
||||
@@ -741,22 +790,40 @@ void cmdFunctionSetMac(int arg_cnt, char **args) {
|
||||
}
|
||||
|
||||
void cmdFunctionGet(int arg_cnt, char **args) {
|
||||
getConfig(arg_cnt, args);
|
||||
restoreState();
|
||||
lanStatus=getConfig(arg_cnt, args);
|
||||
ethClient.stop(); //Refresh MQTT connect to get retained info
|
||||
//restoreState();
|
||||
}
|
||||
|
||||
void printBool(bool arg) { (arg) ? Serial.println(F("on")) : Serial.println(F("off")); }
|
||||
|
||||
|
||||
void saveFlash(short n, char *str) {}
|
||||
void saveFlash(short n, char *str) {
|
||||
short i;
|
||||
short len=strlen(str);
|
||||
if (len>31) len=31;
|
||||
for(int i=0;i<len;i++) EEPROM.write(n+i,str[i]);
|
||||
EEPROM.write(n+len,0);
|
||||
}
|
||||
|
||||
void loadFlash(short n, char *str) {}
|
||||
int loadFlash(short n, char *str, short l) {
|
||||
short i;
|
||||
uint8_t ch = EEPROM.read(n);
|
||||
if (!ch || (ch == 0xff)) return 0;
|
||||
for (i=0;i<l-1 && (str[i] = EEPROM.read(n++));i++);
|
||||
str[i]=0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef MY_CONFIG_SERVER
|
||||
#define CONFIG_SERVER "lazyhome.ru"
|
||||
#else
|
||||
#define CONFIG_SERVER QUOTE(MY_CONFIG_SERVER)
|
||||
#endif
|
||||
void saveFlash(short n, IPAddress& ip) {
|
||||
for(int i=0;i<4;i++) EEPROM.write(n++,ip[i]);
|
||||
}
|
||||
|
||||
int loadFlash(short n, IPAddress& ip) {
|
||||
for(int i=0;i<4;i++) ip[i]=EEPROM.read(n++);
|
||||
if (ip[0] && (ip[0] != 0xff)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getConfig(int arg_cnt, char **args)
|
||||
//(char *tokens)
|
||||
@@ -766,11 +833,12 @@ int getConfig(int arg_cnt, char **args)
|
||||
int responseStatusCode = 0;
|
||||
char ch;
|
||||
char URI[40];
|
||||
char configServer[32] = CONFIG_SERVER;
|
||||
if (arg_cnt > 0) {
|
||||
char configServer[32]="";
|
||||
if (arg_cnt > 1) {
|
||||
strncpy(configServer, args[1], sizeof(configServer) - 1);
|
||||
saveFlash(0, configServer);
|
||||
} else loadFlash(0, configServer);
|
||||
saveFlash(OFFSET_CONFIGSERVER, configServer);
|
||||
} else if (!loadFlash(OFFSET_CONFIGSERVER, configServer))
|
||||
strncpy_P(configServer,configserver,sizeof(configServer));
|
||||
|
||||
snprintf(URI, sizeof(URI), "/%02x-%02x-%02x-%02x-%02x-%02x.config.json", mac[0], mac[1], mac[2], mac[3], mac[4],
|
||||
mac[5]);
|
||||
@@ -794,8 +862,11 @@ int getConfig(int arg_cnt, char **args)
|
||||
|
||||
Serial.println(F("got Config"));
|
||||
aJsonFileStream as = aJsonFileStream(result);
|
||||
noInterrupts();
|
||||
aJson.deleteItem(root);
|
||||
root = aJson.parse(&as);
|
||||
interrupts();
|
||||
// Serial.println(F("Parsed."));
|
||||
hclient.closeStream(result); // this is very important -- be sure to close the STREAM
|
||||
|
||||
if (!root) {
|
||||
@@ -806,7 +877,7 @@ int getConfig(int arg_cnt, char **args)
|
||||
// char *outstr = aJson.print(root);
|
||||
// Serial.println(outstr);
|
||||
// free(outstr);
|
||||
|
||||
Serial.println(F("Applying."));
|
||||
applyConfig();
|
||||
|
||||
|
||||
@@ -829,11 +900,12 @@ int getConfig(int arg_cnt, char **args)
|
||||
#else
|
||||
//Non AVR code
|
||||
String response;
|
||||
|
||||
HttpClient htclient = HttpClient(ethClient, configServer, 80);
|
||||
EthernetClient configEthClient;
|
||||
HttpClient htclient = HttpClient(configEthClient, configServer, 80);
|
||||
//htclient.stop(); //_socket =MAX
|
||||
htclient.setHttpResponseTimeout(4000);
|
||||
wdt_res();
|
||||
//Serial.println("making GET request");
|
||||
//Serial.println("making GET request");get
|
||||
htclient.beginRequest();
|
||||
htclient.get(URI);
|
||||
htclient.endRequest();
|
||||
@@ -1013,9 +1085,10 @@ void setupCmdArduino() {
|
||||
cmdAdd("save", cmdFunctionSave);
|
||||
cmdAdd("load", cmdFunctionLoad);
|
||||
cmdAdd("get", cmdFunctionGet);
|
||||
cmdAdd("set", cmdFunctionSetMac);
|
||||
cmdAdd("mac", cmdFunctionSetMac);
|
||||
cmdAdd("kill", cmdFunctionKill);
|
||||
cmdAdd("req", cmdFunctionReq);
|
||||
cmdAdd("ip", cmdFunctionIp);
|
||||
}
|
||||
|
||||
void loop_main() {
|
||||
@@ -1046,7 +1119,7 @@ void loop_main() {
|
||||
}
|
||||
|
||||
|
||||
if (inputs) inputLoop();
|
||||
inputLoop();
|
||||
|
||||
#if defined (_espdmx)
|
||||
dmxout.update();
|
||||
@@ -1072,6 +1145,11 @@ void owIdle(void) {
|
||||
dmxout.update();
|
||||
#endif
|
||||
}
|
||||
void ethernetIdle(void){
|
||||
wdt_res();
|
||||
inputLoop();
|
||||
// Serial.print(".");
|
||||
};
|
||||
|
||||
void modbusIdle(void) {
|
||||
wdt_res();
|
||||
@@ -1080,8 +1158,10 @@ void modbusIdle(void) {
|
||||
#ifdef _artnet
|
||||
if (artnet) artnet->read();
|
||||
#endif
|
||||
inputLoop();
|
||||
}
|
||||
|
||||
|
||||
#ifdef _dmxin
|
||||
DMXCheck();
|
||||
#endif
|
||||
@@ -1092,6 +1172,7 @@ void modbusIdle(void) {
|
||||
}
|
||||
|
||||
void inputLoop(void) {
|
||||
if (!inputs) return;
|
||||
if (millis() > nextInputCheck) {
|
||||
aJsonObject *input = inputs->child;
|
||||
while (input) {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "item.h"
|
||||
#include "inputs.h"
|
||||
#include "FastLED.h"
|
||||
#include "Dns.h"
|
||||
//#include "hsv2rgb.h"
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
@@ -95,7 +96,7 @@
|
||||
extern Artnet *artnet;
|
||||
#endif
|
||||
|
||||
void watchdogSetup(void);
|
||||
//void watchdogSetup(void);
|
||||
|
||||
void mqttCallback(char *topic, byte *payload, unsigned int length);
|
||||
|
||||
@@ -141,9 +142,13 @@ void printBool(bool arg);
|
||||
|
||||
void saveFlash(short n, char *str);
|
||||
|
||||
void loadFlash(short n, char *str);
|
||||
int loadFlash(short n, char *str, short l=32);
|
||||
|
||||
int getConfig(int arg_cnt, char **args);
|
||||
void saveFlash(short n, IPAddress& ip);
|
||||
|
||||
int loadFlash(short n, IPAddress& ip);
|
||||
|
||||
int getConfig(int arg_cnt=0, char **args=NULL);
|
||||
|
||||
void preTransmission();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Configuration of drivers enabled
|
||||
#ifndef PIO_SRC_REV
|
||||
#define PIO_SRC_REV v0.996
|
||||
#define PIO_SRC_REV v0.997
|
||||
#endif
|
||||
|
||||
#define TXEnablePin 13
|
||||
@@ -13,7 +13,14 @@
|
||||
#define THERMO_OVERHEAT_CELSIUS 38
|
||||
#define FM_OVERHEAT_CELSIUS 40.
|
||||
|
||||
#define EEPROM_offset 32+6
|
||||
|
||||
#define OFFSET_MAC 0
|
||||
#define OFFSET_IP OFFSET_MAC+6
|
||||
#define OFFSET_DNS OFFSET_IP+4
|
||||
#define OFFSET_GW OFFSET_DNS+4
|
||||
#define OFFSET_MASK OFFSET_GW+4
|
||||
#define OFFSET_CONFIGSERVER OFFSET_MASK+4
|
||||
#define EEPROM_offset OFFSET_CONFIGSERVER+32
|
||||
|
||||
#define INTERVAL_CHECK_INPUT 50
|
||||
#define INTERVAL_CHECK_MODBUS 2000
|
||||
@@ -32,15 +39,23 @@
|
||||
#define DEFAULT_FIRMWARE_MAC {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0}
|
||||
#endif
|
||||
|
||||
#ifndef MY_CONFIG_SERVER
|
||||
#define CONFIG_SERVER "lazyhome.ru"
|
||||
#else
|
||||
#define CONFIG_SERVER QUOTE(MY_CONFIG_SERVER)
|
||||
#endif
|
||||
|
||||
#ifndef OUTTOPIC
|
||||
#define OUTTOPIC "/myhome/s_out/"
|
||||
#define OUTTOPIC "/myhome/s_out1/"
|
||||
#endif
|
||||
|
||||
#ifndef INTOPIC
|
||||
#define INTOPIC "/myhome/in/"
|
||||
#define INTOPIC "/myhome/in1/"
|
||||
#endif
|
||||
|
||||
#define MQTT_SUBJECT_LENGTH 20
|
||||
#define MQTT_TOPIC_LENGTH 20
|
||||
|
||||
#ifndef DMX_DISABLE
|
||||
#define _dmxin
|
||||
#define _dmxout
|
||||
|
||||
@@ -27,7 +27,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
https://github.com/anklimov/DmxDue
|
||||
https://github.com/arduino-libraries/ArduinoHttpClient
|
||||
https://github.com/anklimov/ArduinoHttpClient
|
||||
https://github.com/anklimov/aJson
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
@@ -75,7 +75,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
https://github.com/anklimov/DmxDue
|
||||
https://github.com/arduino-libraries/ArduinoHttpClient
|
||||
https://github.com/anklimov/ArduinoHttpClient
|
||||
https://github.com/anklimov/aJson
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
|
||||
Reference in New Issue
Block a user