diff --git a/lighthub/main.cpp b/lighthub/main.cpp index e32272f..3633000 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -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< 0) switch (Ethernet.maintain()) { case NO_LINK: - debugSerial.println(F("No link")); + debugSerial<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<= 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<50){ - debugSerial.print(F("Too many MQTT connection errors. Restart LAN")); + debugSerial< 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<valuestring; if (owEmit) { strncpy(addrbuf, owEmit, sizeof(addrbuf)); - debugSerial.print(owEmit); - debugSerial.print(F("=")); - debugSerial.println(val); + debugSerial<valuestring; - } else debugSerial.println(F("1w-item not found in config")); + } else debugSerial<=1 ) { DMXoutSetup(maxChannels = aJson.getArrayItem(dmxoutArr, 1)->valueint); - //,aJson.getArrayItem(dmxoutArr, 0)->valueint); - debugSerial.print(F("DMX out started. Channels: ")); - debugSerial.println(maxChannels); + debugSerial<child; owReady = owSetup(&Changed); - if (owReady) debugSerial.println(F("One wire Ready")); + if (owReady) debugSerial<type == aJson_Object)) { DeviceAddress addr; - //debugSerial.print(F("Add:")),debugSerial.println(item->name); + //debugSerial<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<>>")); + 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<valueint; if (!aJson.getArrayItem(thermoExtensionArray, IET_ATTEMPTS)->valueint) { - debugSerial.print(thermoItem->name); - debugSerial.println(F(" Expired")); + debugSerial<name<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<= thermoSetting) { digitalWrite(thermoPin, LOW); - debugSerial.println(F(" OFF")); + debugSerial<