Overheat automatic clearing

Do you have a question on how to do something.
Ask in here.
Post Reply
marcoc
Posts: 19
Joined: Sat Dec 05, 2015 3:24 pm
Location: Rome, Italy

Overheat automatic clearing

Post by marcoc »

Hi,

I would like to have an automatic clearing of the Overheat status, if the temperature has decreased of a given amount (e.g. 3 degrees). This would guarantee that the system is reset if conditions are OK, even if I am not able to connect to internet from remote.

Can anyone check if this code would do? Thanks.

void CustomOverheatClear(byte probe)
{
if((bitRead(ReefAngel.AlertFlags, OverheatFlag)) && (ReefAngel.Params.Temp[probe] <= InternalMemory.OverheatTemp_read()-3.0))
ReefAngel.OverheatClear();
}

loop()
{
//...
CustomOverheatClear(T1_PROBE);
//..
}
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Overheat automatic clearing

Post by lnevo »

That should work except i think you'd want it to be 30 in order to be 3.0 as temp is stored as a byte value * 10
marcoc
Posts: 19
Joined: Sat Dec 05, 2015 3:24 pm
Location: Rome, Italy

Re: Overheat automatic clearing

Post by marcoc »

Thanks. Just one more question:
the definition
void CustomOverheatClear(byte probe)
{
if((bitRead(ReefAngel.AlertFlags, OverheatFlag)) && (ReefAngel.Params.Temp[probe] <= InternalMemory.OverheatTemp_read()-30))
ReefAngel.OverheatClear();
}

goes within the global variables or in the setup() ?

Thanks again.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Overheat automatic clearing

Post by lnevo »

can't have a function within a function. It goes outside of the setup and loop and then you would call it when appropriate.
Post Reply