printex streaming

This commit is contained in:
livello
2018-10-10 14:24:18 +03:00
parent 40fe3d3d1b
commit 9432898b03
3 changed files with 24 additions and 13 deletions

View File

@@ -67,8 +67,13 @@ PWM Out
#include "Arduino.h" #include "Arduino.h"
#include "main.h" #include "main.h"
#include "options.h" #include "options.h"
//#include "Streaming.h" #ifdef WITH_STREAMING_LIB
#include "Streaming.h"
#else
#include "PrintEx.h" #include "PrintEx.h"
using namespace ios;
#endif
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
DueFlashStorage EEPROM; DueFlashStorage EEPROM;
@@ -79,7 +84,7 @@ EthernetClient ethClient;
EthernetClient ethClient; EthernetClient ethClient;
#endif #endif
#ifdef ESP8266 #ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <user_interface.h> #include <user_interface.h>
WiFiClient ethClient; WiFiClient ethClient;
@@ -169,7 +174,7 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
debugSerial<<((char) payload[i]); debugSerial<<((char) payload[i]);
debugSerial<<ios::endl; debugSerial<<endl;
if(!strcmp(topic,CMDTOPIC)) { if(!strcmp(topic,CMDTOPIC)) {
cmd_parse((char *)payload); cmd_parse((char *)payload);
@@ -210,8 +215,11 @@ void printIPAddress(IPAddress ipAddress) {
void printMACAddress() { void printMACAddress() {
debugSerial<<F("Configured MAC:"); debugSerial<<F("Configured MAC:");
for (byte i = 0; i < 6; i++) for (byte i = 0; i < 6; i++)
// (i < 5) ?debugSerial<<_HEX(mac[i])<<F(":"):debugSerial<<_HEX(mac[i])<<endl; #ifdef WITH_STREAMING_LIB
(i < 5) ?debugSerial<<ios::hex <<(mac[i])<<F(":"):debugSerial<<ios::hex<<(mac[i])<<ios::endl; (i < 5) ?debugSerial<<_HEX(mac[i])<<F(":"):debugSerial<<_HEX(mac[i])<<endl;
#else
(i < 5) ?debugSerial<<hex <<(mac[i])<<F(":"):debugSerial<<hex<<(mac[i])<<endl;
#endif
} }
void restoreState() { void restoreState() {
@@ -418,7 +426,7 @@ void ip_ready_config_loaded_connecting_to_broker() {
} }
void onInitialStateInitLAN() { void onInitialStateInitLAN() {
#if defined(ESP8266) and defined(WIFI_MANAGER_DISABLE) #if defined(ARDUINO_ARCH_ESP8266) and defined(WIFI_MANAGER_DISABLE)
if(!wifiInitialized) { if(!wifiInitialized) {
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
debugSerial<<F("WIFI AP/Password:")<<QUOTE(ESP_WIFI_AP)<<F("/")<<QUOTE(ESP_WIFI_PWD); debugSerial<<F("WIFI AP/Password:")<<QUOTE(ESP_WIFI_AP)<<F("/")<<QUOTE(ESP_WIFI_PWD);
@@ -448,7 +456,7 @@ void onInitialStateInitLAN() {
} }
#endif #endif
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266) #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
if (WiFi.status() == WL_CONNECTED) { if (WiFi.status() == WL_CONNECTED) {
debugSerial<<F("WiFi connected. IP address: "); debugSerial<<F("WiFi connected. IP address: ");
debugSerial<<WiFi.localIP(); debugSerial<<WiFi.localIP();
@@ -485,7 +493,7 @@ void onInitialStateInitLAN() {
} else Ethernet.begin(mac, ip, dns, gw); } else Ethernet.begin(mac, ip, dns, gw);
} else Ethernet.begin(mac, ip, dns); } else Ethernet.begin(mac, ip, dns);
} else Ethernet.begin(mac, ip); } else Ethernet.begin(mac, ip);
debugSerial<<ios::endl; debugSerial<<endl;
lanStatus = HAVE_IP_ADDRESS; lanStatus = HAVE_IP_ADDRESS;
} }
else { else {
@@ -530,7 +538,7 @@ void printCurentLanConfig();
#endif #endif
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
void softRebootFunc(){ void softRebootFunc(){
debugSerial<<F("ESP.restart();"); debugSerial<<F("ESP.restart();");
ESP.restart(); ESP.restart();
@@ -1017,7 +1025,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
return READ_RE_CONFIG;//-11; //Load from NVRAM return READ_RE_CONFIG;//-11; //Load from NVRAM
} }
#endif #endif
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266) #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
HTTPClient httpClient; HTTPClient httpClient;
String fullURI = "http://"; String fullURI = "http://";
fullURI+=configServer; fullURI+=configServer;
@@ -1106,7 +1114,7 @@ void setup_main() {
ArtnetSetup(); ArtnetSetup();
#endif #endif
#if defined(ESP8266) and not defined(WIFI_MANAGER_DISABLE) #if defined(ARDUINO_ARCH_ESP8266) and not defined(WIFI_MANAGER_DISABLE)
WiFiManager wifiManager; WiFiManager wifiManager;
#if defined(ESP_WIFI_AP) and defined(ESP_WIFI_PWD) #if defined(ESP_WIFI_AP) and defined(ESP_WIFI_PWD)
wifiManager.autoConnect(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD)); wifiManager.autoConnect(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD));
@@ -1383,7 +1391,7 @@ void thermoLoop(void) {
if (curTemp > THERMO_OVERHEAT_CELSIUS) mqttClient.publish("/alarm/ovrht", thermoItem->name); if (curTemp > THERMO_OVERHEAT_CELSIUS) mqttClient.publish("/alarm/ovrht", thermoItem->name);
debugSerial << ios::endl << thermoItem->name << F("Set:") << thermoSetting << F(" Cur:") << curTemp debugSerial << endl << thermoItem->name << F("Set:") << thermoSetting << F(" Cur:") << curTemp
<< F(" cmd:") << thermoStateCommand; << F(" cmd:") << thermoStateCommand;
pinMode(thermoPin, OUTPUT); pinMode(thermoPin, OUTPUT);
if (thermoDisabledOrDisconnected(thermoExtensionArray, thermoStateCommand)) { if (thermoDisabledOrDisconnected(thermoExtensionArray, thermoStateCommand)) {

View File

@@ -112,9 +112,11 @@
#define dmxin DmxDue1 #define dmxin DmxDue1
#endif #endif
#if defined(ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#undef _dmxin #undef _dmxin
#undef _modbus #undef _modbus
#define WITH_STREAMING_LIB
#ifndef DMX_DISABLE #ifndef DMX_DISABLE
#define _espdmx #define _espdmx
#endif #endif

View File

@@ -146,6 +146,7 @@ lib_deps =
WifiManager WifiManager
https://github.com/arcao/Syslog.git https://github.com/arcao/Syslog.git
https://github.com/livello/PrintEx.git#is-select-redecl https://github.com/livello/PrintEx.git#is-select-redecl
Streaming
[env:megaatmega2560-net] [env:megaatmega2560-net]
platform = atmelavr platform = atmelavr