default network hardware to detect w5000
This commit is contained in:
23
Network.cpp
23
Network.cpp
@@ -35,6 +35,17 @@ void Network::setupDevice()
|
|||||||
Log->print("Hardware detect : "); Log->println(hardwareDetect);
|
Log->print("Hardware detect : "); Log->println(hardwareDetect);
|
||||||
Log->print("Hardware detect GPIO: "); Log->println(hardwareDetectGpio);
|
Log->print("Hardware detect GPIO: "); Log->println(hardwareDetectGpio);
|
||||||
|
|
||||||
|
if(hardwareDetect == 0)
|
||||||
|
{
|
||||||
|
hardwareDetect = 2;
|
||||||
|
_preferences->putInt(preference_network_hardware_gpio, hardwareDetect);
|
||||||
|
}
|
||||||
|
if(hardwareDetectGpio == 0)
|
||||||
|
{
|
||||||
|
hardwareDetectGpio = 26;
|
||||||
|
_preferences->putInt(preference_network_hardware_gpio, hardwareDetectGpio);
|
||||||
|
}
|
||||||
|
|
||||||
if(strcmp(WiFi_fallbackDetect, "wifi_fallback") == 0)
|
if(strcmp(WiFi_fallbackDetect, "wifi_fallback") == 0)
|
||||||
{
|
{
|
||||||
Log->println(F("Switching to WiFi device as fallback."));
|
Log->println(F("Switching to WiFi device as fallback."));
|
||||||
@@ -42,18 +53,12 @@ void Network::setupDevice()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(hardwareDetectGpio == 0)
|
if(hardwareDetect == 1)
|
||||||
{
|
|
||||||
hardwareDetectGpio = 26;
|
|
||||||
_preferences->putInt(preference_network_hardware_gpio, hardwareDetectGpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hardwareDetect == 0)
|
|
||||||
{
|
{
|
||||||
Log->println(F("W5500 hardware is disabled, using Wifi."));
|
Log->println(F("W5500 hardware is disabled, using Wifi."));
|
||||||
_networkDeviceType = NetworkDeviceType::WiFi;
|
_networkDeviceType = NetworkDeviceType::WiFi;
|
||||||
}
|
}
|
||||||
else if(hardwareDetect == 1)
|
else if(hardwareDetect == 2)
|
||||||
{
|
{
|
||||||
Log->print(F("Using PIN "));
|
Log->print(F("Using PIN "));
|
||||||
Log->print(hardwareDetectGpio);
|
Log->print(hardwareDetectGpio);
|
||||||
@@ -62,7 +67,7 @@ void Network::setupDevice()
|
|||||||
pinMode(hardwareDetectGpio, INPUT_PULLUP);
|
pinMode(hardwareDetectGpio, INPUT_PULLUP);
|
||||||
_networkDeviceType = digitalRead(hardwareDetectGpio) == HIGH ? NetworkDeviceType::WiFi : NetworkDeviceType::W5500;
|
_networkDeviceType = digitalRead(hardwareDetectGpio) == HIGH ? NetworkDeviceType::WiFi : NetworkDeviceType::W5500;
|
||||||
}
|
}
|
||||||
else if(hardwareDetect == 2)
|
else if(hardwareDetect == 3)
|
||||||
{
|
{
|
||||||
Log->print(F("W5500 on M5Sack Atom POE"));
|
Log->print(F("W5500 on M5Sack Atom POE"));
|
||||||
_networkDeviceType = NetworkDeviceType::W5500;
|
_networkDeviceType = NetworkDeviceType::W5500;
|
||||||
|
|||||||
@@ -962,9 +962,9 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
|
|||||||
{
|
{
|
||||||
std::vector<std::pair<String, String>> options;
|
std::vector<std::pair<String, String>> options;
|
||||||
|
|
||||||
options.push_back(std::make_pair("0", "Disable W5500 (Wifi only)"));
|
options.push_back(std::make_pair("1", "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", "Detect W5500 (GPIO CS=5; SCK=18; MISO=19; MOSI=23; RST=33)"));
|
||||||
options.push_back(std::make_pair("2", "M5Stack Atom POE (W5500)"));
|
options.push_back(std::make_pair("3", "M5Stack Atom POE (W5500)"));
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
enum class W5500Variant
|
enum class W5500Variant
|
||||||
{
|
{
|
||||||
Generic = 1,
|
Generic = 2,
|
||||||
M5StackAtomPoe = 2
|
M5StackAtomPoe = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
class W5500Device : public NetworkDevice
|
class W5500Device : public NetworkDevice
|
||||||
|
|||||||
Reference in New Issue
Block a user