waterlevel ato

Basic / Standard Reef Angel hardware
Post Reply
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: waterlevel ato

Post by lnevo »

Yeah but it's something other topping is not staying set, causing it to go into a constant restarting loop.

So I added a Serial.println(topping); whenever StartTopping or StopTopping are called.

inline void StartTopping() { topping = true; Serial.println(topping);}
inline void StopTopping() { topping = false; Serial.println(topping);}

Starting: 161841
0
0
0
1
Starting: 162052
0
0
0
1
Starting: 162264
0
0
0
1
Starting: 162413
0
0
0
1

The Starting statement is the millis right after we call StartTopping

if ( WaterLevel.GetLevel(Channel) < LowLevel && ( !WLATO.IsTopping()) && bitRead(AlertFlags,ATO
{
WLATO.Timer = millis();
WLATO.StartTopping();
Relay.On(ATORelay);
Serial.print("Starting: ");
Serial.println(WLATO.Timer);
}
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: waterlevel ato

Post by lnevo »

Ok, I'm the one clearing topping... ok digging deeper.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: waterlevel ato

Post by lnevo »

Ok so there's definitely an opportunity for a wrap in the unsigned long that coudl cause the timeout to fire prematureley...

if ( (millis()-WLATO.Timer > TimeTimeout) && (WLATO.IsTopping() )

If millis does wrap (which to does, but supposedly every 50 days) then the current time will be less than the timer was set for and then when we subtract it will wrap and be greater than TimeTimeout. But it should be rare and it isn't, unless it's wrapping sooner then expected.
Post Reply