Merge pull request #1514 from dalathegreat/bugfix/AP-password

Bugfix: Add AP password to settings page
This commit is contained in:
Daniel Öster 2025-09-09 00:02:13 +03:00 committed by GitHub
commit edb69472c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View file

@ -163,7 +163,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);
wifi_channel = settings.getUInt("WIFICHANNEL", 0);
passwordAP = settings.getString("APPASSWORD", "123456789").c_str();
mqtt_enabled = settings.getBool("MQTTENABLED", false);
mqtt_timeout_ms = settings.getUInt("MQTTTIMEOUT", 2000);

View file

@ -291,6 +291,10 @@ String settings_processor(const String& var, BatteryEmulatorSettingsStore& setti
return settings.getBool("WIFIAPENABLED", wifiap_enabled) ? "checked" : "";
}
if (var == "APPASSWORD") {
return settings.getString("APPASSWORD", "123456789");
}
if (var == "STATICIP") {
return settings.getBool("STATICIP") ? "checked" : "";
}
@ -1148,6 +1152,9 @@ const char* getCANInterfaceName(CAN_Interface interface) {
<label>Broadcast Wifi access point: </label>
<input type='checkbox' name='WIFIAPENABLED' value='on' %WIFIAPENABLED% />
<label>Access point password: </label>
<input type='text' name='APPASSWORD' value="%APPASSWORD%" />
<label>Wifi channel 0-14: </label>
<input name='WIFICHANNEL' type='text' value="%WIFICHANNEL%" pattern="^[0-9]+$" />

View file

@ -509,6 +509,8 @@ void init_webserver() {
} else if (p->name() == "SUBNET4") {
auto type = atoi(p->value().c_str());
settings.saveUInt("SUBNET4", type);
} else if (p->name() == "APPASSWORD") {
settings.saveString("APPASSWORD", p->value().c_str());
} else if (p->name() == "HOSTNAME") {
settings.saveString("HOSTNAME", p->value().c_str());
} else if (p->name() == "MQTTSERVER") {