NeoPool fix reset to default settings (#23734)

This commit is contained in:
Norbert Richter 2025-07-31 17:28:03 +02:00 committed by GitHub
parent bbc299fe54
commit 86c204e1a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file.
- OpenTherm library from v0.9.0 to v1.1.5 (#23704)
### Fixed
- NeoPool fix reset to default settings
### Removed

View File

@ -815,14 +815,14 @@ typedef union {
} NeoPoolBitfield;;
// Global structure containing sensor saved variables
struct {
typedef struct {
uint32_t crc32;
uint16_t version;
NeoPoolBitfield flags;
uint8_t result;
uint16_t npteleperiod;
} NeoPoolSettings;
} TNeoPoolSettings;
TNeoPoolSettings NeoPoolSettings;
#define D_NEOPOOL_NAME "NeoPool"
@ -3381,6 +3381,9 @@ void NeoPoolSettingsLoad(bool erase) {
NeoPoolSettings.flags.conn_stat = 1;
NeoPoolSettings.result = NEOPOOL_DEFAULT_RESULT;
NeoPoolSettings.npteleperiod = NEOPOOL_DEFAULT_NPTELEPERIOD;
TNeoPoolSettings NeoPoolSettingsDefaults;
memcpy(&NeoPoolSettingsDefaults, &NeoPoolSettings, sizeof(NeoPoolSettingsDefaults));
#ifdef USE_UFILESYS
snprintf_P(filename, sizeof(filename), PSTR(TASM_FILE_SENSOR), XSNS_83);
@ -3391,6 +3394,10 @@ void NeoPoolSettingsLoad(bool erase) {
#ifdef DEBUG_TASMOTA_SENSOR
AddLog(LOG_LEVEL_DEBUG, PSTR("NEO: Settings loaded from file '%s'"), filename);
#endif // DEBUG_TASMOTA_SENSOR
if (NeoPoolSettings.crc32 != GetCfgCrc32((uint8_t*)&NeoPoolSettings +4, sizeof(NeoPoolSettings) -4)) {
AddLog(LOG_LEVEL_INFO, PSTR("NEO: Settings CRC error, reset to defaults"));
memcpy(&NeoPoolSettings, &NeoPoolSettingsDefaults, sizeof(NeoPoolSettings));
}
}
else {
#ifdef DEBUG_TASMOTA_SENSOR