diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-12-02 02:11:44 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-12-02 02:11:44 +0300 |
commit | 600aabe66c5087af4642946d3ee0191167b2830c (patch) | |
tree | a6b9b1a5dc3b41d805e4a3a176e8a84be0345de4 /src/Networking/W5500Ethernet | |
parent | fda7f573aaf3d70d4c3dced459bdc75909a54de4 (diff) |
Ethernet and other fixes
Fixed data corruption during file uploads. We now use a separate task to read data from the GMAC.
Bug fix for M574 S0
Bug fix for software reset data report wheh no module was spinning
Diffstat (limited to 'src/Networking/W5500Ethernet')
-rw-r--r-- | src/Networking/W5500Ethernet/W5500Interface.cpp | 31 | ||||
-rw-r--r-- | src/Networking/W5500Ethernet/W5500Interface.h | 2 | ||||
-rw-r--r-- | src/Networking/W5500Ethernet/W5500Socket.cpp | 4 | ||||
-rw-r--r-- | src/Networking/W5500Ethernet/W5500Socket.h | 2 |
4 files changed, 16 insertions, 23 deletions
diff --git a/src/Networking/W5500Ethernet/W5500Interface.cpp b/src/Networking/W5500Ethernet/W5500Interface.cpp index 0afe772d..f6379a89 100644 --- a/src/Networking/W5500Ethernet/W5500Interface.cpp +++ b/src/Networking/W5500Ethernet/W5500Interface.cpp @@ -247,8 +247,8 @@ void W5500Interface::Stop() } } -// Main spin loop. If 'full' is true then we are being called from the main spin loop. If false then we are being called during HSMCI idle time. -void W5500Interface::Spin(bool full) +// Main spin loop +void W5500Interface::Spin() { switch(state) { @@ -262,7 +262,7 @@ void W5500Interface::Spin(bool full) { MutexLocker lock(interfaceMutex); - if (full && wizphy_getphylink() == PHY_LINK_ON) + if (wizphy_getphylink() == PHY_LINK_ON) { usingDhcp = ipAddress.IsNull(); if (usingDhcp) @@ -283,7 +283,6 @@ void W5500Interface::Spin(bool full) break; case NetworkState::obtainingIP: - if (full) { MutexLocker lock(interfaceMutex); @@ -314,13 +313,10 @@ void W5500Interface::Spin(bool full) break; case NetworkState::connected: - if (full) - { - InitSockets(); - platform.MessageF(NetworkInfoMessage, "Network running, IP address = %s\n", IP4String(ipAddress).c_str()); - mdnsResponder->Announce(); - state = NetworkState::active; - } + InitSockets(); + platform.MessageF(NetworkInfoMessage, "Network running, IP address = %s\n", IP4String(ipAddress).c_str()); + mdnsResponder->Announce(); + state = NetworkState::active; break; case NetworkState::active: @@ -331,7 +327,7 @@ void W5500Interface::Spin(bool full) if (wizphy_getphylink() == PHY_LINK_ON) { // Maintain DHCP - if (full && usingDhcp) + if (usingDhcp) { const uint32_t now = millis(); if (now - lastTickMillis >= 1000) @@ -349,14 +345,11 @@ void W5500Interface::Spin(bool full) } // Poll the next TCP socket - sockets[nextSocketToPoll]->Poll(full); + sockets[nextSocketToPoll]->Poll(); // Keep mDNS alive - mdnsSocket->Poll(full); - if (full) - { - mdnsResponder->Spin(); - } + mdnsSocket->Poll(); + mdnsResponder->Spin(); // Move on to the next TCP socket for next time ++nextSocketToPoll; @@ -365,7 +358,7 @@ void W5500Interface::Spin(bool full) nextSocketToPoll = 0; } } - else if (full) + else { // debugPrintf("Lost phy link\n"); if (usingDhcp) diff --git a/src/Networking/W5500Ethernet/W5500Interface.h b/src/Networking/W5500Ethernet/W5500Interface.h index 870fa7dc..d191c492 100644 --- a/src/Networking/W5500Ethernet/W5500Interface.h +++ b/src/Networking/W5500Ethernet/W5500Interface.h @@ -37,7 +37,7 @@ public: void Init() override; void Activate() override; void Exit() override; - void Spin(bool full) override; + void Spin() override; void Diagnostics(MessageType mtype) override; GCodeResult EnableInterface(int mode, const StringRef& ssid, const StringRef& reply) override; // enable or disable the network diff --git a/src/Networking/W5500Ethernet/W5500Socket.cpp b/src/Networking/W5500Ethernet/W5500Socket.cpp index e07ce8ce..6dd7a133 100644 --- a/src/Networking/W5500Ethernet/W5500Socket.cpp +++ b/src/Networking/W5500Ethernet/W5500Socket.cpp @@ -172,7 +172,7 @@ void W5500Socket::Taken(size_t len) } // Poll a socket to see if it needs to be serviced -void W5500Socket::Poll(bool full) +void W5500Socket::Poll() { if (state != SocketState::disabled) { @@ -205,7 +205,7 @@ void W5500Socket::Poll(bool full) whenConnected = millis(); } - if (full && state == SocketState::listening) // if it is a new connection + if (state == SocketState::listening) // if it is a new connection { if (reprap.GetNetwork().FindResponder(this, protocol)) { diff --git a/src/Networking/W5500Ethernet/W5500Socket.h b/src/Networking/W5500Ethernet/W5500Socket.h index bc00827f..c0750289 100644 --- a/src/Networking/W5500Ethernet/W5500Socket.h +++ b/src/Networking/W5500Ethernet/W5500Socket.h @@ -19,7 +19,7 @@ public: W5500Socket(NetworkInterface *iface); void Init(SocketNumber s, Port serverPort, NetworkProtocol p); - void Poll(bool full) override; + void Poll() override; void Close() override; void Terminate() override; void TerminateAndDisable() override; |