Skip to content

Commit

Permalink
Fixed WaterLevelATO timer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoimai committed Jun 25, 2016
1 parent a51dd07 commit bd4becb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions RA_ATO/RA_ATO.h
Expand Up @@ -93,6 +93,7 @@ class RA_ATOLowClass : public RA_ATOClass
class RA_ATOWLClass : public RA_ATOClass
{
public:
unsigned long Timer;
inline bool IsActive() { return false; }
};
#endif // WATERLEVELEXPANSION || MULTIWATERLEVELEXPANSION
Expand Down
2 changes: 1 addition & 1 deletion ReefAngel/ReefAngel.cpp
Expand Up @@ -1133,7 +1133,7 @@ void ReefAngelClass::WaterLevelATO(byte ATORelay, int ATOTimeout, byte LowLevel,
Is the low level is reached (meaning we need to top off) and are we not currently topping off
Then we set the timer to be now and start the topping pump
*/
if ( WaterLevel.GetLevel(Channel) < LowLevel && ( !WLATO.IsTopping()) )
if ( WaterLevel.GetLevel(Channel) < LowLevel && ( !WLATO.IsTopping()) && bitRead(AlertFlags,ATOTimeOutFlag)==0)
{
WLATO.Timer = millis();
WLATO.StartTopping();
Expand Down

3 comments on commit bd4becb

@lnevo
Copy link
Contributor

@lnevo lnevo commented on bd4becb Jun 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that the additional check for the timeout flag wouldn't fix the issue because I would think if we we weren't topping and the ATO timeout was clear then we'd be in this if statement regardless. And also when we get into this function we update WLATO.Timer to millis() so millis()-WLAO.Timer woud be close to 0 and not > the ATO Timeout (in my case 36000000). Just wondering what the thought here was. Also the float switch version inherits the same Timer variable, so wondering what the expected effect of explicitly declaring this. Sorry for the quiz, just curious. Gonna take me a bit to test it well enough so want to understand first.

@robertoimai
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, the timer variable wasn't being set correctly and explicitly declaring it seemed to have fixed it.

@lnevo
Copy link
Contributor

@lnevo lnevo commented on bd4becb Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't helped. :(

Please sign in to comment.