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:
@@ -16,4 +16,5 @@
|
||||
|
||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||
-DOTA_PORT=80
|
||||
-DMERCURY_ENABLE
|
||||
-DMERCURY_ENABLE
|
||||
-D ROTARYENCODER
|
||||
@@ -58,4 +58,5 @@
|
||||
-DMQTT_SOCKET_TIMEOUT=20
|
||||
-D CORS=\"*\"
|
||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||
#-DMERCURY_ENABLE
|
||||
#-DMERCURY_ENABLE
|
||||
-D ROTARYENCODER
|
||||
@@ -46,4 +46,5 @@
|
||||
-D PWM_DISABLE
|
||||
|
||||
# WAK for HDC1080 (pin D3 on wemos is IO0)
|
||||
-D WAK_PIN=D3
|
||||
-D WAK_PIN=D3
|
||||
-D ROTARYENCODER
|
||||
@@ -40,4 +40,5 @@
|
||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||
-D MERCURY_ENABLE
|
||||
#-D IPMODBUS
|
||||
-D CONFIG_CLEAN_PIN=2
|
||||
-D CONFIG_CLEAN_PIN=2
|
||||
-D ROTARYENCODER
|
||||
@@ -6,6 +6,8 @@
|
||||
-DCOUNTER_DISABLE
|
||||
-DSPILED_DISABLE
|
||||
-DAC_DISABLE
|
||||
-DHSV_DISABLE
|
||||
-DPWM_DISABLE
|
||||
-DM5STACK
|
||||
#-DSYSLOG_ENABLE
|
||||
-DUSE_1W_PIN=16
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-DWiz5500
|
||||
#-DWiz5500
|
||||
#-DMODBUS_SERIAL_PARAM=SERIAL_8E1
|
||||
-DAVR_DMXOUT_PIN=18
|
||||
-DSYSLOG_ENABLE
|
||||
@@ -10,6 +10,7 @@
|
||||
-DCSSHDC_DISABLE
|
||||
-DSPILED_DISABLE
|
||||
-DAC_DISABLE
|
||||
-DOTA
|
||||
|
||||
|
||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||
@@ -20,6 +20,9 @@
|
||||
-DARDUINO_OTA_MDNS_DISABLE
|
||||
-DMDNS_ENABLE
|
||||
|
||||
-DHSV_DISABLE
|
||||
-DPWM_DISABLE
|
||||
|
||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||
-D CORS=\"*\"
|
||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
|
||||
-D CORS=\"*\"
|
||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||
#-DMERCURY_ENABLE
|
||||
#-DMERCURY_ENABLE
|
||||
-D ROTARYENCODER
|
||||
@@ -39,4 +39,5 @@
|
||||
#HAL_ETH_MODULE_DISABLED
|
||||
#HAL_SD_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);
|
||||
}
|
||||
}
|
||||
|
||||
if (store->data[36] == getCRC(store->data,36))
|
||||
{
|
||||
if (store->data[36] != store->inCheck){
|
||||
store->inCheck = store->data[36];
|
||||
InsertData(store->data, 37);
|
||||
debugSerial<<F("AC: OK");
|
||||
}
|
||||
else debugSerial<<F("AC: Bad CRC");
|
||||
}
|
||||
debugSerial.println('.');
|
||||
|
||||
debugSerial.println();
|
||||
uint8_t crc=getCRC(store->data,36);
|
||||
|
||||
if (store->data[36] == crc)
|
||||
{
|
||||
debugSerial<<F("AC: OK")<<endl;
|
||||
if (store->data[36] != store->inCheck)
|
||||
{ //Updated
|
||||
store->inCheck = store->data[36];
|
||||
InsertData(store->data, 37);
|
||||
}
|
||||
}
|
||||
else debugSerial<<F("AC: Bad CRC")<<endl;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
class out_AC : public abstractOut {
|
||||
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 getConfig();
|
||||
int Setup() override;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include "streamlog.h"
|
||||
#include <Arduino.h>
|
||||
#include "statusled.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef SYSLOG_ENABLE
|
||||
char logBuffer[LOGBUFFER_SIZE];
|
||||
int logBufferPos=0;
|
||||
uint32_t silentTS=0;
|
||||
#endif
|
||||
|
||||
uint8_t serialDebugLevel = 7;
|
||||
@@ -22,6 +24,7 @@ Streamlog::Streamlog (SerialPortType * _serialPort, uint8_t _severity , Syslog *
|
||||
severity=_severity;
|
||||
syslog=_syslog;
|
||||
ledPattern=_ledPattern;
|
||||
|
||||
}
|
||||
#else
|
||||
Streamlog::Streamlog (SerialPortType * _serialPort, uint8_t _severity, uint8_t _ledPattern)
|
||||
@@ -76,7 +79,30 @@ if (syslogInitialized && (udpDebugLevel>=severity))
|
||||
if (ch=='\n')
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -480,26 +480,26 @@ lib_deps =
|
||||
;br3ttb/PID@^1.2.1
|
||||
https://github.com/anklimov/Arduino-PID-Library.git
|
||||
ArduinoMDNS
|
||||
https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
||||
;https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
||||
rweather/Crypto
|
||||
https://github.com/mathertel/RotaryEncoder
|
||||
|
||||
monitor_speed = 115200
|
||||
|
||||
|
||||
[env:mega2560-5500]
|
||||
[env:mega2560]
|
||||
platform = atmelavr
|
||||
board = megaatmega2560
|
||||
monitor_speed = 115200
|
||||
framework = arduino
|
||||
build_flags = !python get_build_flags.py mega2560-5500
|
||||
build_flags = !python get_build_flags.py mega2560
|
||||
lib_ignore =
|
||||
;DS2482_OneWire //UNCOMMENT for software 1-wire driver
|
||||
DHT sensor library for ESPx
|
||||
DmxDue
|
||||
DueFlashStorage
|
||||
WifiManager
|
||||
Ethernet
|
||||
;Ethernet
|
||||
Ethernet3
|
||||
Ethernet5100
|
||||
HTTPClient
|
||||
@@ -517,7 +517,7 @@ lib_deps =
|
||||
https://github.com/anklimov/CmdArduino
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
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/Artnet.git
|
||||
FastLED@3.3.2
|
||||
@@ -536,6 +536,7 @@ lib_deps =
|
||||
ArduinoMDNS
|
||||
https://github.com/khoih-prog/TimerInterrupt_Generic.git
|
||||
https://github.com/mathertel/RotaryEncoder
|
||||
https://github.com/anklimov/ArduinoOTA
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user