diff --git a/Software/USER_SETTINGS.cpp b/Software/USER_SETTINGS.cpp index d79a90ae..ccfa3e83 100644 --- a/Software/USER_SETTINGS.cpp +++ b/Software/USER_SETTINGS.cpp @@ -20,7 +20,6 @@ volatile CAN_Configuration can_config = { .shunt = CAN_NATIVE // (OPTIONAL) Which CAN is your shunt connected to? }; - // Set your Static IP address. Only used incase WIFICONFIG is set in USER_SETTINGS.h IPAddress local_IP(192, 168, 10, 150); IPAddress gateway(192, 168, 10, 1); @@ -30,12 +29,8 @@ std::string ssid; std::string password; std::string passwordAP; -const uint8_t wifi_channel = 0; // Set to 0 for automatic channel selection - - // MQTT - const char* mqtt_topic_name = "BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX" const char* mqtt_object_id_prefix = diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index e2873c17..9f89c7bb 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -21,7 +21,6 @@ typedef struct { } CAN_Configuration; extern volatile CAN_Configuration can_config; extern volatile uint8_t AccessPointEnabled; -extern const uint8_t wifi_channel; extern volatile float CHARGER_SET_HV; extern volatile float CHARGER_MAX_HV; extern volatile float CHARGER_MIN_HV; diff --git a/Software/src/communication/nvm/comm_nvm.cpp b/Software/src/communication/nvm/comm_nvm.cpp index 2cb7a89e..2351728b 100644 --- a/Software/src/communication/nvm/comm_nvm.cpp +++ b/Software/src/communication/nvm/comm_nvm.cpp @@ -157,6 +157,7 @@ void init_stored_settings() { // WIFI AP is enabled by default unless disabled in the settings wifiap_enabled = settings.getBool("WIFIAPENABLED", true); + wifi_channel = settings.getUInt("WIFICHANNEL", 2000); passwordAP = settings.getString("APPASSWORD", "123456789").c_str(); mqtt_enabled = settings.getBool("MQTTENABLED", false); mqtt_timeout_ms = settings.getUInt("MQTTTIMEOUT", 2000); diff --git a/Software/src/devboard/webserver/settings_html.cpp b/Software/src/devboard/webserver/settings_html.cpp index 74825e3d..521805c5 100644 --- a/Software/src/devboard/webserver/settings_html.cpp +++ b/Software/src/devboard/webserver/settings_html.cpp @@ -290,6 +290,10 @@ String settings_processor(const String& var, BatteryEmulatorSettingsStore& setti return settings.getBool("WIFIAPENABLED", wifiap_enabled) ? "checked" : ""; } + if (var == "WIFICHANNEL") { + return String(settings.getUInt("WIFICHANNEL", 0)); + } + if (var == "PERFPROFILE") { return settings.getBool("PERFPROFILE") ? "checked" : ""; } @@ -867,7 +871,7 @@ const char* getCANInterfaceName(CAN_Interface interface) {