make wifi default network device, remove W5500 GPIO detection
This commit is contained in:
7
Gpio.cpp
7
Gpio.cpp
@@ -129,13 +129,6 @@ void Gpio::savePinConfiguration(const std::vector<PinEntry> &pinConfiguration)
|
||||
}
|
||||
}
|
||||
|
||||
for(int8_t v : serialized)
|
||||
{
|
||||
Serial.print((int)v);
|
||||
Serial.print(" ");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
_preferences->putBytes(preference_gpio_configuration, serialized, sizeof(serialized));
|
||||
}
|
||||
|
||||
|
||||
17
Network.cpp
17
Network.cpp
@@ -46,21 +46,14 @@ void Network::setupDevice()
|
||||
_ipConfiguration = new IPConfiguration(_preferences);
|
||||
|
||||
int hardwareDetect = _preferences->getInt(preference_network_hardware);
|
||||
int hardwareDetectGpio = _preferences->getInt(preference_network_hardware_gpio);
|
||||
|
||||
Log->print(F("Hardware detect : ")); Log->println(hardwareDetect);
|
||||
Log->print(F("Hardware detect GPIO: ")); Log->println(hardwareDetectGpio);
|
||||
|
||||
if(hardwareDetect == 0)
|
||||
{
|
||||
hardwareDetect = 2;
|
||||
hardwareDetect = 1;
|
||||
_preferences->putInt(preference_network_hardware, hardwareDetect);
|
||||
}
|
||||
if(hardwareDetectGpio == 0)
|
||||
{
|
||||
hardwareDetectGpio = 26;
|
||||
_preferences->putInt(preference_network_hardware_gpio, hardwareDetectGpio);
|
||||
}
|
||||
|
||||
if(strcmp(WiFi_fallbackDetect, "wifi_fallback") == 0)
|
||||
{
|
||||
@@ -77,12 +70,8 @@ void Network::setupDevice()
|
||||
_networkDeviceType = NetworkDeviceType::WiFi;
|
||||
break;
|
||||
case 2:
|
||||
Log->print(F("Using PIN "));
|
||||
Log->print(hardwareDetectGpio);
|
||||
Log->println(F(" for network device selection"));
|
||||
|
||||
pinMode(hardwareDetectGpio, INPUT_PULLUP);
|
||||
_networkDeviceType = digitalRead(hardwareDetectGpio) == HIGH ? NetworkDeviceType::WiFi : NetworkDeviceType::W5500;
|
||||
Log->print(F("Generic W5500"));
|
||||
_networkDeviceType = NetworkDeviceType::W5500;
|
||||
break;
|
||||
case 3:
|
||||
Log->println(F("W5500 on M5Stack Atom POE"));
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define preference_ip_gateway "ipgtw"
|
||||
#define preference_ip_dns_server "dnssrv"
|
||||
#define preference_network_hardware "nwhw"
|
||||
#define preference_network_hardware_gpio "nwhwdt"
|
||||
#define preference_rssi_publish_interval "rssipb"
|
||||
#define preference_hostname "hostname"
|
||||
#define preference_network_timeout "nettmout"
|
||||
@@ -63,7 +62,7 @@ private:
|
||||
preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count, preference_mqtt_ca,
|
||||
preference_mqtt_crt, preference_mqtt_key, preference_mqtt_hass_discovery,
|
||||
preference_ip_dhcp_enabled, preference_ip_address, preference_ip_subnet, preference_ip_gateway, preference_ip_dns_server,
|
||||
preference_network_hardware, preference_network_hardware_gpio, preference_rssi_publish_interval,
|
||||
preference_network_hardware, preference_rssi_publish_interval,
|
||||
preference_hostname, preference_network_timeout, preference_restart_on_disconnect,
|
||||
preference_restart_timer, preference_restart_ble_beacon_lost, preference_query_interval_lockstate,
|
||||
preference_query_interval_configuration, preference_query_interval_battery, preference_query_interval_keypad,
|
||||
|
||||
@@ -198,11 +198,10 @@ W5x00 SCK to GPIO18<br>
|
||||
W5x00 MISO to GPIOGPIO19<br>
|
||||
W5x00 MOSI to GPIO23<br>
|
||||
W5x00 CS/SS to GPIO5
|
||||
- Additionally connect:<br>
|
||||
- Optionally connect:<br>
|
||||
W5x00 reset to GPIO33
|
||||
- Last but not least, on the ESP32 bridge GPIO26 and GND. This let's the firmware know that a LAN Module is connected
|
||||
|
||||
Wifi is now disabled, and the module doesn't boot into WifiManager anymore.<br>
|
||||
Now connect via Wifi and change the network hardware to "Generic W5500". If the W5500 hwardware isn't detected, Wifi is used as a fallback.<br>
|
||||
Note: Encrypted MQTT is only available for Wifi and LAN8720 modules, W5x00 modules don't support encryption
|
||||
(that leaves Olimex, WT32-ETH01 and M5Stack PoESP32 Unit if encryption is desired). If encryption is needed, Olimex
|
||||
is the easiest option, since it has USB for flashing onboard.
|
||||
|
||||
@@ -324,11 +324,6 @@ bool WebCfgServer::processArgs(String& message)
|
||||
_preferences->putInt(preference_network_hardware, value.toInt());
|
||||
configChanged = true;
|
||||
}
|
||||
else if(key == "NWHWDT")
|
||||
{
|
||||
_preferences->putInt(preference_network_hardware_gpio, value.toInt());
|
||||
configChanged = true;
|
||||
}
|
||||
else if(key == "RSSI")
|
||||
{
|
||||
_preferences->putInt(preference_rssi_publish_interval, value.toInt());
|
||||
@@ -763,7 +758,6 @@ void WebCfgServer::buildMqttConfigHtml(String &response)
|
||||
printTextarea(response, "MQTTCRT", "MQTT SSL Client Certificate (*, optional)", _preferences->getString(preference_mqtt_crt).c_str(), TLS_CERT_MAX_SIZE, _network->encryptionSupported(), true);
|
||||
printTextarea(response, "MQTTKEY", "MQTT SSL Client Key (*, optional)", _preferences->getString(preference_mqtt_key).c_str(), TLS_KEY_MAX_SIZE, _network->encryptionSupported(), true);
|
||||
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));
|
||||
@@ -1275,7 +1269,7 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
|
||||
std::vector<std::pair<String, String>> options;
|
||||
|
||||
options.push_back(std::make_pair("1", "Wifi only"));
|
||||
options.push_back(std::make_pair("2", "Detect W5500 (GPIO CS=5; SCK=18; MISO=19; MOSI=23; RST=33)"));
|
||||
options.push_back(std::make_pair("2", "Generic W5500"));
|
||||
options.push_back(std::make_pair("3", "M5Stack Atom POE (W5500)"));
|
||||
options.push_back(std::make_pair("4", "Olimex ESP32-POE / ESP-POE-ISO"));
|
||||
options.push_back(std::make_pair("5", "WT32-ETH01"));
|
||||
@@ -1285,20 +1279,6 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
|
||||
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++)
|
||||
{
|
||||
String txt = "Detect W5500 via GPIO ";
|
||||
txt.concat(i);
|
||||
options.push_back(std::make_pair(String(i), txt));
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
const std::vector<std::pair<String, String>> WebCfgServer::getGpioOptions() const
|
||||
{
|
||||
std::vector<std::pair<String, String>> options;
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
void buildNavigationButton(String& response, const char* caption, const char* targetPath, const char* labelText = "");
|
||||
|
||||
const std::vector<std::pair<String, String>> getNetworkDetectionOptions() const;
|
||||
const std::vector<std::pair<String, String>> getNetworkGpioOptions() const;
|
||||
const std::vector<std::pair<String, String>> getGpioOptions() const;
|
||||
String getPreselectionForGpio(const uint8_t& pin);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user