Temp sensor customization
Posted: Sat Dec 03, 2011 8:05 pm
There has been some "issues" with the way the libraries are allowing the changing of the temp sensor used to monitor the Overheat and with the Heater & Fan/Chillers.
Currently, I was using a pointer to reference the parameter value for the sensor. The temp sensor values are stored in the Parameters structure and are labeled like this:
Temp1, Temp2, Temp3
To reference them, you use Params.Temp1, Params.Temp2, Params.Temp3.
I was using a reference to switch the parameters around. Using the reference seems to be a little problematic.
I've come up with a solution and I wanted to get some feedback before I implement it fully. I'm going to switch the temp sensor values to an array. Then we can just reference an index into the array for the value that we want and not use any pointers. This will greatly simplify the readability of the code and make the customization for the Heater & Fan/Chiller probe along with the Overheat probe much easier.
We will have 3 defines to reference the probe index:
T1_PROBE, T2_PROBE, T3_PROBE
and then the parameters structure would change to this:
Temp[3]
and referencing them would be Params.Temp[T1_PROBE], Params.Temp[T2_PROBE], Params.Temp[T3_PROBE]
Finally, to change the heater and overheat probes, you would do something like this:
Heater & Chiller/Fan probe
ReefAngel.TempProbe = T1_PROBE;
Overheat probe
ReefAngel.OverheatProbe = T2_PROBE;
This appears to make things simpler to read and work with. The downside is that it will break older PDEs that use CustomMain screens and are displaying their own temp values. Also, it would break any custom code inside PDEs that rely on temperature checks. Of course the breaks are fixed very easily (just changing the way you reference the value like above).
Any thoughts on this proposed change?
curt
Currently, I was using a pointer to reference the parameter value for the sensor. The temp sensor values are stored in the Parameters structure and are labeled like this:
Temp1, Temp2, Temp3
To reference them, you use Params.Temp1, Params.Temp2, Params.Temp3.
I was using a reference to switch the parameters around. Using the reference seems to be a little problematic.
I've come up with a solution and I wanted to get some feedback before I implement it fully. I'm going to switch the temp sensor values to an array. Then we can just reference an index into the array for the value that we want and not use any pointers. This will greatly simplify the readability of the code and make the customization for the Heater & Fan/Chiller probe along with the Overheat probe much easier.
We will have 3 defines to reference the probe index:
T1_PROBE, T2_PROBE, T3_PROBE
and then the parameters structure would change to this:
Temp[3]
and referencing them would be Params.Temp[T1_PROBE], Params.Temp[T2_PROBE], Params.Temp[T3_PROBE]
Finally, to change the heater and overheat probes, you would do something like this:
Heater & Chiller/Fan probe
ReefAngel.TempProbe = T1_PROBE;
Overheat probe
ReefAngel.OverheatProbe = T2_PROBE;
This appears to make things simpler to read and work with. The downside is that it will break older PDEs that use CustomMain screens and are displaying their own temp values. Also, it would break any custom code inside PDEs that rely on temperature checks. Of course the breaks are fixed very easily (just changing the way you reference the value like above).
Any thoughts on this proposed change?
curt