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
Diff: Thermometers.h
- Revision:
- 9:0e103c2f869a
- Child:
- 16:89778849e9f7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Thermometers.h Sun Feb 22 11:57:12 2015 +0000 @@ -0,0 +1,42 @@ +// Handles Thermometers +// Rob Dobson, 2015 + +#ifndef Thermometers__H +#define Thermometers__H + +#include "RdDS18B20.h" + +struct TemperatureValue +{ + time_t timeStamp; + char address[DS18B20::ONEWIRE_ADDR_STRLEN]; + double tempInCentigrade; +}; + +class Thermometers +{ +public: + Thermometers(int numTempSensorPins, const PinName tempSensorPins[], int serviceIntervalInMs); + void Init(); + void Service(); + int GetTemperatureValues(int maxTempValues, TemperatureValue* tempValues, int maxAgeInSecs); + static const int numSecondsBetweenThermReadings = 10; + static const int timeForThermReadingInSecs = 2; + static const int reGetThermometerAddressesAfterNumReadings = 100; + static const int MAX_ONEWIRE_BUSES = 1; + static const int MAX_THERMOMETERS = 8; + +private: + // Thermometer info + int _numTempSensorPins; + const PinName* _tempSensorPins; + int _numThermometerBuses; + DS18B20* _thermometerBuses[MAX_ONEWIRE_BUSES]; + int _serviceIntervalInMs; + + // Counters for state machine + int _countForThermReadings; + int _countForGetThermometerAddresses; +}; + +#endif