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@9:0e103c2f869a, 2015-02-22 (annotated)
- Committer:
- Bobty
- Date:
- Sun Feb 22 11:57:12 2015 +0000
- Revision:
- 9:0e103c2f869a
- Child:
- 16:89778849e9f7
Moved thermometer code to separate class
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 | 9:0e103c2f869a | 8 | |
Bobty | 9:0e103c2f869a | 9 | struct TemperatureValue |
Bobty | 9:0e103c2f869a | 10 | { |
Bobty | 9:0e103c2f869a | 11 | time_t timeStamp; |
Bobty | 9:0e103c2f869a | 12 | char address[DS18B20::ONEWIRE_ADDR_STRLEN]; |
Bobty | 9:0e103c2f869a | 13 | double tempInCentigrade; |
Bobty | 9:0e103c2f869a | 14 | }; |
Bobty | 9:0e103c2f869a | 15 | |
Bobty | 9:0e103c2f869a | 16 | class Thermometers |
Bobty | 9:0e103c2f869a | 17 | { |
Bobty | 9:0e103c2f869a | 18 | public: |
Bobty | 9:0e103c2f869a | 19 | Thermometers(int numTempSensorPins, const PinName tempSensorPins[], int serviceIntervalInMs); |
Bobty | 9:0e103c2f869a | 20 | void Init(); |
Bobty | 9:0e103c2f869a | 21 | void Service(); |
Bobty | 9:0e103c2f869a | 22 | int GetTemperatureValues(int maxTempValues, TemperatureValue* tempValues, int maxAgeInSecs); |
Bobty | 9:0e103c2f869a | 23 | static const int numSecondsBetweenThermReadings = 10; |
Bobty | 9:0e103c2f869a | 24 | static const int timeForThermReadingInSecs = 2; |
Bobty | 9:0e103c2f869a | 25 | static const int reGetThermometerAddressesAfterNumReadings = 100; |
Bobty | 9:0e103c2f869a | 26 | static const int MAX_ONEWIRE_BUSES = 1; |
Bobty | 9:0e103c2f869a | 27 | static const int MAX_THERMOMETERS = 8; |
Bobty | 9:0e103c2f869a | 28 | |
Bobty | 9:0e103c2f869a | 29 | private: |
Bobty | 9:0e103c2f869a | 30 | // Thermometer info |
Bobty | 9:0e103c2f869a | 31 | int _numTempSensorPins; |
Bobty | 9:0e103c2f869a | 32 | const PinName* _tempSensorPins; |
Bobty | 9:0e103c2f869a | 33 | int _numThermometerBuses; |
Bobty | 9:0e103c2f869a | 34 | DS18B20* _thermometerBuses[MAX_ONEWIRE_BUSES]; |
Bobty | 9:0e103c2f869a | 35 | int _serviceIntervalInMs; |
Bobty | 9:0e103c2f869a | 36 | |
Bobty | 9:0e103c2f869a | 37 | // Counters for state machine |
Bobty | 9:0e103c2f869a | 38 | int _countForThermReadings; |
Bobty | 9:0e103c2f869a | 39 | int _countForGetThermometerAddresses; |
Bobty | 9:0e103c2f869a | 40 | }; |
Bobty | 9:0e103c2f869a | 41 | |
Bobty | 9:0e103c2f869a | 42 | #endif |