mirror of
https://github.com/anklimov/lighthub
synced 2025-12-07 12:19:49 +03:00
PrintEx
This commit is contained in:
@@ -67,6 +67,8 @@ PWM Out
|
||||
#include "Arduino.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
//#include "Streaming.h"
|
||||
#include "PrintEx.h"
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
DueFlashStorage EEPROM;
|
||||
@@ -156,22 +158,19 @@ int mqttErrorRate;
|
||||
void watchdogSetup(void) {} //Do not remove - strong re-definition WDT Init for DUE
|
||||
|
||||
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||
debugSerial.print(F("\n["));
|
||||
debugSerial.print(topic);
|
||||
debugSerial.print(F("] "));
|
||||
debugSerial<<F("\n[")<<topic<<F("] ");
|
||||
if (!payload) return;
|
||||
|
||||
payload[length] = 0;
|
||||
int fr = freeRam();
|
||||
if (fr < 250) {
|
||||
debugSerial.println(F("OOM!"));
|
||||
debugSerial<<F("OOM!");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
debugSerial.print((char) payload[i]);
|
||||
}
|
||||
debugSerial.println();
|
||||
for (int i = 0; i < length; i++)
|
||||
debugSerial<<((char) payload[i]);
|
||||
debugSerial<<ios::endl;
|
||||
|
||||
if(!strcmp(topic,CMDTOPIC)) {
|
||||
cmd_parse((char *)payload);
|
||||
@@ -186,7 +185,7 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||
}
|
||||
// in Retaining status - trying to restore previous state from retained output topic. Retained input topics are not relevant.
|
||||
if ((lanStatus == RETAINING_COLLECTING) && !intopic) {
|
||||
debugSerial.println(F("Skipping.."));
|
||||
debugSerial<<F("Skipping..");
|
||||
return;
|
||||
}
|
||||
char subtopic[MQTT_SUBJECT_LENGTH] = "";
|
||||
@@ -204,20 +203,16 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||
}
|
||||
|
||||
void printIPAddress(IPAddress ipAddress) {
|
||||
for (byte thisByte = 0; thisByte < 4; thisByte++) {
|
||||
debugSerial.print(ipAddress[thisByte], DEC);
|
||||
if (thisByte < 3)
|
||||
debugSerial.print(F("."));
|
||||
}
|
||||
for (byte i = 0; i < 4; i++)
|
||||
// (i < 3) ? debugSerial << _DEC(ipAddress[i]) << F(".") : debugSerial << _DEC(ipAddress[i])<<F(", ");
|
||||
(i < 3) ? debugSerial << (ipAddress[i]) << F(".") : debugSerial << (ipAddress[i])<<F(", ");
|
||||
}
|
||||
|
||||
void printMACAddress() {
|
||||
debugSerial.print(F("Configured MAC:"));
|
||||
for (byte thisByte = 0; thisByte < 6; thisByte++) {
|
||||
debugSerial.print(mac[thisByte], HEX);
|
||||
debugSerial.print(F(":"));
|
||||
}
|
||||
debugSerial.println();
|
||||
debugSerial<<F("Configured MAC:");
|
||||
for (byte i = 0; i < 6; i++)
|
||||
// (i < 5) ?debugSerial<<_HEX(mac[i])<<F(":"):debugSerial<<_HEX(mac[i])<<endl;
|
||||
(i < 5) ?debugSerial<<ios::hex <<(mac[i])<<F(":"):debugSerial<<ios::hex<<(mac[i])<<ios::endl;
|
||||
}
|
||||
|
||||
void restoreState() {
|
||||
@@ -260,7 +255,7 @@ lan_status lanLoop() {
|
||||
mqttClient.unsubscribe(buf);
|
||||
|
||||
lanStatus = OPERATION;//3;
|
||||
debugSerial.println(F("Accepting commands..."));
|
||||
debugSerial<<F("Accepting commands...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -297,32 +292,32 @@ lan_status lanLoop() {
|
||||
if (lanStatus > 0)
|
||||
switch (Ethernet.maintain()) {
|
||||
case NO_LINK:
|
||||
debugSerial.println(F("No link"));
|
||||
debugSerial<<F("No link");
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
nextLanCheckTime = millis() + 30000;
|
||||
lanStatus = AWAITING_ADDRESS;//-10;
|
||||
break;
|
||||
case DHCP_CHECK_RENEW_FAIL:
|
||||
debugSerial.println(F("Error: renewed fail"));
|
||||
debugSerial<<F("Error: renewed fail");
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
nextLanCheckTime = millis() + 1000;
|
||||
lanStatus = AWAITING_ADDRESS;//-10;
|
||||
break;
|
||||
|
||||
case DHCP_CHECK_RENEW_OK:
|
||||
debugSerial.println(F("Renewed success. IP address:"));
|
||||
debugSerial<<F("Renewed success. IP address:");
|
||||
printIPAddress(Ethernet.localIP());
|
||||
break;
|
||||
|
||||
case DHCP_CHECK_REBIND_FAIL:
|
||||
debugSerial.println(F("Error: rebind fail"));
|
||||
debugSerial<<F("Error: rebind fail");
|
||||
if (mqttClient.connected()) mqttClient.disconnect();
|
||||
nextLanCheckTime = millis() + 1000;
|
||||
lanStatus = AWAITING_ADDRESS;//-10;
|
||||
break;
|
||||
|
||||
case DHCP_CHECK_REBIND_OK:
|
||||
debugSerial.println(F("Rebind success. IP address:"));
|
||||
debugSerial<<F("Rebind success. IP address:");
|
||||
printIPAddress(Ethernet.localIP());
|
||||
break;
|
||||
|
||||
@@ -347,23 +342,20 @@ void ip_ready_config_loaded_connecting_to_broker() {
|
||||
char passwordBuf[16] = "";
|
||||
char *password = passwordBuf;
|
||||
#ifndef SYSLOG_DISABLE
|
||||
debugSerial.println("debugSerial:");
|
||||
debugSerial<<"debugSerial:";
|
||||
delay(100);
|
||||
if (udpSyslogArr && aJson.getArraySize(udpSyslogArr)) {
|
||||
char *syslogServer = aJson.getArrayItem(udpSyslogArr, 0)->valuestring;
|
||||
int syslogPort = aJson.getArrayItem(udpSyslogArr, 1)->valueint;
|
||||
char *syslogDeviceHostname = aJson.getArrayItem(udpSyslogArr, 2)->valuestring;
|
||||
char *syslogAppname = aJson.getArrayItem(udpSyslogArr, 3)->valuestring;
|
||||
debugSerial.println("debugSerial:");
|
||||
debugSerial.println(syslogServer);
|
||||
debugSerial.println(syslogPort);
|
||||
debugSerial.println(syslogDeviceHostname);
|
||||
debugSerial.println(syslogAppname);
|
||||
debugSerial<<F("Syslog params:")<<syslogServer<<syslogPort<<syslogDeviceHostname<<syslogAppname;
|
||||
udpSyslog.server(syslogServer, syslogPort);
|
||||
udpSyslog.deviceHostname(syslogDeviceHostname);
|
||||
udpSyslog.appName(syslogAppname);
|
||||
udpSyslog.defaultPriority(LOG_KERN);
|
||||
udpSyslog.log(LOG_INFO, "UDP Syslog initialized!");
|
||||
udpSyslog.log(LOG_INFO, F("UDP Syslog initialized!"));
|
||||
debugSerial<<F("UDP Syslog initialized!");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -374,25 +366,18 @@ void ip_ready_config_loaded_connecting_to_broker() {
|
||||
if (n >= 4) user = aJson.getArrayItem(mqttArr, 3)->valuestring;
|
||||
if (!loadFlash(OFFSET_MQTT_PWD, passwordBuf, sizeof(passwordBuf)) && (n >= 5)) {
|
||||
password = aJson.getArrayItem(mqttArr, 4)->valuestring;
|
||||
debugSerial.println(F("Using MQTT password from config"));
|
||||
debugSerial<<F("Using MQTT password from config");
|
||||
}
|
||||
|
||||
mqttClient.setServer(servername, port);
|
||||
mqttClient.setCallback(mqttCallback);
|
||||
|
||||
debugSerial.print(F("Attempting MQTT connection to "));
|
||||
debugSerial.print(servername);
|
||||
debugSerial.print(F(":"));
|
||||
debugSerial.print(port);
|
||||
debugSerial.print(F(" user:"));
|
||||
debugSerial.print(user);
|
||||
debugSerial.print(F(" ..."));
|
||||
debugSerial<<F("\nAttempting MQTT connection to ")<<servername<<F(":")<<port<<F(" user:")<<user<<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)) {
|
||||
mqttErrorRate = 0;
|
||||
debugSerial.print(F("connected as "));
|
||||
debugSerial.println(client_id);
|
||||
debugSerial<<F("connected as ")<<client_id;
|
||||
wdt_en();
|
||||
configOk = true;
|
||||
// ... Temporary subscribe to status topic
|
||||
@@ -411,16 +396,14 @@ void ip_ready_config_loaded_connecting_to_broker() {
|
||||
// if (_once) {DMXput(); _once=0;}
|
||||
lanStatus = RETAINING_COLLECTING;//4;
|
||||
nextLanCheckTime = millis() + 5000;
|
||||
debugSerial.println(F("Awaiting for retained topics"));
|
||||
debugSerial<<F("Awaiting for retained topics");
|
||||
} else {
|
||||
debugSerial.print(F("failed, rc="));
|
||||
debugSerial.print(mqttClient.state());
|
||||
debugSerial.println(F(" try again in 5 seconds"));
|
||||
debugSerial<<F("failed, rc=")<<mqttClient.state()<<F(" try again in 5 seconds");
|
||||
nextLanCheckTime = millis() + 5000;
|
||||
#ifdef RESTART_LAN_ON_MQTT_ERRORS
|
||||
mqttErrorRate++;
|
||||
if(mqttErrorRate>50){
|
||||
debugSerial.print(F("Too many MQTT connection errors. Restart LAN"));
|
||||
debugSerial<<F("Too many MQTT connection errors. Restart LAN"));
|
||||
mqttErrorRate=0;
|
||||
#ifdef RESET_PIN
|
||||
resetHard();
|
||||
@@ -439,10 +422,10 @@ void onInitialStateInitLAN() {
|
||||
#if defined(ESP8266) and defined(WIFI_MANAGER_DISABLE)
|
||||
if(!wifiInitialized) {
|
||||
WiFi.mode(WIFI_STA);
|
||||
debugSerial.print(F("WIFI AP/Password:"));
|
||||
debugSerial.print(QUOTE(ESP_WIFI_AP));
|
||||
debugSerial.print(F("/"));
|
||||
debugSerial.println(QUOTE(ESP_WIFI_PWD));
|
||||
debugSerial<<F("WIFI AP/Password:"));
|
||||
debugSerial<<QUOTE(ESP_WIFI_AP));
|
||||
debugSerial<<F("/"));
|
||||
debugSerial<<QUOTE(ESP_WIFI_PWD));
|
||||
wifi_set_macaddr(STATION_IF,mac);
|
||||
WiFi.begin(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD));
|
||||
wifiInitialized = true;
|
||||
@@ -453,17 +436,17 @@ void onInitialStateInitLAN() {
|
||||
if(!wifiInitialized) {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
debugSerial.print(F("WIFI AP/Password:"));
|
||||
debugSerial.print(QUOTE(ESP_WIFI_AP));
|
||||
debugSerial.print(F("/"));
|
||||
debugSerial.println(QUOTE(ESP_WIFI_PWD));
|
||||
debugSerial<<F("WIFI AP/Password:"));
|
||||
debugSerial<<QUOTE(ESP_WIFI_AP));
|
||||
debugSerial<<F("/"));
|
||||
debugSerial<<QUOTE(ESP_WIFI_PWD));
|
||||
WiFi.begin(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD));
|
||||
|
||||
int wifi_connection_wait = 10000;
|
||||
while (WiFi.status() != WL_CONNECTED && wifi_connection_wait > 0) {
|
||||
delay(500);
|
||||
wifi_connection_wait -= 500;
|
||||
debugSerial.print(".");
|
||||
debugSerial<<".");
|
||||
}
|
||||
wifiInitialized = true;
|
||||
}
|
||||
@@ -471,12 +454,12 @@ void onInitialStateInitLAN() {
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266)
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
debugSerial.print(F("WiFi connected. IP address: "));
|
||||
debugSerial.println(WiFi.localIP());
|
||||
debugSerial<<F("WiFi connected. IP address: "));
|
||||
debugSerial<<WiFi.localIP());
|
||||
lanStatus = HAVE_IP_ADDRESS;//1;
|
||||
} else
|
||||
{
|
||||
debugSerial.println(F("Problem with WiFi connected"));
|
||||
debugSerial<<F("Problem with WiFi connected"));
|
||||
nextLanCheckTime = millis() + DHCP_RETRY_INTERVAL/5;
|
||||
}
|
||||
#endif
|
||||
@@ -484,33 +467,33 @@ void onInitialStateInitLAN() {
|
||||
#if defined(__AVR__) || defined(__SAM3X8E__)||defined(ARDUINO_ARCH_STM32F1)
|
||||
#ifdef W5500_CS_PIN
|
||||
Ethernet.w5500_cspin = W5500_CS_PIN;
|
||||
debugSerial.print(F("Use W5500 pin: "));
|
||||
debugSerial.println(Ethernet.w5500_cspin);
|
||||
debugSerial<<F("Use W5500 pin: "));
|
||||
debugSerial<<Ethernet.w5500_cspin);
|
||||
#endif
|
||||
IPAddress ip, dns, gw, mask;
|
||||
int res = 1;
|
||||
debugSerial.println(F("Starting lan"));
|
||||
debugSerial<<F("Starting lan");
|
||||
if (ipLoadFromFlash(OFFSET_IP, ip)) {
|
||||
debugSerial.print("Loaded from flash IP:");
|
||||
debugSerial<<"Loaded from flash IP:";
|
||||
printIPAddress(ip);
|
||||
if (ipLoadFromFlash(OFFSET_DNS, dns)) {
|
||||
debugSerial.print(" DNS:");
|
||||
debugSerial<<" DNS:";
|
||||
printIPAddress(dns);
|
||||
if (ipLoadFromFlash(OFFSET_GW, gw)) {
|
||||
debugSerial.print(" GW:");
|
||||
debugSerial<<" GW:";
|
||||
printIPAddress(gw);
|
||||
if (ipLoadFromFlash(OFFSET_MASK, mask)) {
|
||||
debugSerial.print(" MASK:");
|
||||
debugSerial<<" MASK:";
|
||||
printIPAddress(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);
|
||||
debugSerial.println();
|
||||
debugSerial<<ios::endl;
|
||||
lanStatus = HAVE_IP_ADDRESS;
|
||||
}
|
||||
else {
|
||||
debugSerial.println("No IP data found in flash");
|
||||
debugSerial<<"No IP data found in flash";
|
||||
wdt_dis();
|
||||
#if defined(__AVR__) || defined(__SAM3X8E__)
|
||||
res = Ethernet.begin(mac, 12000);
|
||||
@@ -523,15 +506,14 @@ void onInitialStateInitLAN() {
|
||||
|
||||
|
||||
if (res == 0) {
|
||||
debugSerial.println(F("Failed to configure Ethernet using DHCP. You can set ip manually!"));
|
||||
debugSerial.print(F("'ip [ip[,dns[,gw[,subnet]]]]' - set static IP\n"));
|
||||
debugSerial<<F("Failed to configure Ethernet using DHCP. You can set ip manually!")<<F("'ip [ip[,dns[,gw[,subnet]]]]' - set static IP\n");
|
||||
lanStatus = AWAITING_ADDRESS;//-10;
|
||||
nextLanCheckTime = millis() + DHCP_RETRY_INTERVAL;
|
||||
#ifdef RESET_PIN
|
||||
resetHard();
|
||||
#endif
|
||||
} else {
|
||||
debugSerial.println(F("Got IP address:"));
|
||||
debugSerial<<F("Got IP address:");
|
||||
printIPAddress(Ethernet.localIP());
|
||||
lanStatus = HAVE_IP_ADDRESS;//1;
|
||||
}
|
||||
@@ -547,19 +529,22 @@ void softRebootFunc() {
|
||||
|
||||
#if defined(__AVR__) || defined(__SAM3X8E__)
|
||||
void (*softRebootFunc)(void) = 0;
|
||||
|
||||
void printCurentLanConfig();
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||
void softRebootFunc(){
|
||||
debugSerial.print(F("ESP.restart();"));
|
||||
debugSerial<<F("ESP.restart();"));
|
||||
ESP.restart();
|
||||
}
|
||||
#endif
|
||||
|
||||
void resetHard() {
|
||||
#ifdef RESET_PIN
|
||||
debugSerial.print(F("Reset Arduino with digital pin "));
|
||||
debugSerial.println(QUOTE(RESET_PIN));
|
||||
debugSerial<<F("Reset Arduino with digital pin "));
|
||||
debugSerial<<QUOTE(RESET_PIN));
|
||||
delay(500);
|
||||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN,LOW);
|
||||
@@ -586,12 +571,12 @@ void Changed(int i, DeviceAddress addr, int val) {
|
||||
owEmit = aJson.getObjectItem(owObj, "emit")->valuestring;
|
||||
if (owEmit) {
|
||||
strncpy(addrbuf, owEmit, sizeof(addrbuf));
|
||||
debugSerial.print(owEmit);
|
||||
debugSerial.print(F("="));
|
||||
debugSerial.println(val);
|
||||
debugSerial<<owEmit;
|
||||
debugSerial<<F("=");
|
||||
debugSerial<<val;
|
||||
}
|
||||
owItem = aJson.getObjectItem(owObj, "item")->valuestring;
|
||||
} else debugSerial.println(F("1w-item not found in config"));
|
||||
} else debugSerial<<F("1w-item not found in config");
|
||||
|
||||
if ((val == -127) || (val == 85) || (val == 0)) { //ToDo: 1-w short circuit mapped to "0" celsium
|
||||
return;
|
||||
@@ -615,19 +600,9 @@ void cmdFunctionHelp(int arg_cnt, char **args)
|
||||
#ifndef SYSLOG_DISABLE
|
||||
// udpSyslog.logf(LOG_INFO, "free RAM: %d",freeRam());
|
||||
#endif
|
||||
printCurentLanConfig();
|
||||
|
||||
|
||||
debugSerial.print(F("Current LAN config(ip,dns,gw,subnet):"));
|
||||
printIPAddress(Ethernet.localIP());
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(Ethernet.dnsServerIP());
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(Ethernet.gatewayIP());
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(Ethernet.subnetMask());
|
||||
debugSerial.println(F(";"));
|
||||
debugSerial.print(F(" free RAM: "));debugSerial.print(freeRam());
|
||||
debugSerial.println(F(" Use the commands: 'help' - this text\n"
|
||||
debugSerial<<F(" free RAM: ")<<freeRam()<<F(" Use the commands: 'help' - this text\n"
|
||||
"'mac de:ad:be:ef:fe:00' set and store MAC-address in EEPROM\n"
|
||||
"'ip [ip[,dns[,gw[,subnet]]]]' - set static IP\n"
|
||||
"'save' - save config in NVRAM\n"
|
||||
@@ -636,18 +611,26 @@ void cmdFunctionHelp(int arg_cnt, char **args)
|
||||
"'pwd' - define MQTT password\n"
|
||||
"'kill' - test watchdog\n"
|
||||
"'clear' - clear EEPROM\n"
|
||||
"'reboot' - reboot controller"));
|
||||
"'reboot' - reboot controller");
|
||||
}
|
||||
|
||||
void printCurentLanConfig() {
|
||||
debugSerial << F("Current LAN config(ip,dns,gw,subnet):");
|
||||
printIPAddress(Ethernet.localIP());
|
||||
printIPAddress(Ethernet.dnsServerIP());
|
||||
printIPAddress(Ethernet.gatewayIP());
|
||||
printIPAddress(Ethernet.subnetMask());
|
||||
}
|
||||
|
||||
void cmdFunctionKill(int arg_cnt, char **args) {
|
||||
for (short i = 1; i < 20; i++) {
|
||||
for (byte i = 1; i < 20; i++) {
|
||||
delay(1000);
|
||||
debugSerial.println(i);
|
||||
debugSerial<<i;
|
||||
};
|
||||
}
|
||||
|
||||
void cmdFunctionReboot(int arg_cnt, char **args) {
|
||||
debugSerial.println(F("Soft rebooting..."));
|
||||
debugSerial<<F("Soft rebooting...");
|
||||
softRebootFunc();
|
||||
}
|
||||
|
||||
@@ -659,8 +642,7 @@ void applyConfig() {
|
||||
dmxArr = aJson.getObjectItem(root, "dmxin");
|
||||
if (dmxArr && (itemsCount = aJson.getArraySize(dmxArr))) {
|
||||
DMXinSetup(itemsCount * 4);
|
||||
debugSerial.print(F("DMX in started. Channels:"));
|
||||
debugSerial.println(itemsCount * 4);
|
||||
debugSerial<<F("DMX in started. Channels:")<<itemsCount * 4;
|
||||
}
|
||||
#endif
|
||||
#ifdef _dmxout
|
||||
@@ -668,9 +650,7 @@ void applyConfig() {
|
||||
aJsonObject *dmxoutArr = aJson.getObjectItem(root, "dmx");
|
||||
if (dmxoutArr && aJson.getArraySize(dmxoutArr) >=1 ) {
|
||||
DMXoutSetup(maxChannels = aJson.getArrayItem(dmxoutArr, 1)->valueint);
|
||||
//,aJson.getArrayItem(dmxoutArr, 0)->valueint);
|
||||
debugSerial.print(F("DMX out started. Channels: "));
|
||||
debugSerial.println(maxChannels);
|
||||
debugSerial<<F("DMX out started. Channels: ")<<maxChannels;
|
||||
}
|
||||
#endif
|
||||
#ifdef _modbus
|
||||
@@ -682,12 +662,12 @@ void applyConfig() {
|
||||
if (owArr && !owReady) {
|
||||
aJsonObject *item = owArr->child;
|
||||
owReady = owSetup(&Changed);
|
||||
if (owReady) debugSerial.println(F("One wire Ready"));
|
||||
if (owReady) debugSerial<<F("One wire Ready");
|
||||
t_count = 0;
|
||||
while (item && owReady) {
|
||||
if ((item->type == aJson_Object)) {
|
||||
DeviceAddress addr;
|
||||
//debugSerial.print(F("Add:")),debugSerial.println(item->name);
|
||||
//debugSerial<<F("Add:")),debugSerial<<item->name);
|
||||
SetAddr(item->name, addr);
|
||||
owAdd(addr);
|
||||
}
|
||||
@@ -715,10 +695,7 @@ void applyConfig() {
|
||||
int k;
|
||||
pinMode(pin, OUTPUT);
|
||||
digitalWrite(pin, k = ((cmd == CMD_ON) ? HIGH : LOW));
|
||||
debugSerial.print(F("Pin:"));
|
||||
debugSerial.print(pin);
|
||||
debugSerial.print(F("="));
|
||||
debugSerial.println(k);
|
||||
debugSerial<<F("Pin:")<<pin<<F("=")<<k;
|
||||
}
|
||||
break;
|
||||
} //switch
|
||||
@@ -734,18 +711,17 @@ void applyConfig() {
|
||||
}
|
||||
|
||||
void printConfigSummary() {
|
||||
debugSerial.println(F("Configured:"));
|
||||
debugSerial.print(F("items "));
|
||||
debugSerial<<F("\nConfigured:")<<F("\nitems ");
|
||||
printBool(items);
|
||||
debugSerial.print(F("inputs "));
|
||||
debugSerial<<F("\ninputs ");
|
||||
printBool(inputs);
|
||||
debugSerial.print(F("modbus "));
|
||||
debugSerial<<F("\nmodbus ");
|
||||
printBool(modbusArr);
|
||||
debugSerial.print(F("mqtt "));
|
||||
debugSerial<<F("\nmqtt ");
|
||||
printBool(mqttArr);
|
||||
debugSerial.print(F("1-wire "));
|
||||
debugSerial<<F("\n1-wire ");
|
||||
printBool(owArr);
|
||||
debugSerial.print(F("udp syslog "));
|
||||
debugSerial<<F("\nudp syslog ");
|
||||
printBool(udpSyslogArr);
|
||||
}
|
||||
|
||||
@@ -757,24 +733,23 @@ void cmdFunctionLoad(int arg_cnt, char **args) {
|
||||
int loadConfigFromEEPROM(int arg_cnt, char **args)
|
||||
{
|
||||
char ch;
|
||||
debugSerial.println(F("loading Config"));
|
||||
debugSerial<<F("loading Config");
|
||||
|
||||
ch = EEPROM.read(EEPROM_offset);
|
||||
if (ch == '{') {
|
||||
aJsonEEPROMStream as = aJsonEEPROMStream(EEPROM_offset);
|
||||
aJson.deleteItem(root);
|
||||
root = aJson.parse(&as);
|
||||
debugSerial.println();
|
||||
if (!root) {
|
||||
debugSerial.println(F("load failed"));
|
||||
debugSerial<<F("\nload failed");
|
||||
return 0;
|
||||
}
|
||||
debugSerial.println(F("Loaded"));
|
||||
debugSerial<<F("\nLoaded");
|
||||
applyConfig();
|
||||
ethClient.stop(); //Refresh MQTT connect to get retained info
|
||||
return 1;
|
||||
} else {
|
||||
debugSerial.println(F("No stored config"));
|
||||
debugSerial<<F("\nNo stored config");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -788,28 +763,28 @@ void cmdFunctionReq(int arg_cnt, char **args) {
|
||||
int mqttConfigRequest(int arg_cnt, char **args)
|
||||
{
|
||||
char buf[25] = "/";
|
||||
debugSerial.println(F("request MQTT Config"));
|
||||
debugSerial<<F("\nrequest MQTT Config");
|
||||
SetBytes((uint8_t *) mac, 6, buf + 1);
|
||||
buf[13] = 0;
|
||||
strncat(buf, "/resp/#", 25);
|
||||
debugSerial.println(buf);
|
||||
debugSerial<<buf;
|
||||
mqttClient.subscribe(buf);
|
||||
buf[13] = 0;
|
||||
strncat(buf, "/req/conf", 25);
|
||||
debugSerial.println(buf);
|
||||
debugSerial<<buf;
|
||||
mqttClient.publish(buf, "1");
|
||||
}
|
||||
|
||||
|
||||
int mqttConfigResp(char *as) {
|
||||
debugSerial.println(F("got MQTT Config"));
|
||||
debugSerial<<F("got MQTT Config");
|
||||
root = aJson.parse(as);
|
||||
debugSerial.println();
|
||||
|
||||
if (!root) {
|
||||
debugSerial.println(F("load failed"));
|
||||
debugSerial<<F("\nload failed");
|
||||
return 0;
|
||||
}
|
||||
debugSerial.println(F("Loaded"));
|
||||
debugSerial<<F("\nLoaded");
|
||||
applyConfig();
|
||||
return 1;
|
||||
}
|
||||
@@ -817,10 +792,10 @@ int mqttConfigResp(char *as) {
|
||||
void cmdFunctionSave(int arg_cnt, char **args)
|
||||
{
|
||||
aJsonEEPROMStream jsonEEPROMStream = aJsonEEPROMStream(EEPROM_offset);
|
||||
debugSerial.println(F("Saving config to EEPROM.."));
|
||||
debugSerial<<F("Saving config to EEPROM..");
|
||||
aJson.print(root, &jsonEEPROMStream);
|
||||
jsonEEPROMStream.putEOF();
|
||||
debugSerial.println(F("Saved to EEPROM"));
|
||||
debugSerial<<F("Saved to EEPROM");
|
||||
}
|
||||
|
||||
void cmdFunctionIp(int arg_cnt, char **args)
|
||||
@@ -851,24 +826,19 @@ void cmdFunctionIp(int arg_cnt, char **args)
|
||||
saveFlash(OFFSET_MASK, current_mask);
|
||||
saveFlash(OFFSET_GW, current_gw);
|
||||
saveFlash(OFFSET_DNS, current_dns);
|
||||
debugSerial.print(F("Saved current config(ip,dns,gw,subnet):"));
|
||||
debugSerial<<F("Saved current config(ip,dns,gw,subnet):");
|
||||
printIPAddress(current_ip);
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(current_dns);
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(current_gw);
|
||||
debugSerial.print(F(" ,"));
|
||||
printIPAddress(current_mask);
|
||||
debugSerial.println(F(";"));
|
||||
|
||||
}
|
||||
debugSerial.println(F("Saved"));
|
||||
debugSerial<<F("Saved");
|
||||
}
|
||||
|
||||
void cmdFunctionClearEEPROM(int arg_cnt, char **args){
|
||||
for (int i = 0; i < 512; i++)
|
||||
EEPROM.write(i, 0);
|
||||
debugSerial.println(F("EEPROM cleared"));
|
||||
debugSerial<<F("EEPROM cleared");
|
||||
|
||||
}
|
||||
|
||||
@@ -878,13 +848,13 @@ void cmdFunctionPwd(int arg_cnt, char **args)
|
||||
if (arg_cnt)
|
||||
saveFlash(OFFSET_MQTT_PWD,args[1]);
|
||||
else saveFlash(OFFSET_MQTT_PWD,empty);
|
||||
debugSerial.println(F("Password updated"));
|
||||
debugSerial<<F("Password updated");
|
||||
}
|
||||
|
||||
void cmdFunctionSetMac(int arg_cnt, char **args) {
|
||||
|
||||
//debugSerial.print("Got:");
|
||||
//debugSerial.println(args[1]);
|
||||
//debugSerial<<"Got:");
|
||||
//debugSerial<<args[1]);
|
||||
if (sscanf(args[1], "%x:%x:%x:%x:%x:%x%с",
|
||||
&mac[0],
|
||||
&mac[1],
|
||||
@@ -892,13 +862,12 @@ void cmdFunctionSetMac(int arg_cnt, char **args) {
|
||||
&mac[3],
|
||||
&mac[4],
|
||||
&mac[5]) < 6) {
|
||||
debugSerial.print(F("could not parse: "));
|
||||
debugSerial.println(args[1]);
|
||||
debugSerial<<F("could not parse: ")<<args[1];
|
||||
return;
|
||||
}
|
||||
printMACAddress();
|
||||
for (short i = 0; i < 6; i++) { EEPROM.write(i, mac[i]); }
|
||||
debugSerial.println(F("Updated"));
|
||||
debugSerial<<F("Updated");
|
||||
}
|
||||
|
||||
void cmdFunctionGet(int arg_cnt, char **args) {
|
||||
@@ -907,7 +876,7 @@ void cmdFunctionGet(int arg_cnt, char **args) {
|
||||
//restoreState();
|
||||
}
|
||||
|
||||
void printBool(bool arg) { (arg) ? debugSerial.println(F("on")) : debugSerial.println(F("off")); }
|
||||
void printBool(bool arg) { (arg) ? debugSerial<<F("on") : debugSerial<<F("off"); }
|
||||
|
||||
|
||||
void saveFlash(short n, char *str) {
|
||||
@@ -951,9 +920,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
|
||||
snprintf(URI, sizeof(URI), "/%02x-%02x-%02x-%02x-%02x-%02x.config.json", mac[0], mac[1], mac[2], mac[3], mac[4],
|
||||
mac[5]);
|
||||
debugSerial.print(F("Config URI: http://"));
|
||||
debugSerial.print(configServer);
|
||||
debugSerial.println(URI);
|
||||
debugSerial<<F("Config URI: http://")<<configServer<<URI;
|
||||
|
||||
#if defined(__AVR__)
|
||||
FILE *configStream;
|
||||
@@ -969,40 +936,40 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
if (configStream != NULL) {
|
||||
if (responseStatusCode == 200) {
|
||||
|
||||
debugSerial.println(F("got Config"));
|
||||
debugSerial<<F("got Config"));
|
||||
char c;
|
||||
aJsonFileStream as = aJsonFileStream(configStream);
|
||||
noInterrupts();
|
||||
aJson.deleteItem(root);
|
||||
root = aJson.parse(&as);
|
||||
interrupts();
|
||||
// debugSerial.println(F("Parsed."));
|
||||
// debugSerial<<F("Parsed."));
|
||||
hclient.closeStream(configStream); // this is very important -- be sure to close the STREAM
|
||||
|
||||
if (!root) {
|
||||
debugSerial.println(F("Config parsing failed"));
|
||||
debugSerial<<F("Config parsing failed"));
|
||||
nextLanCheckTime = millis() + 15000;
|
||||
return READ_RE_CONFIG;//-11;
|
||||
} else {
|
||||
// char *outstr = aJson.print(root);
|
||||
// debugSerial.println(outstr);
|
||||
// debugSerial<<outstr);
|
||||
// free(outstr);
|
||||
debugSerial.println(F("Applying."));
|
||||
debugSerial<<F("Applying."));
|
||||
applyConfig();
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
debugSerial.print(F("ERROR: Server returned "));
|
||||
debugSerial.println(responseStatusCode);
|
||||
debugSerial<<F("ERROR: Server returned "));
|
||||
debugSerial<<responseStatusCode);
|
||||
nextLanCheckTime = millis() + 5000;
|
||||
return READ_RE_CONFIG;//-11;
|
||||
}
|
||||
|
||||
} else {
|
||||
debugSerial.println(F("failed to connect"));
|
||||
debugSerial.println(F(" try again in 5 seconds"));
|
||||
debugSerial<<F("failed to connect"));
|
||||
debugSerial<<F(" try again in 5 seconds"));
|
||||
nextLanCheckTime = millis() + 5000;
|
||||
return READ_RE_CONFIG;//-11;
|
||||
}
|
||||
@@ -1014,7 +981,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
//htclient.stop(); //_socket =MAX
|
||||
htclient.setHttpResponseTimeout(4000);
|
||||
wdt_res();
|
||||
//debugSerial.println("making GET request");get
|
||||
//debugSerial<<"making GET request");get
|
||||
htclient.beginRequest();
|
||||
htclient.get(URI);
|
||||
htclient.endRequest();
|
||||
@@ -1025,31 +992,31 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
response = htclient.responseBody();
|
||||
htclient.stop();
|
||||
wdt_res();
|
||||
debugSerial.print(F("HTTP Status code: "));
|
||||
debugSerial.println(responseStatusCode);
|
||||
//debugSerial.print("GET Response: ");
|
||||
debugSerial<<F("HTTP Status code: ");
|
||||
debugSerial<<responseStatusCode;
|
||||
//debugSerial<<"GET Response: ");
|
||||
|
||||
if (responseStatusCode == 200) {
|
||||
aJson.deleteItem(root);
|
||||
root = aJson.parse((char *) response.c_str());
|
||||
|
||||
if (!root) {
|
||||
debugSerial.println(F("Config parsing failed"));
|
||||
debugSerial<<F("Config parsing failed");
|
||||
// nextLanCheckTime=millis()+15000;
|
||||
return READ_RE_CONFIG;//-11; //Load from NVRAM
|
||||
} else {
|
||||
/*
|
||||
char * outstr=aJson.print(root);
|
||||
debugSerial.println(outstr);
|
||||
debugSerial<<outstr);
|
||||
free (outstr);
|
||||
*/
|
||||
debugSerial.println(response);
|
||||
debugSerial<<response;
|
||||
applyConfig();
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
debugSerial.println(F("Config retrieving failed"));
|
||||
debugSerial<<F("Config retrieving failed");
|
||||
//nextLanCheckTime=millis()+15000;
|
||||
return READ_RE_CONFIG;//-11; //Load from NVRAM
|
||||
}
|
||||
@@ -1065,14 +1032,14 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
debugSerial.printf("[HTTP] GET... code: %d\n", httpResponseCode);
|
||||
if (httpResponseCode == HTTP_CODE_OK) {
|
||||
String response = httpClient.getString();
|
||||
debugSerial.println(response);
|
||||
debugSerial<<response);
|
||||
aJson.deleteItem(root);
|
||||
root = aJson.parse((char *) response.c_str());
|
||||
if (!root) {
|
||||
debugSerial.println(F("Config parsing failed"));
|
||||
debugSerial<<F("Config parsing failed"));
|
||||
return READ_RE_CONFIG;
|
||||
} else {
|
||||
debugSerial.println(F("Config OK, Applying"));
|
||||
debugSerial<<F("Config OK, Applying"));
|
||||
applyConfig();
|
||||
}
|
||||
}
|
||||
@@ -1157,77 +1124,71 @@ void setup_main() {
|
||||
}
|
||||
|
||||
void printFirmwareVersionAndBuildOptions() {
|
||||
debugSerial.print(F("\nLazyhome.ru LightHub controller "));
|
||||
debugSerial.println(F(QUOTE(PIO_SRC_REV)));
|
||||
debugSerial.print(F("C++ version:"));
|
||||
debugSerial.println(F(QUOTE(__cplusplus)));
|
||||
debugSerial<<F("\nLazyhome.ru LightHub controller ")<<F(QUOTE(PIO_SRC_REV))<<F("C++ version:")<<F(QUOTE(__cplusplus));
|
||||
#ifdef CONTROLLINO
|
||||
debugSerial.println(F("(+)CONTROLLINO"));
|
||||
debugSerial<<F("\n(+)CONTROLLINO"));
|
||||
#endif
|
||||
#ifdef WATCH_DOG_TICKER_DISABLE
|
||||
debugSerial.println(F("(-)WATCHDOG"));
|
||||
debugSerial<<F("\n(-)WATCHDOG");
|
||||
#else
|
||||
debugSerial.println(F("(+)WATCHDOG"));
|
||||
debugSerial<<F("\n(+)WATCHDOG"));
|
||||
#endif
|
||||
debugSerial.print(F("Config server:"));
|
||||
debugSerial.println(F(CONFIG_SERVER));
|
||||
debugSerial.print(F("Firmware MAC Address "));
|
||||
debugSerial.println(F(QUOTE(CUSTOM_FIRMWARE_MAC))); //Q Macros didn't working with 6 args
|
||||
debugSerial<<F("\nConfig server:")<<F(CONFIG_SERVER)<<F("\nFirmware MAC Address ")<<F(QUOTE(CUSTOM_FIRMWARE_MAC));
|
||||
#ifdef DISABLE_FREERAM_PRINT
|
||||
debugSerial.println(F("(-)FreeRam printing"));
|
||||
debugSerial<<F("\n(-)FreeRam printing");
|
||||
#else
|
||||
debugSerial.println(F("(+)FreeRam printing"));
|
||||
debugSerial<<F("\n(+)FreeRam printing");
|
||||
#endif
|
||||
|
||||
#ifdef USE_1W_PIN
|
||||
debugSerial.print(F("(-)DS2482-100 USE_1W_PIN="));
|
||||
debugSerial.println(QUOTE(USE_1W_PIN));
|
||||
debugSerial<<F("(-)DS2482-100 USE_1W_PIN=");
|
||||
debugSerial<<QUOTE(USE_1W_PIN);
|
||||
#else
|
||||
debugSerial.println(F("(+)DS2482-100"));
|
||||
debugSerial<<F("\n(+)DS2482-100");
|
||||
#endif
|
||||
|
||||
#ifdef Wiz5500
|
||||
debugSerial.println(F("(+)WizNet5500"));
|
||||
debugSerial<<F("\n(+)WizNet5500");
|
||||
#endif
|
||||
|
||||
#ifdef DMX_DISABLE
|
||||
debugSerial.println(F("(-)DMX"));
|
||||
debugSerial<<F("(-)DMX");
|
||||
#else
|
||||
debugSerial.println(F("(+)DMX"));
|
||||
debugSerial<<F("\n(+)DMX");
|
||||
#endif
|
||||
|
||||
#ifdef MODBUS_DISABLE
|
||||
debugSerial.println(F("(-)MODBUS"));
|
||||
debugSerial<<F("\n(-)MODBUS");
|
||||
#else
|
||||
debugSerial.println(F("(+)MODBUS"));
|
||||
debugSerial<<F("\n(+)MODBUS");
|
||||
#endif
|
||||
|
||||
#ifdef OWIRE_DISABLE
|
||||
debugSerial.println(F("(-)OWIRE"));
|
||||
debugSerial<<F("\n(-)OWIRE"));
|
||||
#else
|
||||
debugSerial.println(F("(+)OWIRE"));
|
||||
debugSerial<<F("\n(+)OWIRE");
|
||||
#endif
|
||||
#ifndef DHT_DISABLE
|
||||
debugSerial.println(F("(+)DHT"));
|
||||
debugSerial<<F("\n(+)DHT");
|
||||
#else
|
||||
debugSerial.println(F("(-)DHT"));
|
||||
debugSerial<<F("\n(-)DHT");
|
||||
#endif
|
||||
|
||||
#ifdef SD_CARD_INSERTED
|
||||
debugSerial.println(F("(+)SDCARD"));
|
||||
debugSerial<<F("\n(+)SDCARD");
|
||||
#endif
|
||||
|
||||
#ifdef RESET_PIN
|
||||
debugSerial.print(F("(+)HARDRESET on pin="));
|
||||
debugSerial.println(F(QUOTE(RESET_PIN)));
|
||||
debugSerial<<F("\n(+)HARDRESET on pin=");
|
||||
debugSerial<<F(QUOTE(RESET_PIN));
|
||||
#else
|
||||
debugSerial.println("(-)HARDRESET, using soft");
|
||||
debugSerial<<F("\n(-)HARDRESET, using soft");
|
||||
#endif
|
||||
|
||||
#ifdef RESTART_LAN_ON_MQTT_ERRORS
|
||||
debugSerial.println(F("(+)RESTART_LAN_ON_MQTT_ERRORS"));
|
||||
debugSerial<<F("\n(+)RESTART_LAN_ON_MQTT_ERRORS");
|
||||
#else
|
||||
debugSerial.println("(-)RESTART_LAN_ON_MQTT_ERRORS");
|
||||
debugSerial<<F("\n(-)RESTART_LAN_ON_MQTT_ERRORS");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1249,7 +1210,7 @@ void setupMacAddress() {
|
||||
if (mac[i] != 0 && mac[i] != 0xff) isMacValid = true;
|
||||
}
|
||||
if (!isMacValid) {
|
||||
debugSerial.println(F("Invalid MAC: set firmware's MAC"));
|
||||
debugSerial<<F("Invalid MAC: set firmware's MAC");
|
||||
memcpy(mac, firmwareMacAddress, 6);
|
||||
}
|
||||
printMACAddress();
|
||||
@@ -1257,7 +1218,7 @@ void setupMacAddress() {
|
||||
|
||||
void setupCmdArduino() {
|
||||
cmdInit(uint32_t(SERIAL_BAUD));
|
||||
debugSerial.println(F(">>>"));
|
||||
debugSerial<<(F(">>>"));
|
||||
cmdAdd("help", cmdFunctionHelp);
|
||||
cmdAdd("save", cmdFunctionSave);
|
||||
cmdAdd("load", cmdFunctionLoad);
|
||||
@@ -1307,7 +1268,7 @@ void loop_main() {
|
||||
#endif
|
||||
|
||||
#ifndef SYSLOG_DISABLE
|
||||
// debugSerial.print(F("#"));
|
||||
// debugSerial<<F("#"));
|
||||
// udpSyslog.log(LOG_INFO, "Ping syslog:");
|
||||
#endif
|
||||
|
||||
@@ -1416,8 +1377,7 @@ void thermoLoop(void) {
|
||||
int curTemp = aJson.getArrayItem(thermoExtensionArray, IET_TEMP)->valueint;
|
||||
|
||||
if (!aJson.getArrayItem(thermoExtensionArray, IET_ATTEMPTS)->valueint) {
|
||||
debugSerial.print(thermoItem->name);
|
||||
debugSerial.println(F(" Expired"));
|
||||
debugSerial<<thermoItem->name<<F(" Expired");
|
||||
|
||||
} else {
|
||||
if (!(--aJson.getArrayItem(thermoExtensionArray, IET_ATTEMPTS)->valueint))
|
||||
@@ -1427,27 +1387,22 @@ void thermoLoop(void) {
|
||||
if (curTemp > THERMO_OVERHEAT_CELSIUS) mqttClient.publish("/alarm/ovrht", thermoItem->name);
|
||||
|
||||
|
||||
debugSerial.print(thermoItem->name);
|
||||
debugSerial.print(F(" Set:"));
|
||||
debugSerial.print(thermoSetting);
|
||||
debugSerial.print(F(" Cur:"));
|
||||
debugSerial.print(curTemp);
|
||||
debugSerial.print(F(" cmd:"));
|
||||
debugSerial.print(thermoStateCommand);
|
||||
debugSerial << ios::endl << thermoItem->name << F("Set:") << thermoSetting << F(" Cur:") << curTemp
|
||||
<< F(" cmd:") << thermoStateCommand;
|
||||
pinMode(thermoPin, OUTPUT);
|
||||
if (thermoDisabledOrDisconnected(thermoExtensionArray, thermoStateCommand)) {
|
||||
digitalWrite(thermoPin, LOW);
|
||||
debugSerial.println(F(" OFF"));
|
||||
debugSerial<<F(" OFF");
|
||||
} else {
|
||||
if (curTemp < thermoSetting - THERMO_GIST_CELSIUS) {
|
||||
digitalWrite(thermoPin, HIGH);
|
||||
debugSerial.println(F(" ON"));
|
||||
debugSerial<<F(" ON");
|
||||
} //too cold
|
||||
else if (curTemp >= thermoSetting) {
|
||||
digitalWrite(thermoPin, LOW);
|
||||
debugSerial.println(F(" OFF"));
|
||||
debugSerial<<F(" OFF");
|
||||
} //Reached settings
|
||||
else debugSerial.println(F(" -target zone-")); // Nothing to do
|
||||
else debugSerial<<F(" -target zone-"); // Nothing to do
|
||||
}
|
||||
thermostatCheckPrinted = true;
|
||||
}
|
||||
@@ -1457,9 +1412,9 @@ void thermoLoop(void) {
|
||||
nextThermostatCheck = millis() + THERMOSTAT_CHECK_PERIOD;
|
||||
|
||||
#ifndef DISABLE_FREERAM_PRINT
|
||||
(thermostatCheckPrinted) ? debugSerial.print(F("\nfree:")) : debugSerial.print(F(" "));
|
||||
debugSerial.print(freeRam());
|
||||
debugSerial.print(" ");
|
||||
(thermostatCheckPrinted) ? debugSerial<<F("\nfree:")) : debugSerial<<F(" "));
|
||||
debugSerial<<freeRam());
|
||||
debugSerial<<" ");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#pragma once
|
||||
#include "options.h"
|
||||
|
||||
#ifndef LIGHTHUB_MAIN_H
|
||||
#define LIGHTHUB_MAIN_H
|
||||
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
#define wdt_res() watchdogReset()
|
||||
#define wdt_en()
|
||||
@@ -238,4 +235,5 @@ void onInitialStateInitLAN();
|
||||
|
||||
void ip_ready_config_loaded_connecting_to_broker();
|
||||
|
||||
#endif //LIGHTHUB_MAIN_H
|
||||
void printCurentLanConfig();
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
[platformio]
|
||||
src_dir = lighthub
|
||||
env_default =
|
||||
megaatmega2560
|
||||
; megaatmega2560
|
||||
; megaatmega2560-net
|
||||
; due
|
||||
; esp8266
|
||||
; esp32
|
||||
; megaatmega2560-5500
|
||||
; due-5500
|
||||
due-5500
|
||||
; controllino
|
||||
; stm32
|
||||
|
||||
@@ -43,6 +43,8 @@ lib_deps =
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library for ESPx
|
||||
DHT sensor library
|
||||
Streaming
|
||||
https://github.com/Chris--A/PrintEx.git
|
||||
|
||||
[env:stm32]
|
||||
platform = ststm32
|
||||
@@ -119,6 +121,7 @@ lib_deps =
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
https://github.com/arcao/Syslog.git
|
||||
Streaming
|
||||
|
||||
[env:esp8266]
|
||||
platform = espressif8266
|
||||
@@ -193,6 +196,9 @@ lib_deps =
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
https://github.com/arcao/Syslog.git
|
||||
; Streaming
|
||||
; PrintEx
|
||||
https://github.com/livello/PrintEx.git#is-select-redecl
|
||||
|
||||
[env:controllino]
|
||||
platform = atmelavr
|
||||
|
||||
Reference in New Issue
Block a user