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
Thermometers.h@23:fd5a5a9f30bc, 2015-10-16 (annotated)
- Committer:
- Bobty
- Date:
- Fri Oct 16 09:07:04 2015 +0000
- Revision:
- 23:fd5a5a9f30bc
- Parent:
- 20:7933076df5af
Added index.html file to project for completeness
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobty | 9:0e103c2f869a | 1 | // Handles Thermometers |
Bobty | 9:0e103c2f869a | 2 | // Rob Dobson, 2015 |
Bobty | 9:0e103c2f869a | 3 | |
Bobty | 9:0e103c2f869a | 4 | #ifndef Thermometers__H |
Bobty | 9:0e103c2f869a | 5 | #define Thermometers__H |
Bobty | 9:0e103c2f869a | 6 | |
Bobty | 9:0e103c2f869a | 7 | #include "RdDS18B20.h" |
Bobty | 20:7933076df5af | 8 | #include "Logger.h" |
Bobty | 9:0e103c2f869a | 9 | |
Bobty | 9:0e103c2f869a | 10 | struct TemperatureValue |
Bobty | 9:0e103c2f869a | 11 | { |
Bobty | 9:0e103c2f869a | 12 | time_t timeStamp; |
Bobty | 9:0e103c2f869a | 13 | char address[DS18B20::ONEWIRE_ADDR_STRLEN]; |
Bobty | 9:0e103c2f869a | 14 | double tempInCentigrade; |
Bobty | 9:0e103c2f869a | 15 | }; |
Bobty | 9:0e103c2f869a | 16 | |
Bobty | 9:0e103c2f869a | 17 | class Thermometers |
Bobty | 9:0e103c2f869a | 18 | { |
Bobty | 9:0e103c2f869a | 19 | public: |
Bobty | 20:7933076df5af | 20 | Thermometers(int numTempSensorPins, const PinName tempSensorPins[], int serviceIntervalInMs, Logger &logger); |
Bobty | 9:0e103c2f869a | 21 | void Init(); |
Bobty | 9:0e103c2f869a | 22 | void Service(); |
Bobty | 9:0e103c2f869a | 23 | int GetTemperatureValues(int maxTempValues, TemperatureValue* tempValues, int maxAgeInSecs); |
Bobty | 9:0e103c2f869a | 24 | static const int numSecondsBetweenThermReadings = 10; |
Bobty | 9:0e103c2f869a | 25 | static const int timeForThermReadingInSecs = 2; |
Bobty | 9:0e103c2f869a | 26 | static const int reGetThermometerAddressesAfterNumReadings = 100; |
Bobty | 9:0e103c2f869a | 27 | static const int MAX_ONEWIRE_BUSES = 1; |
Bobty | 9:0e103c2f869a | 28 | static const int MAX_THERMOMETERS = 8; |
Bobty | 9:0e103c2f869a | 29 | |
Bobty | 9:0e103c2f869a | 30 | private: |
Bobty | 9:0e103c2f869a | 31 | // Thermometer info |
Bobty | 9:0e103c2f869a | 32 | int _numTempSensorPins; |
Bobty | 9:0e103c2f869a | 33 | const PinName* _tempSensorPins; |
Bobty | 9:0e103c2f869a | 34 | int _numThermometerBuses; |
Bobty | 9:0e103c2f869a | 35 | DS18B20* _thermometerBuses[MAX_ONEWIRE_BUSES]; |
Bobty | 9:0e103c2f869a | 36 | int _serviceIntervalInMs; |
Bobty | 9:0e103c2f869a | 37 | |
Bobty | 9:0e103c2f869a | 38 | // Counters for state machine |
Bobty | 9:0e103c2f869a | 39 | int _countForThermReadings; |
Bobty | 9:0e103c2f869a | 40 | int _countForGetThermometerAddresses; |
Bobty | 16:89778849e9f7 | 41 | |
Bobty | 16:89778849e9f7 | 42 | // DEBUG |
Bobty | 16:89778849e9f7 | 43 | int _failReadCount; |
Bobty | 16:89778849e9f7 | 44 | int _failAddrCount; |
Bobty | 20:7933076df5af | 45 | Logger &_logger; |
Bobty | 9:0e103c2f869a | 46 | }; |
Bobty | 9:0e103c2f869a | 47 | |
Bobty | 9:0e103c2f869a | 48 | #endif |