21 snprintf(buf,
sizeof(buf),
"%s_%02X%02X%02X",
DEVICE_MODEL, mac[3], mac[4], mac[5]);
30 snprintf(buf,
sizeof(buf),
"jxct_%02X%02X%02X", mac[3], mac[4], mac[5]);
37#define KEY_NTP_INTERVAL "ntpIntvl"
74 config.webPassword[0] =
'\0';
77 String ntpServer =
preferences.getString(
"ntpServer",
"pool.ntp.org");
78 ntpServer.toCharArray(
config.ntpServer,
sizeof(
config.ntpServer));
116 if (strlen(
config.mqttDeviceName) == 0)
118 if (strlen(
config.thingSpeakChannelId) == 0)
119 strlcpy(
config.thingSpeakChannelId,
"",
sizeof(
config.thingSpeakChannelId));
120 if (strlen(
config.mqttTopicPrefix) == 0)
125 config.flags.thingSpeakEnabled ?
"включен" :
"выключен");
214 logWarn(
"Сброс конфигурации...");
221 config.password[0] =
'\0';
229 config.flags.mqttEnabled = 0;
230 config.flags.thingSpeakEnabled = 0;
231 config.flags.hassEnabled = 0;
232 config.flags.useRealSensor = 0;
233 config.flags.calibrationEnabled = 0;
236 strlcpy(
config.thingSpeakChannelId,
"",
sizeof(
config.thingSpeakChannelId));
237 strlcpy(
config.mqttServer,
"",
sizeof(
config.mqttServer));
239 strlcpy(
config.mqttPassword,
"",
sizeof(
config.mqttPassword));
240 strlcpy(
config.thingSpeakApiKey,
"",
sizeof(
config.thingSpeakApiKey));
241 strlcpy(
config.manufacturer,
"",
sizeof(
config.manufacturer));
243 strlcpy(
config.swVersion,
"",
sizeof(
config.swVersion));
247 config.thingspeakInterval = 60;
250 strlcpy(
config.webPassword,
"",
sizeof(
config.webPassword));
253 strlcpy(
config.ntpServer,
"pool.ntp.org",
sizeof(
config.ntpServer));
254 config.ntpUpdateInterval = 60000;
270 config.movingAverageWindow = 5;
272 config.filterAlgorithm = 0;
273 config.outlierFilterEnabled = 0;
280 config.flags.isGreenhouse =
false;
281 config.irrigationSpikeThreshold = 8.0f;
282 config.irrigationHoldMinutes = 5;
285 config.environmentType = 0;
286 config.flags.seasonalAdjustEnabled = 0;
287 config.flags.autoOtaEnabled = 0;
289 logSuccess(
"Все настройки сброшены к значениям по умолчанию");
290 DEBUG_PRINT(
"[resetConfig] config.thingspeakInterval: ");
292 DEBUG_PRINT(
"[resetConfig] config.manufacturer: ");
300 DEBUG_PRINT(
"[resetConfig] config.ntpUpdateInterval: ");
307 if (strlen(
config.ssid) == 0)
313 if (
config.flags.mqttEnabled && strlen(
config.mqttServer) == 0)
319 if (
config.flags.thingSpeakEnabled && strlen(
config.thingSpeakApiKey) == 0)
#define WEB_UPDATE_INTERVAL
#define MQTT_PUBLISH_INTERVAL
#define FORCE_PUBLISH_CYCLES
#define SENSOR_READ_INTERVAL
#define DELTA_TEMPERATURE
#define THINGSPEAK_INTERVAL
void logDebug(const char *format,...)
void logWarn(const char *format,...)
void logSuccess(const char *format,...)
Система логгирования с красивым форматированием
void invalidateHAConfigCache()
static const char DEVICE_MODEL[]