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:
6:b7064d33e402
Parent:
5:5bccf48799d4
Child:
7:113c68639d10
--- a/main.cpp	Tue Feb 17 21:33:39 2015 +0000
+++ b/main.cpp	Fri Feb 20 08:54:12 2015 +0000
@@ -5,13 +5,15 @@
 #include "GasUseCounter.h"
 #include <stdarg.h>
 
+#define TEST_REMOVE_UDP_AND_NTP 1
+
 // Web and UDB ports 
 const int WEBPORT = 80; // Port for web server
 const int BROADCAST_PORT = 42853; // Arbitrarily chosen port number
 
 // Ticker collects data
-Ticker ticker;
-const int TICK_MS = 250;
+//Ticker ticker;
+//const int TICK_MS = 250;
 
 // Debugging and status
 RawSerial pc(USBTX, USBRX);
@@ -91,9 +93,9 @@
 }
 
 // Ticker's tick function
-void TickFunction()
-{
-}
+//void TickFunction()
+//{
+//}
 
 char* getGasUseCallback(int method, char* cmdStr, char* argStr)
 {
@@ -154,6 +156,9 @@
             }
             pc.printf("Waited %d mins\r\n", i);
         }
+#ifndef TEST_REMOVE_UDP_AND_NTP
+        break;
+#endif                
     }
 }
     
@@ -162,7 +167,7 @@
     pc.baud(115200);
     pc.printf("Gas Monitor V2 - Rob Dobson 2014\r\n");
 
-    ticker.attach(&TickFunction,TICK_MS / 1000.0);
+//    ticker.attach(&TickFunction,TICK_MS / 1000.0);
 
     // Get the current count from the SD Card
     gasUseCounter.Init();
@@ -173,9 +178,11 @@
     
     pc.printf("IP Address is %s\n\r", eth.getIPAddress());
 
+#ifndef TEST_REMOVE_UDP_AND_NTP
     Thread ntpTimeSetter(&ntp_thread);
+#endif
     
-    Thread httpServer(&http_thread, NULL, osPriorityNormal, (DEFAULT_STACK_SIZE * 2.25));
+    Thread httpServer(&http_thread, NULL, osPriorityNormal, (DEFAULT_STACK_SIZE * 3));
     
     while(true)
     {
@@ -183,7 +190,9 @@
         led1 = !led1;
 
         // Service gas count
+#ifndef TEST_REMOVE_UDP_AND_NTP
         if (gasUseCounter.Service())
             SendInfoBroadcast();
+#endif
     }
 }