Remove even more USER_SETTINGS

This commit is contained in:
Daniel Öster 2025-09-01 23:22:34 +03:00
parent 688ba0388c
commit 7328f7b99b
4 changed files with 11 additions and 47 deletions

View file

@ -7,7 +7,7 @@
/* This file is being transitioned towards COMMON_IMAGE. Use v8.16 if you are taking this software into use! */
/* Select hardware used for Battery-Emulator */
#define HW_LILYGO
//#define HW_LILYGO
//#define HW_STARK
//#define HW_3LB
//#define HW_DEVKIT
@ -21,23 +21,12 @@
/* Connectivity options */
//#define WIFICONFIG //Enable this line to set a static IP address / gateway /subnet mask for the device. see USER_SETTINGS.cpp for the settings
//#define CUSTOM_HOSTNAME \
"battery-emulator" //Enable this line to use a custom hostname for the device, if disabled the default naming format 'esp32-XXXXXX' will be used.
#define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings.
#define WIFIAP //When enabled, the emulator will broadcast its own access point Wifi. Can be used at the same time as a normal Wifi connection to a router.
#define MDNSRESPONDER //Enable this line to enable MDNS, allows battery monitor te be found by .local address. Requires WEBSERVER to be enabled.
#define LOAD_SAVED_SETTINGS_ON_BOOT // Enable this line to read settings stored via the webserver on boot (overrides Wifi credentials set here)
/* MQTT options */
// #define MQTT // Enable this line to enable MQTT
#define MQTT_QOS 0 // MQTT Quality of Service (0, 1, or 2)
#define MQTT_PUBLISH_CELL_VOLTAGES // Enable this line to publish cell voltages to MQTT
#define MQTT_TIMEOUT 2000 // MQTT timeout in milliseconds
#define MQTT_MANUAL_TOPIC_OBJECT_NAME
// Enable MQTT_MANUAL_TOPIC_OBJECT_NAME to use custom MQTT topic, object ID prefix, and device name.
// WARNING: If this is not defined, the previous default naming format 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used.
// This naming convention was in place until version 7.5.0. Users should check the version from which they are updating, as this change
// may break compatibility with previous versions of MQTT naming. Please refer to USER_SETTINGS.cpp for configuration options.
// 500 = 50.0 °C , Max temperature (Will produce a battery overheat event if above)
#define BATTERY_MAXTEMPERATURE 500

View file

@ -26,12 +26,7 @@ void init_stored_settings() {
set_event(EVENT_EQUIPMENT_STOP, 1);
}
#ifndef LOAD_SAVED_SETTINGS_ON_BOOT
settings.clear(); // If this clear function is executed, no settings will be read from storage
//always save the equipment stop status
settings.putBool("EQUIPMENT_STOP", datalayer.system.settings.equipment_stop_active);
#endif // LOAD_SAVED_SETTINGS_ON_BOOT
//settings.clear(); // If this clear function is executed, no settings will be read from storage. For dev
esp32hal->set_default_configuration_values();

View file

@ -23,13 +23,11 @@ const char* mqtt_server_default = "";
int mqtt_port = mqtt_port_default;
std::string mqtt_server = mqtt_server_default;
#ifdef MQTT_MANUAL_TOPIC_OBJECT_NAME
const bool mqtt_manual_topic_object_name_default = true;
#else
const bool mqtt_manual_topic_object_name_default = false;
#endif
bool mqtt_manual_topic_object_name = mqtt_manual_topic_object_name_default;
bool mqtt_manual_topic_object_name =
true; //TODO, should this be configurable from webserver? Or legacy option removed?
// If this is not true, the previous default naming format 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used.
// This naming convention was in place until version 7.5.0. Users should check the version from which they are updating, as this change
// may break compatibility with previous versions of MQTT naming
esp_mqtt_client_config_t mqtt_cfg;
esp_mqtt_client_handle_t client;

View file

@ -4,29 +4,11 @@
#include "../utils/logging.h"
#include "USER_SETTINGS.h"
#if defined(WIFI) || defined(WEBSERVER)
const bool wifi_enabled_default = true;
#else
const bool wifi_enabled_default = false;
#endif
bool wifi_enabled = wifi_enabled_default;
bool wifiap_enabled = true; //Old method was with ifdef
#ifdef MDNSRESPONDER
const bool mdns_enabled_default = true;
#else
const bool mdns_enabled_default = false;
#endif
bool mdns_enabled = mdns_enabled_default;
#ifdef CUSTOM_HOSTNAME
std::string custom_hostname = CUSTOM_HOSTNAME;
#else
std::string custom_hostname;
#endif
bool wifi_enabled = true;
bool wifiap_enabled = true;
bool mdns_enabled = true; //If true, allows battery monitor te be found by .local address
std::string custom_hostname; //If not set, the default naming format 'esp32-XXXXXX' will be used
std::string ssidAP;
// Configuration Parameters