reefangel/Libraries — pull request #45 by phrusher (2012-09-03 07:03:20+00:00)
Title: Refactored setup of pH calibrate

Just wanted to check what you think about these changes. I re-factored the pH calibrations to remove the duplicate code so that the internal and expansion are using the same. This also unifies so the same calibration setup is used (static pH or variable pH target) on both internal and external pH probe so the user won't see different layouts and options when doing the different pH calibrations.

The defines are moved to the called function instead of being spread out around each calling function which cleans up the code a little bit.

Moved pH expansion code from PH.h/.cpp to PHExp.h/.cpp and put internal pH reader code in PH.h/.cpp. Added an abstract class (ProbeBaseClass) to be able to pass inherited objects in function and thereby share code easier.

The downside is of course that the compiled size increases a bit (around 240 bytes for RA) so I understand if this is something that won't be accepted. The upside is a little less code and bit easier maintainability. It also creates separation between the displayed info and the data storage, but that might be my personal preferences to keep it like that. This also enables any class with Read() to inherit from ProbeBaseClass and might be useful for creating further general functions down the road.

I do not have a pH expansion so I was not able to test that part but internal pH calibration seem to work fine.