mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 03:39:49 +03:00
AC CRC fix
syslog auto suspending when no ARP responce optiboot env slimming generic 2560 environment (any eth)
This commit is contained in:
@@ -17,3 +17,4 @@
|
|||||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||||
-DOTA_PORT=80
|
-DOTA_PORT=80
|
||||||
-DMERCURY_ENABLE
|
-DMERCURY_ENABLE
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -59,3 +59,4 @@
|
|||||||
-D CORS=\"*\"
|
-D CORS=\"*\"
|
||||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||||
#-DMERCURY_ENABLE
|
#-DMERCURY_ENABLE
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -47,3 +47,4 @@
|
|||||||
|
|
||||||
# WAK for HDC1080 (pin D3 on wemos is IO0)
|
# WAK for HDC1080 (pin D3 on wemos is IO0)
|
||||||
-D WAK_PIN=D3
|
-D WAK_PIN=D3
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -41,3 +41,4 @@
|
|||||||
-D MERCURY_ENABLE
|
-D MERCURY_ENABLE
|
||||||
#-D IPMODBUS
|
#-D IPMODBUS
|
||||||
-D CONFIG_CLEAN_PIN=2
|
-D CONFIG_CLEAN_PIN=2
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
-DCOUNTER_DISABLE
|
-DCOUNTER_DISABLE
|
||||||
-DSPILED_DISABLE
|
-DSPILED_DISABLE
|
||||||
-DAC_DISABLE
|
-DAC_DISABLE
|
||||||
|
-DHSV_DISABLE
|
||||||
|
-DPWM_DISABLE
|
||||||
-DM5STACK
|
-DM5STACK
|
||||||
#-DSYSLOG_ENABLE
|
#-DSYSLOG_ENABLE
|
||||||
-DUSE_1W_PIN=16
|
-DUSE_1W_PIN=16
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-DWiz5500
|
#-DWiz5500
|
||||||
#-DMODBUS_SERIAL_PARAM=SERIAL_8E1
|
#-DMODBUS_SERIAL_PARAM=SERIAL_8E1
|
||||||
-DAVR_DMXOUT_PIN=18
|
-DAVR_DMXOUT_PIN=18
|
||||||
-DSYSLOG_ENABLE
|
-DSYSLOG_ENABLE
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
-DCSSHDC_DISABLE
|
-DCSSHDC_DISABLE
|
||||||
-DSPILED_DISABLE
|
-DSPILED_DISABLE
|
||||||
-DAC_DISABLE
|
-DAC_DISABLE
|
||||||
|
-DOTA
|
||||||
|
|
||||||
|
|
||||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||||
@@ -20,6 +20,9 @@
|
|||||||
-DARDUINO_OTA_MDNS_DISABLE
|
-DARDUINO_OTA_MDNS_DISABLE
|
||||||
-DMDNS_ENABLE
|
-DMDNS_ENABLE
|
||||||
|
|
||||||
|
-DHSV_DISABLE
|
||||||
|
-DPWM_DISABLE
|
||||||
|
|
||||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||||
-D CORS=\"*\"
|
-D CORS=\"*\"
|
||||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||||
|
|||||||
@@ -17,3 +17,4 @@
|
|||||||
-D CORS=\"*\"
|
-D CORS=\"*\"
|
||||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||||
#-DMERCURY_ENABLE
|
#-DMERCURY_ENABLE
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -40,3 +40,4 @@
|
|||||||
#HAL_SD_MODULE_DISABLED
|
#HAL_SD_MODULE_DISABLED
|
||||||
#HAL_DAC_MODULE_DISABLED
|
#HAL_DAC_MODULE_DISABLED
|
||||||
#-DMERCURY_ENABLE
|
#-DMERCURY_ENABLE
|
||||||
|
-D ROTARYENCODER
|
||||||
@@ -455,18 +455,20 @@ debugSerial<<F("AC: ")<<portNum<<F(" >> ");
|
|||||||
debugSerial.print(store->data[i], HEX);
|
debugSerial.print(store->data[i], HEX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
debugSerial.println('.');
|
||||||
|
|
||||||
if (store->data[36] == getCRC(store->data,36))
|
uint8_t crc=getCRC(store->data,36);
|
||||||
|
|
||||||
|
if (store->data[36] == crc)
|
||||||
{
|
{
|
||||||
if (store->data[36] != store->inCheck){
|
debugSerial<<F("AC: OK")<<endl;
|
||||||
|
if (store->data[36] != store->inCheck)
|
||||||
|
{ //Updated
|
||||||
store->inCheck = store->data[36];
|
store->inCheck = store->data[36];
|
||||||
InsertData(store->data, 37);
|
InsertData(store->data, 37);
|
||||||
debugSerial<<F("AC: OK");
|
|
||||||
}
|
}
|
||||||
else debugSerial<<F("AC: Bad CRC");
|
|
||||||
}
|
}
|
||||||
|
else debugSerial<<F("AC: Bad CRC")<<endl;
|
||||||
debugSerial.println();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
class out_AC : public abstractOut {
|
class out_AC : public abstractOut {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
out_AC():store(NULL){};
|
out_AC():store(NULL),portNum(0),ACSerial(NULL){};
|
||||||
void link(Item * _item){abstractOut::link(_item); if (_item) {store = (acPersistent *) item->getPersistent(); getConfig();} else store = NULL;};
|
void link(Item * _item){abstractOut::link(_item); if (_item) {store = (acPersistent *) item->getPersistent(); getConfig();} else store = NULL;};
|
||||||
void getConfig();
|
void getConfig();
|
||||||
int Setup() override;
|
int Setup() override;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
#include "streamlog.h"
|
#include "streamlog.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "statusled.h"
|
#include "statusled.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef SYSLOG_ENABLE
|
#ifdef SYSLOG_ENABLE
|
||||||
char logBuffer[LOGBUFFER_SIZE];
|
char logBuffer[LOGBUFFER_SIZE];
|
||||||
int logBufferPos=0;
|
int logBufferPos=0;
|
||||||
|
uint32_t silentTS=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t serialDebugLevel = 7;
|
uint8_t serialDebugLevel = 7;
|
||||||
@@ -22,6 +24,7 @@ Streamlog::Streamlog (SerialPortType * _serialPort, uint8_t _severity , Syslog *
|
|||||||
severity=_severity;
|
severity=_severity;
|
||||||
syslog=_syslog;
|
syslog=_syslog;
|
||||||
ledPattern=_ledPattern;
|
ledPattern=_ledPattern;
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Streamlog::Streamlog (SerialPortType * _serialPort, uint8_t _severity, uint8_t _ledPattern)
|
Streamlog::Streamlog (SerialPortType * _serialPort, uint8_t _severity, uint8_t _ledPattern)
|
||||||
@@ -76,7 +79,30 @@ if (syslogInitialized && (udpDebugLevel>=severity))
|
|||||||
if (ch=='\n')
|
if (ch=='\n')
|
||||||
{
|
{
|
||||||
logBuffer[logBufferPos]=0;
|
logBuffer[logBufferPos]=0;
|
||||||
if (syslog) syslog->log(severity,(char *)logBuffer);
|
if (syslog && (!silentTS || isTimeOver(silentTS,millis(),30000UL)))
|
||||||
|
|
||||||
|
{
|
||||||
|
uint32_t ts = millis();
|
||||||
|
syslog->log(severity,(char *)logBuffer);
|
||||||
|
if (millis() - ts > 100UL)
|
||||||
|
{
|
||||||
|
#if !defined(noSerial)
|
||||||
|
if (serialPort) serialPort->println(F("Syslog suspended"));
|
||||||
|
#endif
|
||||||
|
silentTS = millisNZ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (silentTS)
|
||||||
|
{
|
||||||
|
#if !defined(noSerial)
|
||||||
|
if (serialPort) serialPort->println(F("Syslog resumed"));
|
||||||
|
#endif
|
||||||
|
silentTS = 0;
|
||||||
|
syslog->log(severity,F("Syslog resumed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
logBufferPos=0;
|
logBufferPos=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -480,26 +480,26 @@ lib_deps =
|
|||||||
;br3ttb/PID@^1.2.1
|
;br3ttb/PID@^1.2.1
|
||||||
https://github.com/anklimov/Arduino-PID-Library.git
|
https://github.com/anklimov/Arduino-PID-Library.git
|
||||||
ArduinoMDNS
|
ArduinoMDNS
|
||||||
https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
;https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
||||||
rweather/Crypto
|
rweather/Crypto
|
||||||
https://github.com/mathertel/RotaryEncoder
|
https://github.com/mathertel/RotaryEncoder
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
|
||||||
[env:mega2560-5500]
|
[env:mega2560]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
framework = arduino
|
framework = arduino
|
||||||
build_flags = !python get_build_flags.py mega2560-5500
|
build_flags = !python get_build_flags.py mega2560
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
;DS2482_OneWire //UNCOMMENT for software 1-wire driver
|
;DS2482_OneWire //UNCOMMENT for software 1-wire driver
|
||||||
DHT sensor library for ESPx
|
DHT sensor library for ESPx
|
||||||
DmxDue
|
DmxDue
|
||||||
DueFlashStorage
|
DueFlashStorage
|
||||||
WifiManager
|
WifiManager
|
||||||
Ethernet
|
;Ethernet
|
||||||
Ethernet3
|
Ethernet3
|
||||||
Ethernet5100
|
Ethernet5100
|
||||||
HTTPClient
|
HTTPClient
|
||||||
@@ -517,7 +517,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet2
|
https://github.com/anklimov/Ethernet.git
|
||||||
https://github.com/anklimov/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
@@ -536,6 +536,7 @@ lib_deps =
|
|||||||
ArduinoMDNS
|
ArduinoMDNS
|
||||||
https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
||||||
https://github.com/mathertel/RotaryEncoder
|
https://github.com/mathertel/RotaryEncoder
|
||||||
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user