Feeding mode and overheat timeout
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Feeding mode and overheat timeout
Hi all,
Two quick questions:
1. How can I change the feeding mode timeout? It is currently set to 900s(15min) if I am not wrong. But this is a default value. I'd like to change it to 5min but I don't know how.
2. Also I'd like to clear the overheat mode automatically after 1hour(and the temp is lower then overheat temp). Is it even posible?
Can someone help?
Thanks!
Victor
Two quick questions:
1. How can I change the feeding mode timeout? It is currently set to 900s(15min) if I am not wrong. But this is a default value. I'd like to change it to 5min but I don't know how.
2. Also I'd like to clear the overheat mode automatically after 1hour(and the temp is lower then overheat temp). Is it even posible?
Can someone help?
Thanks!
Victor
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
This is for feeding:
I would highly recommend not to use auto clear of overheat.
You should really be alerted of that condition.
Code: Select all
InternalMemory.FeedingTimer_write(300);
You should really be alerted of that condition.
Roberto.
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Thanks man!
But in case I travel? I'd like to setup it up in a way that overheat mode clears automatically after 1 or 2 hours if temperature is back to normality. Otherwise overheat would keep my lights off until I get back.
Is it posible?
Thanks again!
But in case I travel? I'd like to setup it up in a way that overheat mode clears automatically after 1 or 2 hours if temperature is back to normality. Otherwise overheat would keep my lights off until I get back.
Is it posible?
Thanks again!
Re: Feeding mode and overheat timeout
I think auto clear makes sense after x amount of time if the temp has "stayed" down. If i have some time later i'll give you some code to tey
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
That works for me too! And no risk involved on that....
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Does anyone know the code for clearing the overheat mode? thanks, Victor
Sent from my iPad using Tapatalk
Sent from my iPad using Tapatalk
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Thanks a lot. I'll figure out a way to make safe use of it.
Regards,
Victor
Regards,
Victor
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
static time_t lastGoodTemp = now();
if(ReefAngel.Params.Temp[T1_PROBE] < InternalMemory.OverheatTemp_read()) lastGoodTemp=now();
if(now()-lastGoodTemp > 0 && now()-lastGoodTemp < 3600) ReefAngel.OverheatClear();
Does it look right? And safe?
Thanks!
if(ReefAngel.Params.Temp[T1_PROBE] < InternalMemory.OverheatTemp_read()) lastGoodTemp=now();
if(now()-lastGoodTemp > 0 && now()-lastGoodTemp < 3600) ReefAngel.OverheatClear();
Does it look right? And safe?
Thanks!
Re: Feeding mode and overheat timeout
that looks wrong. it looks like it will clear it immediately. or maybe I'm missing the point of the check. it looks like as soon as the temp falls below the overheat temp, the last good time gets set, then the if statement clears the overheat every second for 3600 millis.
also, I would store now() in a variable if you are going to use it multiple times in a conditional check.
Sent from my Nexus 7
also, I would store now() in a variable if you are going to use it multiple times in a conditional check.
Sent from my Nexus 7
Re: Feeding mode and overheat timeout
I would structure it a bit differently.
If the temp is over the overheat temp, set the timer to now();
If the timer is greater than 1 hour && the t1_probe is less than the overheat temp then clear the override.
The way your doing it now definitely has some issues but it's close
If the temp is over the overheat temp, set the timer to now();
If the timer is greater than 1 hour && the t1_probe is less than the overheat temp then clear the override.
The way your doing it now definitely has some issues but it's close
Re: Feeding mode and overheat timeout
I would structure it a bit differently.
If the temp is over the overheat temp, set the timer to now();
If the timer is greater than 1 hour && the t1_probe is less than the overheat temp then clear the override.
The way your doing it now definitely has some issues but it's close
If the temp is over the overheat temp, set the timer to now();
If the timer is greater than 1 hour && the t1_probe is less than the overheat temp then clear the override.
The way your doing it now definitely has some issues but it's close
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Thanks guys!
time_t overheatTimer=now();
void CustomOverheatClear(byte probe)
{
if(ReefAngel.Params.Temp[probe] >= InternalMemory.OverheatTemp_read()) overheatTimer=now();
if((now()-overheatTimer > 3600)&&(bitRead(ReefAngel.AlertFlags, OverheatFlag))) ReefAngel.OverheatClear();
}
loop()
{
//...
CustomOverheatClear(T1_PROBE);
//...
}
How does it look now? Is (bitRead(ReefAngel.AlertFlags, OverheatFlag)) gonna tell me if overheat is triggered?
Cheers,
Victor
time_t overheatTimer=now();
void CustomOverheatClear(byte probe)
{
if(ReefAngel.Params.Temp[probe] >= InternalMemory.OverheatTemp_read()) overheatTimer=now();
if((now()-overheatTimer > 3600)&&(bitRead(ReefAngel.AlertFlags, OverheatFlag))) ReefAngel.OverheatClear();
}
loop()
{
//...
CustomOverheatClear(T1_PROBE);
//...
}
How does it look now? Is (bitRead(ReefAngel.AlertFlags, OverheatFlag)) gonna tell me if overheat is triggered?
Cheers,
Victor
Re: Feeding mode and overheat timeout
Looks good to me. The bitRead may have an easier way...Roberto?
Re: Feeding mode and overheat timeout
That is the easier way
Sent from my SM-G900P using Tapatalk
Sent from my SM-G900P using Tapatalk
Roberto.
Re: Feeding mode and overheat timeout
We should write a wrapper function to read each flag like we do for internal memory. Users shouldnt be concerned with how you store the flags or have to use bitRead to get it.
Re: Feeding mode and overheat timeout
I agree.
Can you open an issue on github?
I'll add them to next update.
Can you open an issue on github?
I'll add them to next update.
Roberto.
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
That's cool. Please post the issue number here so we can follow as it develops maybe even contribute!
Re: Feeding mode and overheat timeout
Here you go
Add wrapper functions to read flags #147
Add wrapper functions to read flags #147
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Looks good!
I'd like to contribute with some coding. But I am not familiar with how everything is structured. Where to add those wrapper functions? which lib?
Do you have a list of the all the flags that should be wrapped? Are they all in the same lib?
Sorry if those are noobs questions but I need to warm up here...heheh
See ya!
I'd like to contribute with some coding. But I am not familiar with how everything is structured. Where to add those wrapper functions? which lib?
Do you have a list of the all the flags that should be wrapped? Are they all in the same lib?
Sorry if those are noobs questions but I need to warm up here...heheh
See ya!
Re: Feeding mode and overheat timeout
Yeah, the bits are declared in the Globals.h file.
What is the easiest way??
Creating a function like ReefAngel.IsOverheat()?
What is the easiest way??
Creating a function like ReefAngel.IsOverheat()?
Roberto.
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
I've found the flags....
// Alert Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LeakFlag 3
// Status Flag Bits
#define LightsOnFlag 0
#define FeedingFlag 1
#define WaterChangeFlag 2
Whar do you think? Do we need wrappers for all of them? Where should I place the wrappers?
E.g.:
isOverheat()
isLightsOn()
isFeedingMode()
isWaterChangeMode()
...
and so on!
What are those Exceed flags for?
#define ATO_Single_Exceed_Flag 800 //733 //747
#define ATO_Exceed_Flag 801 //734 //748
#define Overheat_Exceed_Flag 802 //735 //749
Victor
// Alert Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LeakFlag 3
// Status Flag Bits
#define LightsOnFlag 0
#define FeedingFlag 1
#define WaterChangeFlag 2
Whar do you think? Do we need wrappers for all of them? Where should I place the wrappers?
E.g.:
isOverheat()
isLightsOn()
isFeedingMode()
isWaterChangeMode()
...
and so on!
What are those Exceed flags for?
#define ATO_Single_Exceed_Flag 800 //733 //747
#define ATO_Exceed_Flag 801 //734 //748
#define Overheat_Exceed_Flag 802 //735 //749
Victor
Re: Feeding mode and overheat timeout
I don't think we need the status flags. There's already pretty common methods for determining those. I think just for the Alert Flags since there isn't really other ways to determine.
I don't think the Exceed flags are really used either. They may be from some legacy. Now there is just the one in the Alert Flag.
I don't think the Exceed flags are really used either. They may be from some legacy. Now there is just the one in the Alert Flag.
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
I got it!
So I'll focus only on the alert flags.
// Alert Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LeakFlag 3
Something like: isATOTimeOut(), isOverheat(), isBusLock() and isLeakFlag().
I just check for any posible confict with these names. But all clear...they are not being used....
I ask again, where should we be placing these functions? What is the best location for them?
Regards,
Victor
So I'll focus only on the alert flags.
// Alert Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LeakFlag 3
Something like: isATOTimeOut(), isOverheat(), isBusLock() and isLeakFlag().
I just check for any posible confict with these names. But all clear...they are not being used....
I ask again, where should we be placing these functions? What is the best location for them?
Regards,
Victor
Re: Feeding mode and overheat timeout
They should be declared inside ReefAngel.h and the code would be inside ReefAngel.cpp
Roberto.
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Thanks Roberto!
I found an IsLeakDetected() function but it doesn't read from the LeakFlag status. But from what I could understand it already does the job. So I guess we probably don't need a wrapper for LeakFlag. Is that right?
As for the others isATOTimeOut(), isOverheat() and isBusLock() I'll declare and implement the functions and send for your appreciation
Regards,
Victor
I found an IsLeakDetected() function but it doesn't read from the LeakFlag status. But from what I could understand it already does the job. So I guess we probably don't need a wrapper for LeakFlag. Is that right?
As for the others isATOTimeOut(), isOverheat() and isBusLock() I'll declare and implement the functions and send for your appreciation
Regards,
Victor
-
- Posts: 19
- Joined: Tue Jan 21, 2014 3:56 am
Re: Feeding mode and overheat timeout
Thanks Roberto!
I found an IsLeakDetected() function but it doesn't read from the LeakFlag status. But from what I could understand it already does the job. So I guess we probably don't need a wrapper for LeakFlag. Is that right?
As for the others isATOTimeOut(), isOverheat() and isBusLock() I'll declare and implement the functions and send for your appreciation
Regards,
Victor
I found an IsLeakDetected() function but it doesn't read from the LeakFlag status. But from what I could understand it already does the job. So I guess we probably don't need a wrapper for LeakFlag. Is that right?
As for the others isATOTimeOut(), isOverheat() and isBusLock() I'll declare and implement the functions and send for your appreciation
Regards,
Victor