I know what you mean, three cups so far. I may have answer my own question, if you have time, please check my logic.
Change to two separate tests.
if on latch, test for the float totalizer being on for 5 minutes, (assuming its not broken) should be plenty of time for the level to settle. Clear the off latch, and set the alarm stuff.
if off latch, clear the on latch, and the totalizer.
if (flg_water[nCntl_idx] == True) then
//--- Read current leases high water switch ---
ppWater_Point = pptWater[nCntl_idx];
if (IsOnLatchSet(*ppWater_Point)) then
if (GetOnTimeTotalizer(*ppWater_Point) > 300) then
ClearOffLatch(*ppWater_Point); //--- clear the off latch ---
//--- Set the water alarm for the current lease ---
ntLease_ALM_water[nCntl_lease_xref] = ALM_RED;
ntLease_ALM[nCntl_lease_xref] = ALM_RED;
ALM_Master_Alarm = ALM_RED;
if (IsOffLatchSet(*ppWater_Point)) then
ClearOnLatch(*ppWater_Point); //--- clear the on latch ---
GetRestartOnTimeTotalizer(*ppWater_Point); //--- clear on time total ---
//--- Clear the water alarm for the current lease ---
ntLease_ALM_water[nCntl_lease_xref] = ALM_GRN;