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:
16:89778849e9f7
Parent:
9:0e103c2f869a
Child:
19:0367cb46d003
--- 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++;
                 }
             }                
         }