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

@@ -6,9 +6,10 @@
#include "../Logger.h"
#include "../MqttTopics.h"
W5500Device::W5500Device(const String &hostname, Preferences* preferences)
W5500Device::W5500Device(const String &hostname, Preferences* preferences, int variant)
: NetworkDevice(hostname),
_preferences(preferences)
_preferences(preferences),
_variant((W5500Variant)variant)
{
initializeMacAddress(_mac);
@@ -37,7 +38,15 @@ void W5500Device::initialize()
resetDevice();
Ethernet.init(ETHERNET_CS_PIN, ETHERNET_SCK_PIN, ETHERNET_MISO_PIN, ETHERNET_MOSI_PIN);
switch(_variant)
{
case W5500Variant::M5StackAtomPoe:
Ethernet.init(ETHERNET_CS_PIN, 22, 23, 33);
break;
default:
Ethernet.init(ETHERNET_CS_PIN);
break;
}
if(_preferences->getBool(preference_mqtt_log_enabled))
{