Redundant temp probe
Redundant temp probe
How would I code my overheat functions to check 2 temp probes before acting?
Re: Redundant temp probe
You'd need to make your own overheat function and run it checking both temp probes. What do you have now? Just the overheat ports defined? I can write you up a function tomorrow if you need it
Re: Redundant temp probe
Yes, just the overheat - wow. That would be great. Thank you as always.lnevo wrote:You'd need to make your own overheat function and run it checking both temp probes. What do you have now? Just the overheat ports defined? I can write you up a function tomorrow if you need it
Re: Redundant temp probe
Just want to confirm. Do you want it to overheat when both probes are over or if only one goes over? Right now the code below is for either. If you want to change it switch the || to &&
Code: Select all
void myOverheat()
{
static byte Overheatmillis;
// if overheat probe exceeds the temp
if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() ||
ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() )
Overheatmillis=millis();
if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds
{
ReefAngel.LED.On();
bitSet(ReefAngel.AlertFlags,OverheatFlag);
// invert the ports that are activated
ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i];
}
#endif // RelayExp
}
}
[code]
On a side-note. Roberto how does the Overheatmillis get reset so that if the temp goes over for just a blip it doesn't trigger... you are checking to see if 3 seconds has gone by, but if the temp drops back down we aren't resetting Overheatmillis... therefore the 3 seconds is just a delay? Am I reading that properly?
Re: Redundant temp probe
If both flip.
Perfect - I am going to use this. Thank you.
Perfect - I am going to use this. Thank you.
lnevo wrote:Just want to confirm. Do you want it to overheat when both probes are over or if only one goes over? Right now the code below is for either. If you want to change it switch the || to &&
Code: Select all
void myOverheat() { static byte Overheatmillis; // if overheat probe exceeds the temp if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() || ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() ) Overheatmillis=millis(); if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds { ReefAngel.LED.On(); bitSet(ReefAngel.AlertFlags,OverheatFlag); // invert the ports that are activated ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts; #ifdef RelayExp for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ ) { ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i]; } #endif // RelayExp } } [code] On a side-note. Roberto how does the Overheatmillis get reset so that if the temp goes over for just a blip it doesn't trigger... you are checking to see if 3 seconds has gone by, but if the temp drops back down we aren't resetting Overheatmillis... therefore the 3 seconds is just a delay? Am I reading that properly?[/quote]
Re: Redundant temp probe
Actually... there's an issue with the code above!!!
Just realized what I had asked Roberto and the way it's written is that if either probe is less than the overheat temp it will reset the overheat counter... therefore an update is required to measure both probes...
Forthcoming momentarily...
Just realized what I had asked Roberto and the way it's written is that if either probe is less than the overheat temp it will reset the overheat counter... therefore an update is required to measure both probes...
Forthcoming momentarily...
Re: Redundant temp probe
Ok, only change was the || needed to become &&. So now both probes need to be less than the overheat temp to trigger the overheat condition. if either probe goes under it will start the countdown to 3 seconds. If it stays over then the overheat will trigger.
Please test it
Please test it
Code: Select all
void myOverheat()
{
static byte Overheatmillis;
// if overheat probe exceeds the temp
if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() &&
ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() )
Overheatmillis=millis();
if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds
{
ReefAngel.LED.On();
bitSet(ReefAngel.AlertFlags,OverheatFlag);
// invert the ports that are activated
ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i];
}
#endif // RelayExp
}
}
Re: Redundant temp probe
Roberto, thinking on this. Is this something we can put in the variable for overheat ports? maybe so we can specify something like this:
ReefAngel.OverheatProbe = T1_PROBE | T2_PROBE;
Could be simple enough to add possibly, though I suspect it would need to change a few things...
ReefAngel.OverheatProbe = T1_PROBE | T2_PROBE;
Could be simple enough to add possibly, though I suspect it would need to change a few things...
Re: Redundant temp probe
We would need to create new definitions like this:
Which then could be used as you mentioned.
Otherwise, T1_PROBE | T2_PROBE would result in the value 3, which is actually T3_PROBE
Code: Select all
#define T1_PROBE_BIT 1<<0
#define T2_PROBE_BIT 1<<1
#define T3_PROBE_BIT 1<<2
Otherwise, T1_PROBE | T2_PROBE would result in the value 3, which is actually T3_PROBE
Roberto.
Re: Redundant temp probe
Ok, let me raise an issue and we can see what happens.
Re: Redundant temp probe
Nice - I will hold out to see if it becomes mainstream.lnevo wrote:Ok, let me raise an issue and we can see what happens.
Redundancy seems like a good idea, I think..
Re: Redundant temp probe
Well it may take a while...use that code in the meantime and help make sure no issues
- joshlawless
- Posts: 138
- Joined: Thu May 23, 2013 2:52 pm
Re: Redundant temp probe
I like this idea!