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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Thermometers.h Source File

Thermometers.h

00001 // Handles Thermometers
00002 // Rob Dobson, 2015
00003 
00004 #ifndef Thermometers__H
00005 #define Thermometers__H
00006 
00007 #include "RdDS18B20.h"
00008 #include "Logger.h"
00009 
00010 struct TemperatureValue
00011 {
00012     time_t timeStamp;
00013     char address[DS18B20::ONEWIRE_ADDR_STRLEN];
00014     double tempInCentigrade;
00015 };
00016 
00017 class Thermometers
00018 {
00019 public:
00020     Thermometers(int numTempSensorPins, const PinName tempSensorPins[], int serviceIntervalInMs, Logger &logger);
00021     void Init();
00022     void Service();
00023     int GetTemperatureValues(int maxTempValues, TemperatureValue* tempValues, int maxAgeInSecs);
00024     static const int numSecondsBetweenThermReadings = 10;
00025     static const int timeForThermReadingInSecs = 2;
00026     static const int reGetThermometerAddressesAfterNumReadings = 100;
00027     static const int MAX_ONEWIRE_BUSES = 1;
00028     static const int MAX_THERMOMETERS = 8;
00029     
00030 private:
00031     // Thermometer info
00032     int _numTempSensorPins;
00033     const PinName* _tempSensorPins;
00034     int _numThermometerBuses;
00035     DS18B20* _thermometerBuses[MAX_ONEWIRE_BUSES];
00036     int _serviceIntervalInMs;
00037 
00038     // Counters for state machine
00039     int _countForThermReadings;
00040     int _countForGetThermometerAddresses;
00041     
00042     // DEBUG
00043     int _failReadCount;
00044     int _failAddrCount;
00045     Logger &_logger;
00046 };
00047 
00048 #endif