waterlevel ato

Basic / Standard Reef Angel hardware
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jul 31, 2017 5:32 am
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
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jul 31, 2017 5:58 am
Ok, I'm the one clearing topping... ok digging deeper.
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jul 31, 2017 6:29 am
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.
Previous

Return to Standard

Who is online

Users browsing this forum: No registered users and 2 guests

cron