Heater and Heaters (Plus Uptime!)
- Added uptime to the XML status (you can see it below!)
- Checking to see if SD Card is present and if so, launching SD thread (not saving anything to it, so the thread start is commented out still but it’s the start of an intelligent SD card use, I think..)
- Added a folder for “ProjectObjects”
- Added a class: Heater (see details below)
I’ve always enjoyed the simplicity of this project’s code but it was time to abstract a few things. First and foremost, I will want to be able to control multiple heaters and do some intelligent things (if it’s VERY cold, turn them both on, alternate between the two, detect if one is possibly not heating, etc) and in order to do that I need to abstract the heating system a little further than just an output port. The heater class is designed to be consumed by a “heaters” class which can take in N number of heaters, and allows you to tell it to heat the tank, and keeps track of the ‘advanced’ bits.
A “Heater” consists of:
- output port (_relay) to control the heater on/off
- dateTime (_onTime) to dictate when it was last turned on
- bool _suspect to note the heater is suspect of being non-functioning
- timespan totalTime to keep track of the total time this heater has ran [[currently volatile]]
- bool heating to note if the heater is currently heating
- one constructor which takes an outputPort and sets the heating status based on what that port is currently doing
- Heat() which turns the heater on, sets the _onTime and returns
- TurnOff() which turns off the heater, calculates how long it’s been on this run and adds it to the total time and returns
Not using the Heater class as I haven’t had time to write the Heaters class yet.