remove nwdelay
This commit is contained in:
@@ -41,8 +41,6 @@ void W5500Device::initialize()
|
|||||||
_mqttClient->setBufferSize(_mqttMaxBufferSize);
|
_mqttClient->setBufferSize(_mqttMaxBufferSize);
|
||||||
|
|
||||||
reconnect();
|
reconnect();
|
||||||
|
|
||||||
_fromTask = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +83,7 @@ bool W5500Device::reconnect()
|
|||||||
Ethernet.begin(_mac, ip);
|
Ethernet.begin(_mac, ip);
|
||||||
Ethernet.setSubnetMask(subnet);
|
Ethernet.setSubnetMask(subnet);
|
||||||
|
|
||||||
nwDelay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -110,11 +108,11 @@ void W5500Device::resetDevice()
|
|||||||
Serial.println(F("Resetting network hardware."));
|
Serial.println(F("Resetting network hardware."));
|
||||||
pinMode(ETHERNET_RESET_PIN, OUTPUT);
|
pinMode(ETHERNET_RESET_PIN, OUTPUT);
|
||||||
digitalWrite(ETHERNET_RESET_PIN, HIGH);
|
digitalWrite(ETHERNET_RESET_PIN, HIGH);
|
||||||
nwDelay(250);
|
delay(250);
|
||||||
digitalWrite(ETHERNET_RESET_PIN, LOW);
|
digitalWrite(ETHERNET_RESET_PIN, LOW);
|
||||||
nwDelay(50);
|
delay(50);
|
||||||
digitalWrite(ETHERNET_RESET_PIN, HIGH);
|
digitalWrite(ETHERNET_RESET_PIN, HIGH);
|
||||||
nwDelay(1500);
|
delay(1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -161,18 +159,6 @@ void W5500Device::initializeMacAddress(byte *mac)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void W5500Device::nwDelay(unsigned long ms)
|
|
||||||
{
|
|
||||||
if(_fromTask)
|
|
||||||
{
|
|
||||||
vTaskDelay( ms / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delay(ms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void W5500Device::update()
|
void W5500Device::update()
|
||||||
{
|
{
|
||||||
_maintainResult = Ethernet.maintain();
|
_maintainResult = Ethernet.maintain();
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void resetDevice();
|
void resetDevice();
|
||||||
void initializeMacAddress(byte* mac);
|
void initializeMacAddress(byte* mac);
|
||||||
void nwDelay(unsigned long ms);
|
|
||||||
|
|
||||||
bool _fromTask = false;
|
|
||||||
|
|
||||||
EthernetClient* _ethClient = nullptr;
|
EthernetClient* _ethClient = nullptr;
|
||||||
PubSubClient* _mqttClient = nullptr;
|
PubSubClient* _mqttClient = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user