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

Committer:
Bobty
Date:
Mon Sep 28 10:33:14 2015 +0000
Revision:
16:89778849e9f7
Parent:
9:0e103c2f869a
Child:
20:7933076df5af
Turned on debugging messages on thermometers; Updated web callbacks method signatures

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bobty 8:5980547ae71c 1 // Handles OneWire temperature sensors DB18S20
Bobty 8:5980547ae71c 2 // Can handle multiple devices per pin
Bobty 8:5980547ae71c 3 // Rob Dobson, 2015
Bobty 8:5980547ae71c 4
Bobty 8:5980547ae71c 5 #ifndef RdDS18B20__H
Bobty 8:5980547ae71c 6 #define RdDS18B20__H
Bobty 8:5980547ae71c 7
Bobty 8:5980547ae71c 8 #include "mbed.h"
Bobty 8:5980547ae71c 9 #include "Onewire.h"
Bobty 8:5980547ae71c 10
Bobty 8:5980547ae71c 11 class DS18B20
Bobty 8:5980547ae71c 12 {
Bobty 8:5980547ae71c 13 public:
Bobty 8:5980547ae71c 14 DS18B20(PinName mbedPin);
Bobty 8:5980547ae71c 15 void ReqConvert();
Bobty 9:0e103c2f869a 16 double ReadTemperature(int addrIdx);
Bobty 8:5980547ae71c 17 void DebugPrintAddress(int addrIdx);
Bobty 16:89778849e9f7 18 int SearchToGetAddresses();
Bobty 8:5980547ae71c 19 int GetNumAddresses()
Bobty 8:5980547ae71c 20 {
Bobty 8:5980547ae71c 21 return _numValidAddresses;
Bobty 8:5980547ae71c 22 }
Bobty 9:0e103c2f869a 23 uint8_t* GetAddress(int addrIdx, uint8_t* addrBufPtr);
Bobty 8:5980547ae71c 24 char* GetAddressStr(int addrIdx);
Bobty 9:0e103c2f869a 25 double GetLatestTemperature(int addrIdx, time_t& timeOfReading);
Bobty 9:0e103c2f869a 26
Bobty 9:0e103c2f869a 27 static const int ONEWIRE_ADDR_STRLEN = 3 * ONEWIRE_ADDR_BYTES + 1;
Bobty 9:0e103c2f869a 28 static const int MAX_BUS_DEVICES = 8;
Bobty 9:0e103c2f869a 29
Bobty 9:0e103c2f869a 30 static const int INVALID_TEMPERATURE = -1000.0;
Bobty 8:5980547ae71c 31
Bobty 8:5980547ae71c 32 private:
Bobty 8:5980547ae71c 33 int _numValidAddresses;
Bobty 8:5980547ae71c 34 uint8_t _addrTable[MAX_BUS_DEVICES][ONEWIRE_ADDR_BYTES];
Bobty 9:0e103c2f869a 35 double _temperatureTable[MAX_BUS_DEVICES];
Bobty 9:0e103c2f869a 36 time_t _timeOfReadingTable[MAX_BUS_DEVICES];
Bobty 8:5980547ae71c 37 Onewire _oneWire;
Bobty 9:0e103c2f869a 38 char _addrStr[ONEWIRE_ADDR_STRLEN];
Bobty 8:5980547ae71c 39 };
Bobty 8:5980547ae71c 40
Bobty 8:5980547ae71c 41 #endif