mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-11 09:04:53 +00:00
Merge pull request #5621 from tonhuisman/feature/Aug-2026-fixes-and-improvements
[Misc] Aug 2026 fixes and improvements
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
.. |P157_type| replace:: :cyan:`Display`
|
||||
.. |P157_typename| replace:: :cyan:`Display - HT16K33 14-/7-segment`
|
||||
.. |P157_porttype| replace:: `.`
|
||||
.. |P157_status| replace:: :green:`DISPLAY` :yellow:`COLLECTION`
|
||||
.. |P157_status| replace:: :yellow:`DISPLAY` :yellow:`COLLECTION`
|
||||
.. |P157_status_lb| replace:: `.`
|
||||
.. |P157_github| replace:: P157_14DGT.ino
|
||||
.. _P157_github: https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P157_14DGT.ino
|
||||
|
||||
@@ -411,18 +411,6 @@ See for more detailed information "Controller - ESPEasy P2P Networking"
|
||||
Special and Experimental Settings
|
||||
---------------------------------
|
||||
|
||||
Fixed IP Octet
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Sets the last byte(octet) of the IP address to this value, regardless of what IP is given using DHCP (all other settings received via DHCP will be used)
|
||||
|
||||
So if you receive 192.168.1.234 from your DHCP server and this value is set to "10",
|
||||
then the used IP in your node is 192.168.1.10.
|
||||
But since you're receiving more information from the DHCP server,
|
||||
like subnet mask / gateway / DNS, it may still be useful.
|
||||
This allows a somewhat static IP in your network (N.B. use it with an 'octet' outside the range of the DHCP IPs) while still having set to DHCP.
|
||||
So if you take the node to another network which does use 192.168.52.x then you will know it will be on 192.168.52.10 (when setting this value to "10")
|
||||
|
||||
WD I2C Address
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
+4
-4
@@ -34,15 +34,15 @@ extra_configs =
|
||||
platformio_esp32p4r3_envs.ini
|
||||
|
||||
|
||||
;default_envs = normal_ESP32_4M
|
||||
;default_envs = normal_ESP32_4M316k
|
||||
default_envs = max_ESP32_16M8M
|
||||
;default_envs = max_ESP32c5_8M1M
|
||||
|
||||
;default_envs = normal_ESP32c6_4M316k_LittleFS_CDC
|
||||
; default_envs = custom_ESP8266_4M1M
|
||||
;default_envs = normal_ESP32c6_4M316k
|
||||
; default_envs = custom_274_ESP8266_4M1M
|
||||
|
||||
;default_envs = normal_ESP8266_4M1M
|
||||
;default_envs = test_beta_ESP8266_4M1M
|
||||
;default_envs = custom_beta_2ndheap_ESP8266_4M1M
|
||||
; ..etc
|
||||
;build_cache_dir = $PROJECT_DIR\.buildcache
|
||||
|
||||
|
||||
@@ -634,7 +634,6 @@
|
||||
|
||||
#define DEFAULT_USE_GLOBAL_SYNC false // (true|false)
|
||||
|
||||
#define DEFAULT_IP_OCTET 0 //
|
||||
#define DEFAULT_WD_IC2_ADDRESS 0 //
|
||||
#define DEFAULT_USE_SSDP false // (true|false)
|
||||
#define DEFAULT_CON_FAIL_THRES 0 //
|
||||
|
||||
@@ -34,20 +34,23 @@ bool LogBuffer::getNext(LogDestination logDestination, uint32_t& timestamp, Stri
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t LogBuffer::getNrMessages(LogDestination logDestination) const
|
||||
bool LogBuffer::hasMessages(LogDestination logDestination)
|
||||
{
|
||||
uint32_t res{};
|
||||
if (logDestination >= NR_LOG_TO_DESTINATIONS) { return false; }
|
||||
|
||||
if (logDestination >= NR_LOG_TO_DESTINATIONS) { return res; }
|
||||
clearExpiredEntries(); // Cleanup the old stuff first
|
||||
|
||||
uint32_t pos = cache_iterator_pos[logDestination];
|
||||
|
||||
for (; pos < LogEntries.size(); ++pos) {
|
||||
if (LogEntries[pos].validForSubscriber(logDestination)) {
|
||||
++res;
|
||||
cache_iterator_pos[logDestination] = pos;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
lastReadTimeStamp[logDestination] = millis(); // Reset if we aren't going to fetch a next message
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LogBuffer::logActiveRead(LogDestination logDestination) {
|
||||
|
||||
@@ -52,8 +52,8 @@ struct LogBuffer {
|
||||
String & message,
|
||||
uint8_t & loglevel);
|
||||
|
||||
// Return the number of messages left for given log destination.
|
||||
uint32_t getNrMessages(LogDestination logDestination) const;
|
||||
// Return true if messages available for given log destination.
|
||||
bool hasMessages(LogDestination logDestination);
|
||||
|
||||
bool logActiveRead(LogDestination logDestination);
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ public:
|
||||
uint8_t Gateway[4] = {0};
|
||||
uint8_t Subnet[4] = {0};
|
||||
uint8_t DNS[4] = {0};
|
||||
uint8_t IP_Octet = 0;
|
||||
uint8_t IP_Octet_unused = 0; // No longer applicable after 2026-Network rewrite-merged
|
||||
uint8_t Unit = 0;
|
||||
char Name[26] = {0};
|
||||
char NTPHost[64] = {0};
|
||||
|
||||
@@ -693,7 +693,6 @@ void SettingsStruct_tmpl<N_TASKS>::clearMisc() {
|
||||
PID = ESP_PROJECT_PID;
|
||||
Version = VERSION;
|
||||
Build = get_build_nr();
|
||||
IP_Octet = 0;
|
||||
Delay = DEFAULT_DELAY;
|
||||
Pin_i2c_sda = DEFAULT_PIN_I2C_SDA;
|
||||
Pin_i2c_scl = DEFAULT_PIN_I2C_SCL;
|
||||
|
||||
@@ -220,9 +220,9 @@ ESPEasySerialPort EspEasy_Console_Port::getPortType() const
|
||||
|
||||
bool EspEasy_Console_Port::process_serialWriteBuffer()
|
||||
{
|
||||
if (_serialWriteBuffer.getNrMessages() == 0) { return false; }
|
||||
|
||||
if (_serial == nullptr) { return false; }
|
||||
if ((_serial == nullptr) || !_serialWriteBuffer.hasMessages()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef ESP32
|
||||
|
||||
if (!xPortCanYield()) { return false; }
|
||||
|
||||
@@ -277,7 +277,6 @@ void ResetFactory(bool formatFS)
|
||||
Settings.Version = VERSION;
|
||||
Settings.Build = get_build_nr();
|
||||
|
||||
// Settings.IP_Octet = DEFAULT_IP_OCTET;
|
||||
// Settings.Delay = DEFAULT_DELAY;
|
||||
Settings.Pin_i2c_sda = gpio_settings.i2c_sda;
|
||||
Settings.Pin_i2c_scl = gpio_settings.i2c_scl;
|
||||
@@ -324,7 +323,6 @@ void ResetFactory(bool formatFS)
|
||||
/*
|
||||
Settings.GlobalSync_unused = DEFAULT_USE_GLOBAL_SYNC;
|
||||
|
||||
Settings.IP_Octet = DEFAULT_IP_OCTET;
|
||||
Settings.WDI2CAddress = DEFAULT_WD_IC2_ADDRESS;
|
||||
Settings.UseSSDP = DEFAULT_USE_SSDP;
|
||||
Settings.ConnectionFailuresThreshold = DEFAULT_CON_FAIL_THRES;
|
||||
|
||||
@@ -20,11 +20,11 @@ bool LogStreamWriter::process(Print*stream, size_t availableForWrite)
|
||||
return write(*stream, availableForWrite) != 0;
|
||||
}
|
||||
|
||||
bool LogStreamWriter::process() { return false; }
|
||||
bool LogStreamWriter::process() { return false; }
|
||||
|
||||
uint32_t LogStreamWriter::getNrMessages() const
|
||||
bool LogStreamWriter::hasMessages() const
|
||||
{
|
||||
return Logging.getNrMessages(_log_destination);
|
||||
return Logging.hasMessages(_log_destination);
|
||||
}
|
||||
|
||||
size_t LogStreamWriter::write(Print& stream, size_t nrBytesToWrite)
|
||||
@@ -84,9 +84,9 @@ size_t LogStreamWriter::write_item(Print& stream,
|
||||
bool done = false;
|
||||
|
||||
|
||||
|
||||
while (!done && bytesWritten < nrBytesToWrite) {
|
||||
const size_t bytesWritten_startLoop = bytesWritten;
|
||||
|
||||
if (!_prefix.isEmpty()) {
|
||||
bytesWritten += write_part(_prefix, stream, nrBytesToWrite - bytesWritten);
|
||||
}
|
||||
@@ -101,10 +101,11 @@ size_t LogStreamWriter::write_item(Print& stream,
|
||||
clear();
|
||||
done = true;
|
||||
}
|
||||
|
||||
if (bytesWritten_startLoop == bytesWritten)
|
||||
{
|
||||
{
|
||||
// Nothing written in this loop, retry later.
|
||||
return bytesWritten;
|
||||
return bytesWritten;
|
||||
}
|
||||
}
|
||||
return bytesWritten;
|
||||
@@ -119,6 +120,7 @@ size_t LogStreamWriter::write_part(String& str, Print& stream, size_t nrBytesTo
|
||||
bytesWritten = stream.write(&str[_readpos], bytesLeft);
|
||||
_readpos += bytesWritten;
|
||||
}
|
||||
|
||||
if (_readpos >= str.length()) {
|
||||
// Clear str
|
||||
str.clear();
|
||||
|
||||
@@ -11,32 +11,35 @@ public:
|
||||
|
||||
virtual ~LogStreamWriter() {}
|
||||
|
||||
virtual bool process(Print* stream, size_t availableForWrite);
|
||||
|
||||
virtual bool process(Print *stream,
|
||||
size_t availableForWrite);
|
||||
|
||||
// Only use this from derived classes, as we need a Stream to further process
|
||||
virtual bool process();
|
||||
virtual bool process();
|
||||
|
||||
virtual uint32_t getNrMessages() const;
|
||||
virtual bool hasMessages() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual void clear();
|
||||
|
||||
protected:
|
||||
|
||||
// Write continuously until either nrBytesToWrite was reached or no new messages were available to process.
|
||||
// @retval Number of bytes written. Zero when no new message was available to process.
|
||||
virtual size_t write(Print& stream,
|
||||
size_t nrBytesToWrite);
|
||||
size_t nrBytesToWrite);
|
||||
|
||||
// Write single item and clear() on return.
|
||||
// This way each call starts with a new item and long messages may get truncated based on nrBytesToWrite
|
||||
// @retval Number of bytes written. Zero when no new message was available to process.
|
||||
virtual size_t write_single_item(Print& stream,
|
||||
size_t nrBytesToWrite);
|
||||
size_t nrBytesToWrite);
|
||||
|
||||
virtual size_t write_item(Print& stream,
|
||||
size_t nrBytesToWrite);
|
||||
size_t nrBytesToWrite);
|
||||
|
||||
size_t write_part(String& str, Print& stream, size_t nrBytesToWrite);
|
||||
size_t write_part(String& str,
|
||||
Print & stream,
|
||||
size_t nrBytesToWrite);
|
||||
|
||||
|
||||
virtual size_t write_skipping(Print& stream);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#endif // if FEATURE_SD
|
||||
|
||||
#if FEATURE_SD
|
||||
|
||||
void addToSDLog(uint8_t logLevel, const String& str)
|
||||
{
|
||||
if (!str.isEmpty() && loglevelActiveFor(LOG_TO_SDCARD, logLevel)) {
|
||||
@@ -31,6 +32,7 @@ void addToSDLog(uint8_t logLevel, const String& str)
|
||||
logFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // if FEATURE_SD
|
||||
|
||||
void LogHelper::addLogEntry(LogEntry_t&& logEntry)
|
||||
@@ -60,14 +62,12 @@ bool LogHelper::getNext(LogDestination logDestination, uint32_t& timestamp, Stri
|
||||
return _logBuffer.getNext(logDestination, timestamp, message, loglevel);
|
||||
}
|
||||
|
||||
uint32_t LogHelper::getNrMessages(LogDestination logDestination) const
|
||||
{
|
||||
return _logBuffer.getNrMessages(logDestination);
|
||||
}
|
||||
bool LogHelper::hasMessages(LogDestination logDestination) { return _logBuffer.hasMessages(logDestination); }
|
||||
|
||||
void LogHelper::loop(bool serialOnly)
|
||||
{
|
||||
#if FEATURE_SD
|
||||
|
||||
if (!serialOnly) {
|
||||
String message;
|
||||
uint32_t timestamp{};
|
||||
@@ -78,14 +78,11 @@ void LogHelper::loop(bool serialOnly)
|
||||
addToSDLog(loglevel, message);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // if FEATURE_SD
|
||||
_logBuffer.clearExpiredEntries();
|
||||
}
|
||||
|
||||
bool LogHelper::logActiveRead(LogDestination logDestination)
|
||||
{
|
||||
return _logBuffer.logActiveRead(logDestination);
|
||||
}
|
||||
bool LogHelper::logActiveRead(LogDestination logDestination) { return _logBuffer.logActiveRead(logDestination); }
|
||||
|
||||
void LogHelper::consolePrint(const __FlashStringHelper *text) { _tmpConsoleOutput += text; }
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ public:
|
||||
|
||||
void addLogEntry(LogEntry_t&& logEntry);
|
||||
|
||||
bool getNext(LogDestination logDestination,
|
||||
uint32_t& timestamp,
|
||||
String & message,
|
||||
uint8_t & loglevel);
|
||||
bool getNext(LogDestination logDestination,
|
||||
uint32_t & timestamp,
|
||||
String & message,
|
||||
uint8_t & loglevel);
|
||||
|
||||
uint32_t getNrMessages(LogDestination logDestination) const;
|
||||
bool hasMessages(LogDestination logDestination);
|
||||
|
||||
void loop(bool serialOnly);
|
||||
void loop(bool serialOnly);
|
||||
|
||||
bool logActiveRead(LogDestination logDestination);
|
||||
bool logActiveRead(LogDestination logDestination);
|
||||
|
||||
|
||||
// Append to internal buffer, which will only be flushed on consolePrintln
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
#if FEATURE_SYSLOG
|
||||
|
||||
|
||||
#include "../../ESPEasy/net/ESPEasyNetwork.h"
|
||||
#include "../../ESPEasy/net/Globals/NetworkState.h"
|
||||
#include "../Globals/ESPEasy_time.h"
|
||||
#include "../Globals/Settings.h"
|
||||
#include "../Helpers/ESPEasy_time_calc.h"
|
||||
#include "../Helpers/Networking.h"
|
||||
#include "../Helpers/StringConverter.h"
|
||||
# include "../../ESPEasy/net/ESPEasyNetwork.h"
|
||||
# include "../../ESPEasy/net/Globals/NetworkState.h"
|
||||
# include "../Globals/ESPEasy_time.h"
|
||||
# include "../Globals/Settings.h"
|
||||
# include "../Helpers/ESPEasy_time_calc.h"
|
||||
# include "../Helpers/Networking.h"
|
||||
# include "../Helpers/StringConverter.h"
|
||||
|
||||
#define MAX_LENGTH_SYSLOG_MESSAGE 1000
|
||||
# define MAX_LENGTH_SYSLOG_MESSAGE 1000
|
||||
|
||||
bool SyslogWriter::process()
|
||||
{
|
||||
if ((Settings.SyslogLevel == 0) || (getNrMessages() == 0)) {
|
||||
if ((Settings.SyslogLevel == 0) || !hasMessages()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,4 +136,5 @@ void SyslogWriter::prepare_prefix()
|
||||
formattedTimestamp.c_str(),
|
||||
hostname.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // if FEATURE_SYSLOG
|
||||
|
||||
@@ -44,7 +44,7 @@ void handle_advanced() {
|
||||
|
||||
if (!webArg(F("edit")).isEmpty())
|
||||
{
|
||||
Settings.IP_Octet = webArg(F("ip")).toInt();
|
||||
// Settings.IP_Octet_unused = webArg(F("ip")).toInt(); // No longer applicable after 2026-Network rewrite-merged
|
||||
strncpy_webserver_arg(Settings.NTPHost, F("ntphost"));
|
||||
Settings.TimeZone = getFormItemInt(F("timezone"));
|
||||
TimeChangeRule dst_start(getFormItemInt(F("dststartweek")), getFormItemInt(F("dststartdow")), getFormItemInt(F("dststartmonth")), getFormItemInt(F("dststarthour")), Settings.TimeZone);
|
||||
@@ -298,7 +298,7 @@ void handle_advanced() {
|
||||
addFormNumericBox(F("Webserver port"), F("webport"), Settings.WebserverPort, 0, 65535);
|
||||
addFormNote(F("Requires reboot to activate"));
|
||||
|
||||
addFormNumericBox(F("Fixed IP Octet"), F("ip"), Settings.IP_Octet, 0, 255);
|
||||
// addFormNumericBox(F("Fixed IP Octet"), F("ip"), Settings.IP_Octet_unused, 0, 255); // No longer applicable after 2026-Network rewrite-merged
|
||||
|
||||
addFormNumericBox(F("WD I2C Address"), F("wdi2caddress"), Settings.WDI2CAddress, 0, 127);
|
||||
addHtml(F(" (decimal)"));
|
||||
|
||||
@@ -111,10 +111,10 @@ void handle_log_JSON() {
|
||||
}
|
||||
}
|
||||
}
|
||||
const uint32_t nrEntriesLeft = Logging.getNrMessages(LOG_TO_WEBLOG);
|
||||
int32_t logTimeSpan = timeDiff(firstTimeStamp, lastTimeStamp);
|
||||
int32_t refreshSuggestion = (nrEntriesLeft > 0) ? 200 : 1000;
|
||||
int32_t newOptimum = 1000;
|
||||
const bool entriesAvailable = Logging.hasMessages(LOG_TO_WEBLOG);
|
||||
const int32_t logTimeSpan = timeDiff(firstTimeStamp, lastTimeStamp);
|
||||
int32_t refreshSuggestion = entriesAvailable ? 200 : 1000;
|
||||
int32_t newOptimum = 1000;
|
||||
|
||||
|
||||
if ((nrEntries > 2) && (logTimeSpan > 1)) {
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
# include "../Helpers/Hardware_temperature_sensor.h"
|
||||
# endif
|
||||
|
||||
#if FEATURE_EEPROM_EXTERNAL
|
||||
#include "../../ESPEasy/eeprom/Helpers/EEPROMExternal.h"
|
||||
#endif // if FEATURE_EEPROM_EXTERNAL
|
||||
|
||||
# ifdef ESP32
|
||||
# include <esp_partition.h>
|
||||
# endif // ifdef ESP32
|
||||
@@ -718,6 +722,27 @@ void handle_sysinfo_Storage() {
|
||||
getPartitionTableSVG();
|
||||
# endif // ifdef ESP8266
|
||||
# endif // if FEATURE_CHART_STORAGE_LAYOUT
|
||||
|
||||
#ifndef LIMIT_BUILD_SIZE
|
||||
|
||||
#if FEATURE_EEPROM_EXTERNAL
|
||||
{
|
||||
const bool eepromChecked = ESPEasy::eeprom::checkEEPROMEnabled() > 0;
|
||||
if (eepromChecked) {
|
||||
addFormSubHeader(F("External I2C EEPROM"));
|
||||
addRowLabel(F("EEPROM Model/size"));
|
||||
addHtml(getEEPROMName(static_cast<ESPEasy::eeprom::EEPROMExternal_Type_e>(Settings.EEPROMExternalType())));
|
||||
addRowLabel(F("EEPROM Enabled"));
|
||||
addEnabled(eepromChecked);
|
||||
if (ESPEasy::eeprom::isEEPROMExternalWriteProtected()) {
|
||||
addHtml(F(" Write-protected!"));
|
||||
}
|
||||
addRowLabel(F("'WriteEE' slots available"));
|
||||
addHtmlInt(ESPEasy::eeprom::getEEPROMMaxSlots());
|
||||
}
|
||||
}
|
||||
#endif // if FEATURE_EEPROM_EXTERNAL
|
||||
#endif // ifndef LIMIT_BUILD_SIZE
|
||||
}
|
||||
|
||||
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
|
||||
|
||||
Reference in New Issue
Block a user