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

Files at this revision

API Documentation at this revision

Comitter:
Bobty
Date:
Mon Sep 28 10:33:14 2015 +0000
Parent:
15:29902a6b3c89
Child:
17:ede9b4bbc4d6
Commit message:
Turned on debugging messages on thermometers; Updated web callbacks method signatures

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
Onewire.lib Show annotated file Show diff for this revision Revisions of this file
RdDS18B20.cpp Show annotated file Show diff for this revision Revisions of this file
RdDS18B20.h Show annotated file Show diff for this revision Revisions of this file
RdWebServer.lib Show annotated file Show diff for this revision Revisions of this file
Thermometers.cpp Show annotated file Show diff for this revision Revisions of this file
Thermometers.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Tue Mar 03 17:36:24 2015 +0000
+++ b/EthernetInterface.lib	Mon Sep 28 10:33:14 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#65b0d840274c
+http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f
--- a/Onewire.lib	Tue Mar 03 17:36:24 2015 +0000
+++ b/Onewire.lib	Mon Sep 28 10:33:14 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/simonbarker/code/Onewire/#b678c7c8203c
+http://mbed.org/users/simonbarker/code/Onewire/#45b6a39002f1
--- a/RdDS18B20.cpp	Tue Mar 03 17:36:24 2015 +0000
+++ b/RdDS18B20.cpp	Mon Sep 28 10:33:14 2015 +0000
@@ -4,7 +4,7 @@
 
 #include "RdDS18B20.h"
 
-// #define SHOW_18B20_DEBUGGING 1
+#define SHOW_18B20_DEBUGGING 1
 
 // Construct onewire bus with desired pin
 DS18B20::DS18B20(PinName mbedPin) : _oneWire(mbedPin)
@@ -131,7 +131,7 @@
     return _temperatureTable[addrIdx];
 }
 
-void DS18B20::SearchToGetAddresses()
+int DS18B20::SearchToGetAddresses()
 {
     _numValidAddresses = 0;
     for (int addrIdx = 0; addrIdx < MAX_BUS_DEVICES; addrIdx++)
@@ -185,5 +185,6 @@
                 break;
         } 
 #endif
-    }  
+    }
+    return _numValidAddresses;
 }
--- a/RdDS18B20.h	Tue Mar 03 17:36:24 2015 +0000
+++ b/RdDS18B20.h	Mon Sep 28 10:33:14 2015 +0000
@@ -15,7 +15,7 @@
     void ReqConvert();
     double ReadTemperature(int addrIdx);
     void DebugPrintAddress(int addrIdx);
-    void SearchToGetAddresses();
+    int SearchToGetAddresses();
     int GetNumAddresses()
     {
         return _numValidAddresses;
--- a/RdWebServer.lib	Tue Mar 03 17:36:24 2015 +0000
+++ b/RdWebServer.lib	Mon Sep 28 10:33:14 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Bobty/code/RdWebServer/#b4b9d4d5e5be
+http://mbed.org/users/Bobty/code/RdWebServer/#ffa1dddd3da4
--- a/Thermometers.cpp	Tue Mar 03 17:36:24 2015 +0000
+++ b/Thermometers.cpp	Mon Sep 28 10:33:14 2015 +0000
@@ -3,7 +3,7 @@
 
 #include "Thermometers.h"
 
-// #define SHOW_THERMOMETER_DEBUGGING 1
+#define SHOW_THERMOMETER_DEBUGGING 1
 
 Thermometers::Thermometers(int numTempSensorPins, const PinName tempSensorPins[], int serviceIntervalInMs)
 {
@@ -11,6 +11,8 @@
     _tempSensorPins = tempSensorPins;
     _serviceIntervalInMs = serviceIntervalInMs;
     _numThermometerBuses = 0;
+    _failAddrCount = 0;
+    _failReadCount = 0;
 }
 
 void Thermometers::Init()
@@ -44,7 +46,9 @@
             for (int busIdx = 0; busIdx < _numThermometerBuses; busIdx++)
             {
                 DS18B20* pThermBus = _thermometerBuses[busIdx];
-                pThermBus->SearchToGetAddresses();
+                int numTherms = pThermBus->SearchToGetAddresses();
+                if (numTherms != 3)
+                    _failAddrCount++;
             }
         }
         else if (_countForGetThermometerAddresses > reGetThermometerAddressesAfterNumReadings)
@@ -64,7 +68,8 @@
             {
                 DS18B20* pThermBus = _thermometerBuses[busIdx];
 #ifdef SHOW_THERMOMETER_DEBUGGING
-                printf("Bus %d Num therms %d\r\n", busIdx, pThermBus->GetNumAddresses());
+                printf("Bus %d Num therms %d Failed Addr %d Failed Read %d\r\n", busIdx, pThermBus->GetNumAddresses(),
+                            _failAddrCount, _failReadCount);
 #endif
                 pThermBus->ReqConvert();
             }                
@@ -88,6 +93,8 @@
                     pThermBus->DebugPrintAddress(addrIdx);
                     printf("\r\n");
 #endif
+                    if (tempValue == DS18B20::INVALID_TEMPERATURE)
+                        _failReadCount++;
                 }
             }                
         }
--- a/Thermometers.h	Tue Mar 03 17:36:24 2015 +0000
+++ b/Thermometers.h	Mon Sep 28 10:33:14 2015 +0000
@@ -37,6 +37,10 @@
     // Counters for state machine
     int _countForThermReadings;
     int _countForGetThermometerAddresses;
+    
+    // DEBUG
+    int _failReadCount;
+    int _failAddrCount;
 };
 
 #endif
--- a/main.cpp	Tue Mar 03 17:36:24 2015 +0000
+++ b/main.cpp	Mon Sep 28 10:33:14 2015 +0000
@@ -151,14 +151,16 @@
     led3 = false;
 }
 
-char* getCurDataCallback(int method, char* cmdStr, char* argStr)
+char* getCurDataCallback(int method, char* cmdStr, char* argStr, char* msgBuffer, int msgLen, 
+                int contentLen, unsigned char* pPayload, int payloadLen, int splitPayloadPos)
 {
     // Format message
     GenBroadcastMessage();
     return broadcastMsgBuffer;
 }
 
-char* setGasUseCallback(int method, char* cmdStr, char* argStr)
+char* setGasUseCallback(int method, char* cmdStr, char* argStr, char* msgBuffer, int msgLen, 
+                int contentLen, unsigned char* pPayload, int payloadLen, int splitPayloadPos)
 {
     pc.printf("Setting gas use count %s\r\n", argStr);
     int newGasUse = 0;
--- a/mbed-rtos.lib	Tue Mar 03 17:36:24 2015 +0000
+++ b/mbed-rtos.lib	Mon Sep 28 10:33:14 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#5448826aa700
+http://mbed.org/users/mbed_official/code/mbed-rtos/#bc9729798a19