AC CRC fix

syslog auto suspending when no ARP responce
optiboot env slimming
generic 2560 environment (any eth)
This commit is contained in:
2025-05-02 00:45:49 +03:00
parent 5480412f1b
commit 53c5748c14
13 changed files with 66 additions and 25 deletions

View File

@@ -17,3 +17,4 @@
-DRESTART_LAN_ON_MQTT_ERRORS
-DOTA_PORT=80
-DMERCURY_ENABLE
-D ROTARYENCODER

View File

@@ -59,3 +59,4 @@
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
#-DMERCURY_ENABLE
-D ROTARYENCODER

View File

@@ -47,3 +47,4 @@
# WAK for HDC1080 (pin D3 on wemos is IO0)
-D WAK_PIN=D3
-D ROTARYENCODER

View File

@@ -41,3 +41,4 @@
-D MERCURY_ENABLE
#-D IPMODBUS
-D CONFIG_CLEAN_PIN=2
-D ROTARYENCODER

View File

@@ -6,6 +6,8 @@
-DCOUNTER_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DHSV_DISABLE
-DPWM_DISABLE
-DM5STACK
#-DSYSLOG_ENABLE
-DUSE_1W_PIN=16

View File

@@ -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

View File

@@ -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\"

View File

@@ -17,3 +17,4 @@
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
#-DMERCURY_ENABLE
-D ROTARYENCODER

View File

@@ -40,3 +40,4 @@
#HAL_SD_MODULE_DISABLED
#HAL_DAC_MODULE_DISABLED
#-DMERCURY_ENABLE
-D ROTARYENCODER

View File

@@ -455,18 +455,20 @@ debugSerial<<F("AC: ")<<portNum<<F(" >> ");
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];
InsertData(store->data, 37);
debugSerial<<F("AC: OK");
}
else debugSerial<<F("AC: Bad CRC");
}
debugSerial.println();
else debugSerial<<F("AC: Bad CRC")<<endl;
}
return true;
};

View File

@@ -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;

View File

@@ -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

View File

@@ -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