lincomatic / open_evse

Firmware for Open EVSE
GNU General Public License v3.0
114 stars 163 forks source link

Craigk46 temperature monitoring #24

Closed craigk46 closed 9 years ago

craigk46 commented 9 years ago

I merged my temperature monitoring work with Lincomatic's latest development branch. I'll write some document later today to help anyone understand the functionality that exists and a few enhancements that I think are still needed. Even if you only have the RGB LCD you can begin using this to monitor ambient temperatures sensed by the RTC chip's internal sensor.

Look for TEMPERATURE_MONITORING in the main code and the open_evse.h file. I added enough comments that even before I write a document you will be able to figure out how to evaluate how it works. Certainly let me know if you have any questions.

Best Wishes, Craig

craigk46 commented 9 years ago

Hey, I realize now that two libraries are also needed. I'm a noobie as you probably already know. I couldn't find an effective way to share the two library folders yet. I'll keep looking at how to do that. I'll let you know when I have them shared. If all else fails you can get them from Adafruit.com for the MCP9808 and the TMP007.

craigk46 commented 9 years ago

OK, patience with me while I'm learning GitHub. I think everything is in place now including the libraries I omitted previously. I'm happy to be learning this nice GitHub tool.

lincomatic commented 9 years ago

The current scale factor is an integer. would you rather default to 220 or 219?

lincomatic commented 9 years ago

I went ahead and rounded up to 220. I did a good bit of code rearranging... hope you don't mind.. hope I didn't break anything...

1) got rid of unused class Temp 2) moved all temp related stuff to class TempMonitor. got rid of extra gobal variables, changed flags to bits from separate bytes. 3) moved non-display code to EvseController::Update() .. please don't put any non-display code into OnboardDisplay::Update() ... it isn't guaranteed to be called at the proper time ... any code related to actual EVSE functionality must be added to EvseController::Update() instead 4) turned off TEMPERATURE_MONITORING by default for now.

the compiled size w/ monitoring on went down from 30874 to 29944 after the changes. Please give it a whirl and let me know if messed anything up. Thanks!

craigk46 commented 9 years ago

Thanks for all of the improvements. You can tell I've had no training in C++, only assembly language and C. I'm glad for your help. 220 is fine for the scale factor.

I remember my motivation for putting things in the display update instead of the main loop - it was my lazy way of having my stuff only run once per second. I'll take a look and test the code probably tonight after work. Having not looked at the changes yet I'll guess I have to be sure that the sensors are given enough time to run their conversions since most take a half second or more. All that means is we may have to add something where we don't poll the sensors' results every time update() runs and instead use some time measure to gate whether the sensors are read or not.

Nice that proper coding shaved almost 1K off of the size.

Thanks Again, Craig

lincomatic commented 9 years ago

The reading code I moved executes only once per second. Hopefully, I didn't break any of your logic in the porting process.

lincomatic commented 9 years ago

Forgot to mention... I also patched the Adafruit libs for compatibility with Arduino 0022

lincomatic commented 9 years ago

I'm going to close the pull request now. Let's continue the discussion via email