make network hardware selectable

This commit is contained in:
technyon
2023-02-03 20:40:21 +01:00
parent 13e7643b0d
commit bdb1cff935
7 changed files with 59 additions and 24 deletions

View File

@@ -239,9 +239,14 @@ bool WebCfgServer::processArgs(String& message)
_preferences->putString(preference_mqtt_key, value);
configChanged = true;
}
else if(key == "NWHW")
{
_preferences->putInt(preference_network_hardware, value.toInt());
configChanged = true;
}
else if(key == "NWHWDT")
{
_preferences->putInt(preference_network_hardware_detect, value.toInt());
_preferences->putInt(preference_network_hardware_gpio, value.toInt());
configChanged = true;
}
else if(key == "RSSI")
@@ -607,7 +612,8 @@ void WebCfgServer::buildMqttConfigHtml(String &response)
printTextarea(response, "MQTTCA", "MQTT SSL CA Certificate (*, optional)", _preferences->getString(preference_mqtt_ca).c_str(), TLS_CA_MAX_SIZE, _network->encryptionSupported());
printTextarea(response, "MQTTCRT", "MQTT SSL Client Certificate (*, optional)", _preferences->getString(preference_mqtt_crt).c_str(), TLS_CERT_MAX_SIZE, _network->encryptionSupported());
printTextarea(response, "MQTTKEY", "MQTT SSL Client Key (*, optional)", _preferences->getString(preference_mqtt_key).c_str(), TLS_KEY_MAX_SIZE, _network->encryptionSupported());
printDropDown(response, "NWHWDT", "Network hardware detection", String(_preferences->getInt(preference_network_hardware_detect)), getNetworkDetectionOptions());
printDropDown(response, "NWHW", "Network hardware", String(_preferences->getInt(preference_network_hardware)), getNetworkDetectionOptions());
printDropDown(response, "NWHWDT", "Network hardware detection", String(_preferences->getInt(preference_network_hardware_gpio)), getNetworkGpioOptions());
printInputField(response, "RSSI", "RSSI Publish interval (seconds; -1 to disable)", _preferences->getInt(preference_rssi_publish_interval), 6);
printInputField(response, "NETTIMEOUT", "Network Timeout until restart (seconds; -1 to disable)", _preferences->getInt(preference_network_timeout), 5);
printCheckBox(response, "RSTDISC", "Restart on disconnect", _preferences->getBool(preference_restart_on_disconnect));
@@ -956,7 +962,16 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
{
std::vector<std::pair<String, String>> options;
options.push_back(std::make_pair("-1", "Disable W5500"));
options.push_back(std::make_pair("0", "Disable W5500 (Wifi only)"));
options.push_back(std::make_pair("1", "W5500 (GPIO CS=5; SCK=18; MISO=19; MOSI=23; RST=33)"));
options.push_back(std::make_pair("2", "M5Stack Atom POE (W5500)"));
return options;
}
const std::vector<std::pair<String, String>> WebCfgServer::getNetworkGpioOptions() const
{
std::vector<std::pair<String, String>> options;
for(int i=16; i <= 33; i++)
{
@@ -966,4 +981,4 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
}
return options;
}
}