Temp sensor customization
Temp sensor customization
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
Re: Temp sensor customization
I think an array would be better as it should be more stable and if the only downside is older PDE's breaking it should be okay since like you said they are easily fixed.
-
- Posts: 188
- Joined: Fri Dec 30, 2011 6:57 am
Re: Temp sensor customization
Was this change implemented in the new libraries? I used to have a custom main screen using reefangel.params.temp1 (to display the temp 1 value separately in a custom location) but now I kept getting an error by using that reference. Searched and found this thread and changed it to reefangel.params.temp[T1_PROBE] and the error went away.
Now my only issue seems to be file size. I've got my new .ino customized to show the same custom main screen as I had before... but had to strip out all menus and I didn't put any custom functions in the loop section yet.
Ah well, guess I'll have to make a separate thread on that tomorrow. I'm too tired to do it tonight.
Now my only issue seems to be file size. I've got my new .ino customized to show the same custom main screen as I had before... but had to strip out all menus and I didn't put any custom functions in the loop section yet.
Ah well, guess I'll have to make a separate thread on that tomorrow. I'm too tired to do it tonight.
Re: Temp sensor customization
Try enabling Simple Menu on RAGen.
Open RAGen
Click Features
Check Simple Menu
Hit Save
Open RAGen
Click Features
Check Simple Menu
Hit Save
Roberto.
-
- Posts: 188
- Joined: Fri Dec 30, 2011 6:57 am
Re: Temp sensor customization
I had it that way originally and the file was too long. I actually changed to "custom menu" and just didn't have any menu at all... and I just barely had it small enough to compile.
Re: Temp sensor customization
Yes, this was implemented.TanksNStuff wrote:Was this change implemented in the new libraries? I used to have a custom main screen using reefangel.params.temp1 (to display the temp 1 value separately in a custom location) but now I kept getting an error by using that reference. Searched and found this thread and changed it to reefangel.params.temp[T1_PROBE] and the error went away.
Look at the first item under "changes to the libraries". there are code samples that show how to customize what probe monitors the heater & fans and for overheat temps.
http://forum.reefangel.com/viewtopic.php?f=7&t=725
-
- Posts: 188
- Joined: Fri Dec 30, 2011 6:57 am
Re: Temp sensor customization
Ah, I read that post and never noticed it was there. Doh! Thanks Curt!
So, those lines in the examples basically just let you assign which probe is used for the "overheat" or general "heater/fan" operation functions?
Also, the "T1_PROBE, T2_PROBE or T3_PROBE" are the new designations for probe names to be referred when getting data for other functions (like displaying on the screen or as modifiers for IF statements, etc.)?
So, those lines in the examples basically just let you assign which probe is used for the "overheat" or general "heater/fan" operation functions?
Also, the "T1_PROBE, T2_PROBE or T3_PROBE" are the new designations for probe names to be referred when getting data for other functions (like displaying on the screen or as modifiers for IF statements, etc.)?
Re: Temp sensor customization
Yes. That is what they are for.TanksNStuff wrote:Ah, I read that post and never noticed it was there. Doh! Thanks Curt!
So, those lines in the examples basically just let you assign which probe is used for the "overheat" or general "heater/fan" operation functions?
Those labels are actually indices to the array that stores the temperatures. This way you don't have to "guess" what index is for what temp probe. In order to reference the temperature, you need to do:Also, the "T1_PROBE, T2_PROBE or T3_PROBE" are the new designations for probe names to be referred when getting data for other functions (like displaying on the screen or as modifiers for IF statements, etc.)?
Code: Select all
ReefAngel.Params.Temp[T1_PROBE];
Code: Select all
ReefAngel.Params.Temp[1];
-
- Posts: 188
- Joined: Fri Dec 30, 2011 6:57 am
Re: Temp sensor customization
Yea, I tried using ReefAngel.Params.Temp1 (which worked for me before) and that gave me an error.binder wrote: You could do:But it's discouraged in case some things change in the future. It's much more readable and understandable if you spell it out (hence why I created it that way).Code: Select all
ReefAngel.Params.Temp[1];
I got it working with the [T1_PROBE], so I'm all good there. Just trying to understand the concept of why you created it / changed it to this... and your last reply did that for me.
Thanks again Curt.
Re: Temp sensor customization
Yeah, the ReefAngel.Params.Temp1 won't work anymore.
Another reason for putting the temperatures into an array was to make the selecting of the probes much easier. I can just store an index to the array for which probe to reference and it's super easy. Otherwise, it would be much more complicated to allow customization and selection.
Another reason for putting the temperatures into an array was to make the selecting of the probes much easier. I can just store an index to the array for which probe to reference and it's super easy. Otherwise, it would be much more complicated to allow customization and selection.