temperature control not working

Related to the development libraries, released by Curt Binder
Post Reply
ahmedess
Posts: 174
Joined: Sun May 22, 2011 2:29 pm

Re: temperature control not working

Post by ahmedess »

i'm guessing not a lot of people are using celsius thats why no one reported this bug earlier.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: temperature control not working

Post by binder »

ahmedess wrote:Okay I removed the line that converts the temprature to celsius and it turns out that this is the problem. the controller is working fine now. i guess this means that the controller used to compare celsius to fahrenheit without converting to the same units before comparing. thats why a temperature of 26 was always lower than 78 in value and thats why the heater was on all the time.
That's what I was afraid of, which was why I was having you check it for me. I'm surprised nobody else has caught this before because several people are using celsius and these libraries. It's on my list of things to fix now too, so patience with the fix.

You can still set the display to use Celsius but you won't be able to use the simplified function calls. You won't be able to use the StandardFan(port) function, you will have to manually give the temperature ranges:

Code: Select all

ReefAngel.StandardFan(Port2, 250, 270);  // port, low temp (off temp), high temp (on temp)
// turn on at 27.0C and off at 25.0C
The heater code is the same way:

Code: Select all

ReefAngel.StandardHeater(Port3, 240, 250);  // port, low temp (on temp), high temp (off temp)
// turn on at 24.0C and off at 25.0C
Then you can add in the SetTemperatureUnit(1). The only drawback with using these functions is that the internal memory is not going to be set.

You could also change the SetInternalMemory (or Memory) PDE to have the Celsius values in it, but that won't make a difference with menu option. The menu options will still not work until I get it fixed.

Changing the internal memory would be the ideal thing to do especially if you are using the Client Suite software. If not, the simplest thing to do would be to hard code the values in the PDE file (like I mentioned above).

curt
ahmedess
Posts: 174
Joined: Sun May 22, 2011 2:29 pm

Re: temperature control not working

Post by ahmedess »

I have changed the temprature values in the internal memory file to the celsius values and loaded the code to the controller and its working fine. The only thing that needs to be changed now is the Fahrenheit "F" sign available next to the value in the temperature settings menu displayed on the controller
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: temperature control not working

Post by binder »

ahmedess wrote:I have changed the temprature values in the internal memory file to the celsius values and loaded the code to the controller and its working fine. The only thing that needs to be changed now is the Fahrenheit "F" sign available next to the value in the temperature settings menu displayed on the controller
This is on my list of things to fix up. I would caution against using this menu though. The reason why is the values from 70.0 to 90.0 F are hard coded in. If you goto those screens, you will not be able to get back to using the C values that you programmed into the internal memory.

I think I have a solution (not implemented yet) that would change the menu display based on what the user selects as their temperature setting/value. When I get a working copy of it, I will post and let you know it's available for you to try/test out (of course I would have tested it first to make sure it works). :)

So in the meantime, use caution when going to those menus unless you wanted to change the menu stuff yourself in your own copy of the libraries. It's a pretty simple fix if you want to have it always be C. Let me know and I can send you the simple fix.

curt
ahmedess
Posts: 174
Joined: Sun May 22, 2011 2:29 pm

Re: temperature control not working

Post by ahmedess »

I opened the temperature menu settings and it had the celsius values that i have put in the internal memory file. I havent tried to change them. So if I try to change them I will not be able to change them to the celsius value again, thats what you say,corret?

yes please send the fix
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: temperature control not working

Post by binder »

ahmedess wrote:I opened the temperature menu settings and it had the celsius values that i have put in the internal memory file. I havent tried to change them. So if I try to change them I will not be able to change them to the celsius value again, thats what you say,corret?

yes please send the fix
Yes, what will happen is this:

You can open up the screen and it will display the proper value only it will have the F next to it. If you change the temp up or down, it will correct it and make sure that it is within the range of 70.0 to 90.0. It will not let you go below or above those values. You should be able to cancel out of the screen and be ok but if you click OK you will have your value reset to the F values and have to manually edit it again.

The temporary fix (until I get a permanent one inside the libraries) is as follows:
Look for this function inside ReefAngel.cpp

Code: Select all

void ReefAngelClass::ProcessButtonPressTemps()
{
    showmenu = true;
    ClearScreen(DefaultBGColor);
    switch ( SelectedMenuItem )
    {
        case TempsMenu_Heater:
        {
            int v = InternalMemory.HeaterTempOn_read();
            int y = InternalMemory.HeaterTempOff_read();
            /*
            Change the 700 (70.0) F to 211 (21.1) C
            Change the 900 (90.0) F to 323 (32.3) C
            Change the F to C
            */
            if ( SetupOption(v, y, 211, 323, 3, "C", ".", "Setup Heater", "On @", "Off @") )
            {
                InternalMemory.HeaterTempOn_write(v);
                InternalMemory.HeaterTempOff_write(y);
            }
            break;
        }
        case TempsMenu_Chiller:
        {
            int v = InternalMemory.ChillerTempOn_read();
            int y = InternalMemory.ChillerTempOff_read();
            /*
            Change the 700 (70.0) F to 211 (21.1) C
            Change the 900 (90.0) F to 323 (32.3) C
            Change the F to C
            */
            if ( SetupOption(v, y, 211, 323, 3, "C", ".", "Setup Chiller", "On @", "Off @") )
            {
                InternalMemory.ChillerTempOn_write(v);
                InternalMemory.ChillerTempOff_write(y);
            }
            break;
        }
/// ... continues on with function
The changes are made to the code section above. You just need to mimic them yourself. There are only 6 total changes that I made and they are just 3 different changes made 2 times. Change 700 to 211, change 900 to 323 and change F to C. It's commented above.

Make sure you have Arduino closed when you update the libraries. Save the file and then reopen Arduino and upload to your controller. You should be able to display everything like you want.

Now, I will say that any time you upgrade the libraries, this fix will have to be applied until I get the permanent solution created. This is not a complex change which is why I'm not as skeptical about telling you. But I do want you to know that it will be replaced any time you upgrade the libraries (yes, I know I said it twice but it's worth saying twice).

curt
ahmedess
Posts: 174
Joined: Sun May 22, 2011 2:29 pm

Re: temperature control not working

Post by ahmedess »

I ve also changed the overheating temperature menu

Code: Select all

#ifdef OverheatSetup
        case TempsMenu_Overheat:
        {
            int v = InternalMemory.OverheatTemp_read();
            int y = -1;
            if ( SetupOption(v, y, 266, 933, 4, "C", ".", "Setup Overheat", "", "") )
            {
                InternalMemory.OverheatTemp_write(v);
            }
            break;
        }
#endif
What does the number 4 correspond to, in the SetupOption() function?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: temperature control not working

Post by binder »

ahmedess wrote:I ve also changed the overheating temperature menu

What does the number 4 correspond to, in the SetupOption() function?
The overheat temperature menu is only available if you enable it. It's disabled by default. So changing that there won't affect anything unless you enable the menu entry. Also, if you enable it, make sure you set your internal memory value appropriately to C.

The 4 is the maximum number of digits in the option. The overheat menu goes up to 150.0 F, which is 4 digits. With your changes to C, the number of digits is smaller so you should change it to 3. This isn't necessary but will help ensure the formatting / displaying on the screen is consistent with the rest of the menus.

Here's the complete options for SetupOption()
  • v - Initial/stored value for the first option
  • y - Initial/stored value for the second option (if any)
  • rangemin - minimum value of the range
  • rangemax - maximum value of the range
  • maxdigits - maximum number of digits that can be displayed for an option
  • unit - Unit for the options (can be empty string)
  • subunit - Any subunits, typically a . (period) for the decimal point (can be empty string)
  • title - Screen title (can be empty string)
  • prefix1 - Prefix for first option (can be empty string)
  • prefix2 - Prefix for second option (can be empty string)
That's just some additional explanation of that function. You will most likely not need it at all, but sometimes it's good to know.

curt
Post Reply