Release v1.3.4.2 - fix isEscape bug, power-loss resilience, EEPROM fix, SD mutex, code cleanup

This commit is contained in:
2026-05-10 18:39:11 +02:00
parent 84e2abae14
commit 10d187eb37
29 changed files with 3482 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <Logger.h>
#include <Arduino.h>
#include <EEPROM.h>
#define EEPROM_SIZE 1024
//constexpr size_t EEPROM_SIZE = sizeof(Config) + 32; // z lekkim zapasem
extern bool isRebootRequired;
extern bool isClearLog;
extern bool connected;
extern long countConnect;
extern long countDisconnect;
extern String act_rssi_percent;
extern int8_t rssi;
extern String actDate;
extern String actTime;
struct Config {
bool connect; // czy łączyć z Internetem?
bool measure; // true - pomiary ciągłe, false - nie rób nic (tryb konfiguracji)
char ip[16];
char subnet[16];
char gateway[16];
char dns[16];
char ssid[32];
char ntp[50];
char password[32];
char hostname[32];
char place[100]; // miejsce instalacji
bool dhcp; // czy włączyć DHCP?
char user[10]; // użytkownik konfiguracji
char pass[20]; // hasło użytkownika konfiguracji
char updateUrl[150]; // adres pliku aktualizacji
char restURL[150]; // adres Rest API
int restPort; // Port systemu Api na serwerze
char restUser[30]; // login RestAPI
char restPass[50]; // hasło RestAPi
uint8_t apiKey[32]; // Klucz API KEY
uint32_t pause; // Pomiar co milisekund (ms)
uint8_t duration; // Czas pomiaru w sekundach 1-25
char S0[12]; // nazwy czujników 1-8
char S1[12];
char S2[12];
char S3[12];
char S4[12];
char S5[12];
char S6[12];
char S7[12];
};
// Global config declaration
extern Config config;
static_assert(sizeof(Config) + 1 <= EEPROM_SIZE, "Config struct exceeds EEPROM!");
class ConfigManager {
public:
ConfigManager();
void begin(); // EEPROM initialization
void readConfig(); // Odczyt konfiguracji z EEPROM
void saveConfig(); // Zapis konfiguracji do EEPROM
void resetToDefaults(); // Reset do ustawień domyślnych
void showConfig();
void generateApiKey(uint8_t *buf, size_t len);
private:
bool isEEPROMEmpty();
};
#endif