It appears that the library is leaking connection objects, leading to the
eventual grind to a halt of the Arduino, which can only be fixed by a reboot.
I have a proposed solution, but I can't test it because I don't have modbus
here. The colleague I researched this for does, but it will be a while before
he returns to his home country to test it and tell me how it went. I wrote this
based on the Arduino documentation, which says this: "The connection persists
when the returned client object goes out of scope; you can close it by calling
client.stop()."
Proposed solution:
diff --git a/Mudbus/Mudbus.cpp b/Mudbus/Mudbus.cpp
index 5c5356c..9340b02 100755
--- a/Mudbus/Mudbus.cpp
+++ b/Mudbus/Mudbus.cpp
@@ -36,6 +36,11 @@ void Mudbus::Run()
// Client client = MbServer.available();
// For Arduino 1.0
EthernetClient client = MbServer.available();
+ if(!client.connected())
+ {
+ client.stop();
+ return;
+ }
if(client.available())
{
Reads = 1 + Reads * (Reads < 999);
Original issue reported on code.google.com by radu...@gmail.com on 18 Sep 2014 at 4:02
Original issue reported on code.google.com by
radu...@gmail.com
on 18 Sep 2014 at 4:02