Page 1 of 1

Overheat automatic clearing

Posted: Tue Jun 21, 2016 1:50 am
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);
//..
}

Overheat automatic clearing

Posted: Tue Jun 21, 2016 6:18 am
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

Re: Overheat automatic clearing

Posted: Tue Jun 28, 2016 1:27 pm
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.

Re: Overheat automatic clearing

Posted: Tue Jun 28, 2016 9:29 pm
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.