Monitor for central heating system (e.g. 2zones+hw) Supports up to 15 temp probes (DS18B20/DS18S20) 3 valve monitors Gas pulse meter recording Use stand-alone or with nodeEnergyServer See http://robdobson.com/2015/09/central-heating-monitor

Dependencies:   EthernetInterfacePlusHostname NTPClient Onewire RdWebServer SDFileSystem-RTOS mbed-rtos mbed-src

Revision:
1:518f39df3485
Parent:
0:f6611c8f453c
Child:
2:6bfef0839102
--- a/main.cpp	Fri Nov 07 14:15:21 2014 +0000
+++ b/main.cpp	Fri Nov 07 14:44:23 2014 +0000
@@ -73,10 +73,32 @@
                         *pOutBuf = gasPulseVals[i] ? '1' : '0';
                         pOutBuf+=2;
                     }
-                    sendSocket.sendTo(broadcast, outBuf, sizeof(outBuf)-2);
-                    printf("Sending %s", outBuf);
+                    int bytesToSend = sizeof(outBuf) - 2;
+                    int rslt = sendSocket.sendTo(broadcast, outBuf, bytesToSend);
+                    if (rslt == bytesToSend)
+                    {
+                        printf("Sent ok %s", outBuf);
+                    }
+                    else if (rslt == -1)
+                    {
+                        printf("Failed to send %s", outBuf);
+                        isConnected = false;
+                    }
+                    else
+                    {
+                        printf("Didn't send all of %s", outBuf);
+                        isConnected = false;
+                    }
                 }
             }
+            
+            // See if anything has failed
+            if (!isConnected)
+            {
+                sendSocket.close();
+                eth.disconnect();
+                Thread::wait(1000);
+            }
         }
     }
 }
\ No newline at end of file