mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
MCP23017 inputs
STATUSLED Compilation for all platforms WIFI_ENABLE option to allow wired connection for ESP Modbus, Syslog for ESP
This commit is contained in:
@@ -4,3 +4,4 @@
|
||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||
-DARTNET_ENABLE
|
||||
-DOTA
|
||||
-DSTATUSLED
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
#NO special flags
|
||||
-DSTATUSLED
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-DWiz5500
|
||||
-DARTNET_ENABLE
|
||||
-DDMX_SMOOTH
|
||||
-DSTATUSLED
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-DWIFI_ENABLE
|
||||
-DDMX_DISABLE
|
||||
-DMODBUS_DISABLE
|
||||
#-DOWIRE_DISABLE
|
||||
@@ -7,3 +8,4 @@
|
||||
-DAC_DISABLE
|
||||
#-DM5STACK
|
||||
-DOTA
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
-DWIFI_ENABLE
|
||||
-DMODBUS_DISABLE
|
||||
#-DCOUNTER_DISABLE
|
||||
-DOTA
|
||||
-std=gnu++11
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -6,3 +6,5 @@
|
||||
-DOTA
|
||||
-DSYSLOG_ENABLE
|
||||
-DWiz5500
|
||||
-DSTATUSLED
|
||||
-DMCP23017
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-DWIFI_ENABLE
|
||||
-DDMX_DISABLE
|
||||
-DMODBUS_DISABLE
|
||||
-DOWIRE_DISABLE
|
||||
@@ -6,3 +7,4 @@
|
||||
-DSPILED_DISABLE
|
||||
-DAC_DISABLE
|
||||
-DM5STACK
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||
-DAVR_DMXOUT_PIN=18
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-DWiz5500
|
||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||
-DAVR_DMXOUT_PIN=18
|
||||
-DSYSLOG_ENABLE
|
||||
|
||||
@@ -9,3 +9,5 @@
|
||||
-DCSSHDC_DISABLE
|
||||
-DSPILED_DISABLE
|
||||
-DAC_DISABLE
|
||||
-DSYSLOG_ENABLE
|
||||
-DMBUS_DISABLE
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-DDMX_DISABLE
|
||||
-DMODBUS_DISABLE
|
||||
-DMBUS_DISABLE
|
||||
-DOWIRE_DISABLE
|
||||
-DDHT_DISABLE
|
||||
-DCOUNTER_DISABLE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,11 @@ e-mail anklimov@gmail.com
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MCP23017
|
||||
#include "Adafruit_MCP23017.h"
|
||||
Adafruit_MCP23017 mcp;
|
||||
#endif
|
||||
|
||||
extern PubSubClient mqttClient;
|
||||
extern aJsonObject *root;
|
||||
extern int8_t ethernetIdleCount;
|
||||
@@ -89,7 +94,7 @@ Input::Input(int pin)
|
||||
|
||||
boolean Input::isValid ()
|
||||
{
|
||||
return (pin && store);
|
||||
return (store);
|
||||
}
|
||||
|
||||
void Input::Parse()
|
||||
@@ -115,21 +120,7 @@ void Input::Parse()
|
||||
void Input::setup()
|
||||
{
|
||||
if (!isValid() || (!root)) return;
|
||||
/*
|
||||
#ifndef CSSHDC_DISABLE
|
||||
if (inType == IN_CCS811)
|
||||
{
|
||||
in_ccs811 ccs811(this);
|
||||
ccs811.Setup();
|
||||
}
|
||||
else if (inType == IN_HDC1080)
|
||||
{
|
||||
in_hdc1080 hdc1080(this);
|
||||
hdc1080.Setup();
|
||||
}
|
||||
// TODO rest types setup
|
||||
#endif
|
||||
*/
|
||||
|
||||
store->aslong=0;
|
||||
uint8_t inputPinMode = INPUT; //if IN_ACTIVE_HIGH
|
||||
switch (inType)
|
||||
@@ -145,6 +136,24 @@ switch (inType)
|
||||
store->state=IS_IDLE;
|
||||
break;
|
||||
|
||||
#ifdef MCP23017
|
||||
|
||||
case IN_I2C | IN_PUSH_ON:
|
||||
case IN_I2C | IN_PUSH_TOGGLE :
|
||||
|
||||
inputPinMode = INPUT_PULLUP;
|
||||
|
||||
case IN_I2C | IN_PUSH_ON | IN_ACTIVE_HIGH:
|
||||
case IN_I2C | IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
|
||||
|
||||
mcp.begin();
|
||||
mcp.pinMode(pin, INPUT);
|
||||
if (inputPinMode == INPUT_PULLUP) mcp.pullUp(0, HIGH); // turn on a 100K pullup internally
|
||||
|
||||
store->state=IS_IDLE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IN_ANALOG:
|
||||
inputPinMode = INPUT_PULLUP;
|
||||
|
||||
@@ -194,6 +203,10 @@ switch (cause) {
|
||||
case IN_PUSH_ON | IN_ACTIVE_HIGH:
|
||||
case IN_PUSH_TOGGLE :
|
||||
case IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
|
||||
case IN_I2C | IN_PUSH_ON:
|
||||
case IN_I2C | IN_PUSH_ON | IN_ACTIVE_HIGH:
|
||||
case IN_I2C | IN_PUSH_TOGGLE :
|
||||
case IN_I2C | IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
|
||||
contactPoll(cause);
|
||||
break;
|
||||
case IN_ANALOG:
|
||||
@@ -667,8 +680,12 @@ void Input::contactPoll(short cause) {
|
||||
else inputOnLevel = LOW;
|
||||
|
||||
|
||||
#ifdef MCP23017
|
||||
if (inType & IN_I2C)
|
||||
currentInputState = (mcp.digitalRead(pin) == inputOnLevel);
|
||||
else
|
||||
#endif
|
||||
currentInputState = (digitalRead(pin) == inputOnLevel);
|
||||
|
||||
switch (store->state) //Timer based transitions
|
||||
{
|
||||
case IS_PRESSED:
|
||||
|
||||
@@ -24,6 +24,7 @@ e-mail anklimov@gmail.com
|
||||
#define IN_ACTIVE_HIGH 2 // High level = PUSHED/ CLOSED/ ON othervise :Low Level. Use INPUT mode instead of INPUT_PULLUP for digital pin
|
||||
#define IN_ANALOG 64 // Analog input
|
||||
#define IN_RE 32 // Rotary Encoder (for further use)
|
||||
#define IN_I2C 128 // MCP23017
|
||||
|
||||
#define IN_PUSH_ON 0 // PUSH - ON, Release - OFF (ovverrided by pcmd/rcmd) - DEFAULT
|
||||
#define IN_PUSH_TOGGLE 1 // Used for push buttons. Every physicall push toggle logical switch on/off. Toggle on leading edge
|
||||
|
||||
@@ -1457,7 +1457,7 @@ bool send = isNotRetainingStatus() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _modbus
|
||||
#ifndef MODBUS_DISABLE
|
||||
case CH_MODBUS:
|
||||
modbusDimmerSet(Par[0]);
|
||||
break;
|
||||
@@ -1540,7 +1540,7 @@ bool send = isNotRetainingStatus() ;
|
||||
debugSerial<<F("Pin:")<<iaddr<<F("=")<<k<<endl;
|
||||
break;
|
||||
}
|
||||
#ifdef _modbus
|
||||
#ifndef MODBUS_DISABLE
|
||||
case CH_VC:
|
||||
VacomSetFan(Par[0], cmd);
|
||||
break;
|
||||
@@ -1703,7 +1703,7 @@ POLL 2101x10
|
||||
[22:27:29] => poll: 0A 03 08 34 00 0A 87 18
|
||||
|
||||
*/
|
||||
#ifdef _modbus
|
||||
#ifndef MODBUS_DISABLE
|
||||
int Item::modbusDimmerSet(uint16_t value)
|
||||
{
|
||||
switch (getCmd())
|
||||
|
||||
@@ -67,55 +67,45 @@ PWM Out
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#ifdef WIFI_ENABLE
|
||||
WiFiClient ethClient;
|
||||
|
||||
#if not defined(WIFI_MANAGER_DISABLE)
|
||||
WiFiManager wifiManager;
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <Dhcp.h>
|
||||
EthernetClient ethClient;
|
||||
#endif
|
||||
|
||||
#if defined(OTA)
|
||||
#include <ArduinoOTA.h>
|
||||
#endif
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
DueFlashStorage EEPROM;
|
||||
EthernetClient ethClient;
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_AVR)
|
||||
EthernetClient ethClient;
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
WiFiClient ethClient;
|
||||
|
||||
#if not defined(WIFI_MANAGER_DISABLE)
|
||||
WiFiManager wifiManager;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
WiFiClient ethClient;
|
||||
NRFFlashStorage EEPROM;
|
||||
|
||||
#if not defined(WIFI_MANAGER_DISABLE)
|
||||
WiFiManager wifiManager;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_STM32
|
||||
EthernetClient ethClient;
|
||||
NRFFlashStorage EEPROM;
|
||||
#endif
|
||||
|
||||
#ifdef NRF5
|
||||
NRFFlashStorage EEPROM;
|
||||
EthernetClient ethClient;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SYSLOG_ENABLE
|
||||
#include <Syslog.h>
|
||||
#ifndef WIFI_ENABLE
|
||||
EthernetUDP udpSyslogClient;
|
||||
#else
|
||||
WiFiUDP udpSyslogClient;
|
||||
#endif
|
||||
Syslog udpSyslog(udpSyslogClient, SYSLOG_PROTO_BSD);
|
||||
unsigned long nextSyslogPingTime;
|
||||
static char syslogDeviceHostname[16];
|
||||
@@ -149,7 +139,7 @@ aJsonObject *items = NULL;
|
||||
aJsonObject *inputs = NULL;
|
||||
|
||||
aJsonObject *mqttArr = NULL;
|
||||
#ifndef MODBUS_DISABLE
|
||||
#ifdef _modbus
|
||||
aJsonObject *modbusObj = NULL;
|
||||
#endif
|
||||
#ifdef _owire
|
||||
@@ -176,7 +166,7 @@ bool configLoaded = false;
|
||||
int8_t ethernetIdleCount =0;
|
||||
int8_t configLocked = 0;
|
||||
|
||||
#ifdef _modbus
|
||||
#if defined (_modbus)
|
||||
ModbusMaster node;
|
||||
#endif
|
||||
|
||||
@@ -239,7 +229,7 @@ debugSerial<<F("Deleting conf. RAM was:")<<freeRam();
|
||||
#ifdef _owire
|
||||
owArr = NULL;
|
||||
#endif
|
||||
#ifndef MODBUS_DISABLE
|
||||
#ifdef _modbus
|
||||
modbusObj = NULL;
|
||||
#endif
|
||||
debugSerial<<F(" is ")<<freeRam()<<endl;
|
||||
@@ -417,7 +407,7 @@ lan_status lanLoop() {
|
||||
|
||||
|
||||
{
|
||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||
#if defined(WIFI_ENABLE)
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
wifiInitialized=false;
|
||||
@@ -731,7 +721,7 @@ void setupOTA(void)
|
||||
|
||||
|
||||
void onInitialStateInitLAN() {
|
||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||
#if defined(WIFI_ENABLE)
|
||||
#if defined(WIFI_MANAGER_DISABLE)
|
||||
if(WiFi.status() != WL_CONNECTED) {
|
||||
WiFi.mode(WIFI_STA); // ESP 32 - WiFi.disconnect(); instead
|
||||
@@ -782,7 +772,7 @@ wifiManager.setTimeout(30);
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#if defined(WIFI_ENABLE)
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
infoSerial<<F("WiFi connected. IP address: ")<<WiFi.localIP()<<endl;
|
||||
lanStatus = HAVE_IP_ADDRESS;//1;
|
||||
@@ -1073,7 +1063,7 @@ void printConfigSummary() {
|
||||
printBool(items);
|
||||
infoSerial<<F("\ninputs ");
|
||||
printBool(inputs);
|
||||
#ifndef MODBUS_DISABLE
|
||||
#ifdef _modbus
|
||||
infoSerial<<F("\nmodbus ");
|
||||
printBool(modbusObj);
|
||||
#endif
|
||||
@@ -1397,7 +1387,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
||||
}
|
||||
#endif
|
||||
#if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32) || defined (NRF5) //|| defined(ARDUINO_ARCH_ESP32) //|| defined(ARDUINO_ARCH_ESP8266)
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#if defined(WIFI_ENABLE)
|
||||
WiFiClient configEthClient;
|
||||
#else
|
||||
EthernetClient configEthClient;
|
||||
@@ -1561,7 +1551,7 @@ void setup_main() {
|
||||
ArtnetSetup();
|
||||
#endif
|
||||
|
||||
#if (defined(ARDUINO_ARCH_ESP8266) or defined(ARDUINO_ARCH_ESP32)) and not defined(WIFI_MANAGER_DISABLE)
|
||||
#if defined(WIFI_ENABLE) and not defined(WIFI_MANAGER_DISABLE)
|
||||
// WiFiManager wifiManager;
|
||||
wifiManager.setTimeout(180);
|
||||
|
||||
@@ -1612,7 +1602,7 @@ void printFirmwareVersionAndBuildOptions() {
|
||||
infoSerial<<F("\n(-)DMX");
|
||||
#endif
|
||||
|
||||
#ifndef MODBUS_DISABLE
|
||||
#ifdef _modbus
|
||||
infoSerial<<F("\n(+)MODBUS");
|
||||
#else
|
||||
infoSerial<<F("\n(-)MODBUS");
|
||||
@@ -1748,7 +1738,7 @@ if (!isMacValid) {
|
||||
mac[0]&=0xFE;
|
||||
mac[0]|=2;
|
||||
|
||||
#elif defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#elif defined(WIFI_ENABLE)
|
||||
//Using original MPU MAC
|
||||
WiFi.begin();
|
||||
WiFi.macAddress(mac);
|
||||
|
||||
@@ -23,15 +23,15 @@
|
||||
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||
//#include "SPIFFS.h"
|
||||
#include <ESP_EEPROM.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
//#include <ESP8266HTTPClient.h>
|
||||
//#include <ArduinoHttpClient.h>
|
||||
//#include "HttpClient.h"
|
||||
#include <WiFiManager.h>
|
||||
#include <DNSServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
//#include <WiFiManager.h>
|
||||
//#include <DNSServer.h>
|
||||
//#include <ESP8266WebServer.h>
|
||||
//#include <ESP8266WiFi.h>
|
||||
#include <user_interface.h>
|
||||
#define Ethernet WiFi
|
||||
//#define Ethernet WiFi
|
||||
#endif
|
||||
|
||||
#if defined ARDUINO_ARCH_ESP32
|
||||
@@ -41,15 +41,15 @@
|
||||
#include <NRFFlashStorage.h>
|
||||
//#include "HttpClient.h"
|
||||
//#include <ArduinoHttpClient.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <WebServer.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <DNSServer.h>
|
||||
//#include <HTTPClient.h>
|
||||
//#include <WiFi.h>
|
||||
//#include <WiFiClient.h>
|
||||
//#include <WiFiClientSecure.h>
|
||||
//#include <WebServer.h>
|
||||
//#include <WiFiManager.h>
|
||||
//include <DNSServer.h>
|
||||
|
||||
#define Ethernet WiFi
|
||||
//#define Ethernet WiFi
|
||||
#endif
|
||||
|
||||
#ifdef NRF5
|
||||
@@ -122,7 +122,7 @@ extern Streamlog debugSerial;
|
||||
#include "DallasTemperature.h"
|
||||
#endif
|
||||
|
||||
#ifndef MODBUS_DISABLE
|
||||
#ifdef _modbus
|
||||
#include <ModbusMaster.h>
|
||||
#endif
|
||||
|
||||
@@ -138,11 +138,27 @@ extern Streamlog debugSerial;
|
||||
#include "dmx.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIFI_ENABLE
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#include <WiFi.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <WebServer.h>
|
||||
#else
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <DNSServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#endif
|
||||
#define Ethernet WiFi
|
||||
#else //Wired connection
|
||||
#ifdef Wiz5500
|
||||
#include <Ethernet2.h>
|
||||
#else
|
||||
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(NRF5)
|
||||
#include <Ethernet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "item.h"
|
||||
#include <ModbusMaster.h>
|
||||
#include "main.h"
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
extern aJsonObject *modbusObj;
|
||||
extern ModbusMaster node;
|
||||
@@ -52,22 +53,22 @@ const reg_t regSize_P[] PROGMEM =
|
||||
|
||||
const serial_t serialModes_P[] PROGMEM =
|
||||
{
|
||||
{ "8E1", SERIAL_8E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
|
||||
{ "8N1", SERIAL_8N1},
|
||||
{ "8E2", SERIAL_8E2},
|
||||
{ "8N2", SERIAL_8N2},
|
||||
{ "8O1", SERIAL_8O1},
|
||||
{ "8O2", SERIAL_8O2},
|
||||
{ "8M1", SERIAL_8M1},
|
||||
{ "8S1", SERIAL_8S1},
|
||||
{ "7E1", SERIAL_7E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
|
||||
{ "7N1", SERIAL_7N1},
|
||||
{ "7E2", SERIAL_7E2},
|
||||
{ "7N2", SERIAL_7N2},
|
||||
{ "7O1", SERIAL_7O1},
|
||||
{ "7O2", SERIAL_7O2},
|
||||
{ "7M1", SERIAL_7M1},
|
||||
{ "7S1", SERIAL_7S1}
|
||||
{ "8E1", (uint16_t) SERIAL_8E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
|
||||
{ "8N1", (uint16_t) SERIAL_8N1},
|
||||
{ "8E2", (uint16_t) SERIAL_8E2},
|
||||
{ "8N2", (uint16_t) SERIAL_8N2},
|
||||
{ "8O1", (uint16_t) SERIAL_8O1},
|
||||
{ "8O2", (uint16_t) SERIAL_8O2},
|
||||
// { "8M1", SERIAL_8M1},
|
||||
// { "8S1", SERIAL_8S1},
|
||||
{ "7E1", (uint16_t) SERIAL_7E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
|
||||
{ "7N1", (uint16_t) SERIAL_7N1},
|
||||
{ "7E2", (uint16_t) SERIAL_7E2},
|
||||
{ "7N2", (uint16_t) SERIAL_7N2},
|
||||
{ "7O1", (uint16_t) SERIAL_7O1},
|
||||
{ "7O2", (uint16_t) SERIAL_7O2}
|
||||
// { "7M1", SERIAL_7M1},
|
||||
// { "7S1", SERIAL_7S1}
|
||||
} ;
|
||||
|
||||
#define serialModesNum sizeof(serialModes_P)/sizeof(serial_t)
|
||||
@@ -261,7 +262,13 @@ if (store->pollingRegisters && !modbusBusy && (Status() == CST_INITIALIZED) && i
|
||||
debugSerial<<F("Poll ")<< item->itemArr->name << endl;
|
||||
modbusBusy=1;
|
||||
//store->serialParam=(USARTClass::USARTModes) SERIAL_8N1;
|
||||
#if defined (__SAM3X8E__)
|
||||
modbusSerial.begin(store->baud, static_cast <USARTClass::USARTModes> (store->serialParam));
|
||||
#elif defined (ARDUINO_ARCH_ESP8266)
|
||||
modbusSerial.begin(store->baud, static_cast <SerialConfig>(store->serialParam));
|
||||
#else
|
||||
modbusSerial.begin(store->baud, (store->serialParam));
|
||||
#endif
|
||||
debugSerial<< store->baud << F("---")<< store->serialParam<<endl;
|
||||
node.begin(item->getArg(0), modbusSerial);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
#define _owire
|
||||
#endif
|
||||
|
||||
#ifndef MODBUS_DISABLE
|
||||
#if !(defined (MODBUS_DISABLE) && defined (MBUS_DISABLE))
|
||||
#define _modbus
|
||||
#endif
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#undef _dmxin
|
||||
#undef _modbus
|
||||
//#undef _modbus
|
||||
|
||||
#ifndef DMX_DISABLE
|
||||
#define _espdmx
|
||||
@@ -183,13 +183,14 @@
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#undef _dmxin
|
||||
#undef _modbus
|
||||
//#undef _modbus
|
||||
|
||||
#ifndef DMX_DISABLE
|
||||
#define _espdmx
|
||||
#endif
|
||||
//#undef _dmxout
|
||||
#undef modbusSerial
|
||||
//#undef modbusSerial
|
||||
#define modbusSerial Serial2
|
||||
#endif
|
||||
|
||||
#ifndef _dmxout
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
#include "streamlog.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
Streamlog::Streamlog (UARTClass * _serialPort, int _severity , Syslog * _syslog )
|
||||
#ifdef SYSLOG_ENABLE
|
||||
Streamlog::Streamlog (HardwareSerial * _serialPort, int _severity , Syslog * _syslog )
|
||||
{
|
||||
serialPort=_serialPort;
|
||||
severity=_severity;
|
||||
syslog=_syslog;
|
||||
}
|
||||
#else
|
||||
Streamlog::Streamlog (HardwareSerial * _serialPort, int _severity)
|
||||
{
|
||||
serialPort=_serialPort;
|
||||
severity=_severity;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Streamlog::begin(unsigned long speed)
|
||||
{
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
#include <Print.h>
|
||||
#include <UARTClass.h>
|
||||
#include <Syslog.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define LOG_DEBUG 7
|
||||
#define LOG_INFO 6
|
||||
#define LOG_ERROR 3
|
||||
|
||||
#ifndef LOGBUFFER_SIZE
|
||||
#define LOGBUFFER_SIZE 80
|
||||
#endif
|
||||
|
||||
static uint8_t serialDebugLevel = 7;
|
||||
static uint8_t udpDebugLevel =7;
|
||||
|
||||
#ifdef SYSLOG_ENABLE
|
||||
#include <Syslog.h>
|
||||
static char logBuffer[LOGBUFFER_SIZE];
|
||||
static int logBufferPos=0;
|
||||
#endif
|
||||
|
||||
#define LOG_DEBUG 7
|
||||
#define LOG_INFO 6
|
||||
#define LOG_ERROR 3
|
||||
|
||||
static uint8_t serialDebugLevel = 7;
|
||||
static uint8_t udpDebugLevel =7;
|
||||
|
||||
class Streamlog : public Print
|
||||
{
|
||||
public:
|
||||
Streamlog (UARTClass * _serialPort, int _severity = LOG_DEBUG, Syslog * _syslog = NULL);
|
||||
#ifdef SYSLOG_ENABLE
|
||||
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG, Syslog * _syslog = NULL);
|
||||
#else
|
||||
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG);
|
||||
#endif
|
||||
// {serialPort=_serialPort;severity=_severity; syslog=_syslog; }
|
||||
void begin(unsigned long speed);
|
||||
void end() ;
|
||||
@@ -36,6 +40,8 @@ class Streamlog : public Print
|
||||
operator bool() {return true;};
|
||||
private:
|
||||
uint16_t severity;
|
||||
UARTClass *serialPort;
|
||||
HardwareSerial *serialPort;
|
||||
#ifdef SYSLOG_ENABLE
|
||||
Syslog * syslog;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -632,22 +632,27 @@ itemCmd mapInt(int32_t arg, aJsonObject* map)
|
||||
|
||||
statusLED::statusLED(uint8_t pattern)
|
||||
{
|
||||
#if defined (STATUSLED)
|
||||
pinMode(pinRED, OUTPUT);
|
||||
pinMode(pinGREEN, OUTPUT);
|
||||
pinMode(pinBLUE, OUTPUT);
|
||||
set(pattern);
|
||||
timestamp=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void statusLED::show (uint8_t pattern)
|
||||
{
|
||||
#if defined (STATUSLED)
|
||||
digitalWrite(pinRED,(pattern & ledRED)?HIGH:LOW );
|
||||
digitalWrite(pinGREEN,(pattern & ledGREEN)?HIGH:LOW);
|
||||
digitalWrite(pinBLUE,(pattern & ledBLUE)?HIGH:LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void statusLED::set (uint8_t pattern)
|
||||
{
|
||||
#if defined (STATUSLED)
|
||||
short newStat = pattern & ledParams;
|
||||
|
||||
if (newStat!=(curStat & ledParams))
|
||||
@@ -656,17 +661,20 @@ void statusLED::set (uint8_t pattern)
|
||||
show(pattern);
|
||||
curStat=newStat | (curStat & ~ledParams);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void statusLED::flash(uint8_t pattern)
|
||||
{
|
||||
#if defined (STATUSLED)
|
||||
show(pattern);
|
||||
curStat|=ledFlash;
|
||||
#endif
|
||||
}
|
||||
|
||||
void statusLED::poll()
|
||||
|
||||
{
|
||||
#if defined (STATUSLED)
|
||||
if (curStat & ledFlash)
|
||||
{
|
||||
curStat&=~ledFlash;
|
||||
@@ -686,7 +694,7 @@ if (millis()>timestamp)
|
||||
else show(curStat);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ default_envs =
|
||||
; mega2560-5500
|
||||
|
||||
; LightHub controller HW revision 2.1 and above (Wiznet 5500 CS on pin 53)
|
||||
lighthub21
|
||||
; lighthub21
|
||||
|
||||
; Arduino DUE + Ethernet shield Wiznet 5100
|
||||
; due-5100
|
||||
@@ -73,6 +73,7 @@ lib_ignore =
|
||||
WifiManager
|
||||
Ethernet
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
httpClient
|
||||
FastLED
|
||||
ESPDMX
|
||||
@@ -108,7 +109,9 @@ lib_deps =
|
||||
https://github.com/anklimov/NRFFlashStorage
|
||||
https://github.com/adafruit/Adafruit_NeoPixel.git
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
; https://github.com/livello/PrintEx#is-select-redecl
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
https://github.com/arcao/Syslog.git
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -129,6 +132,7 @@ lib_ignore =
|
||||
Ethernet
|
||||
Ethernet2
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
EEPROM
|
||||
Artnet
|
||||
UIPEthernet
|
||||
@@ -160,6 +164,8 @@ lib_deps =
|
||||
M5Stack
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
https://github.com/arcao/Syslog.git
|
||||
|
||||
[env:esp32-wifi]
|
||||
platform = espressif32
|
||||
@@ -179,6 +185,7 @@ lib_ignore =
|
||||
Ethernet
|
||||
Ethernet2
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
EEPROM
|
||||
Artnet
|
||||
UIPEthernet
|
||||
@@ -210,6 +217,8 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
https://github.com/arcao/Syslog.git
|
||||
|
||||
|
||||
[env:due-5100]
|
||||
@@ -243,7 +252,7 @@ lib_deps =
|
||||
https://github.com/anklimov/aJson
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet5100
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED@3.3.2
|
||||
@@ -257,9 +266,11 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
|
||||
[env:due]
|
||||
;Experimental target with universal Ethernet Library
|
||||
platform = atmelsam
|
||||
framework = arduino
|
||||
board = due
|
||||
@@ -281,6 +292,7 @@ lib_ignore =
|
||||
WifiManager
|
||||
Ethernet3
|
||||
Ethernet2
|
||||
Ethernet5100
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
UIPEthernet
|
||||
@@ -311,6 +323,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
[env:mega2560slim-5100]
|
||||
platform = atmelavr
|
||||
@@ -325,6 +338,7 @@ lib_ignore =
|
||||
DueFlashStorage
|
||||
WifiManager
|
||||
Ethernet3
|
||||
Ethernet
|
||||
HTTPClient
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
@@ -340,7 +354,7 @@ lib_deps =
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/DMXSerial
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet5100
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED@3.3.2
|
||||
@@ -353,6 +367,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
[env:mega2560-5500]
|
||||
platform = atmelavr
|
||||
@@ -367,6 +382,7 @@ lib_ignore =
|
||||
WifiManager
|
||||
Ethernet
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
HTTPClient
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
@@ -394,6 +410,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
|
||||
[env:esp8266-wifi]
|
||||
@@ -424,6 +441,7 @@ lib_ignore =
|
||||
ArduinoHttpClient
|
||||
Ethernet3
|
||||
Ethernet2
|
||||
Ethernet5100
|
||||
Ethernet
|
||||
NRFFlashStorage
|
||||
UIPEthernet
|
||||
@@ -451,6 +469,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA.git
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
|
||||
|
||||
@@ -470,6 +489,7 @@ lib_ignore =
|
||||
WifiManager
|
||||
Ethernet3
|
||||
Ethernet2
|
||||
Ethernet
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
UIPEthernet
|
||||
@@ -484,7 +504,7 @@ lib_deps =
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/DMXSerial
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet5100
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED@3.3.2
|
||||
@@ -496,6 +516,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
[env:due-5500]
|
||||
platform = atmelsam
|
||||
@@ -514,6 +535,7 @@ lib_ignore =
|
||||
httpClient
|
||||
Ethernet
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
UIPEthernet
|
||||
@@ -545,6 +567,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
[env:lighthub21]
|
||||
platform = atmelsam
|
||||
@@ -565,6 +588,7 @@ lib_ignore =
|
||||
httpClient
|
||||
Ethernet
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
NRFFlashStorage
|
||||
WebServer
|
||||
UIPEthernet
|
||||
@@ -596,6 +620,7 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
|
||||
[env:controllino]
|
||||
@@ -627,7 +652,7 @@ lib_deps =
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/DMXSerial
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet5100
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED@3.3.2
|
||||
@@ -640,6 +665,8 @@ lib_deps =
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
https://github.com/arcao/Syslog.git
|
||||
|
||||
[env:stm32-enc2860]
|
||||
platform = ststm32
|
||||
@@ -688,3 +715,4 @@ lib_deps =
|
||||
UIPEthernet
|
||||
https://github.com/anklimov/NRFFlashStorage
|
||||
Adafruit NeoPixel
|
||||
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
|
||||
|
||||
Reference in New Issue
Block a user