Skip to content

Commit

Permalink
CustomWarning: fix repeattime logic
Browse files Browse the repository at this point in the history
The RepeatTime setting was also the worst-case detection time
  • Loading branch information
robertlong13 authored and meee1 committed Nov 12, 2024
1 parent b8a5cc9 commit b5a456f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions ExtLibs/Utilities/Warnings/CustomWarning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,40 +183,45 @@ public bool CheckValue(bool userepeattime = true)
if (userepeattime && DateTime.Now < lastrepeat.AddSeconds(RepeatTime))
return false;

lastrepeat = DateTime.Now;
bool condition = false;

switch (ConditionType)
{
case Conditional.EQ:
if (GetValue == Warning)
return true;
condition = true;
break;
case Conditional.GT:
if (GetValue > Warning)
return true;
condition = true;
break;
case Conditional.GTEQ:
if (GetValue >= Warning)
return true;
condition = true;
break;
case Conditional.LT:
if (GetValue < Warning)
return true;
condition = true;
break;
case Conditional.LTEQ:
if (GetValue <= Warning)
return true;
condition = true;
break;
case Conditional.NEQ:
if (GetValue != Warning)
return true;
condition = true;
break;
case Conditional.NONE:

break;
}

return false;
if (condition)
{
lastrepeat = DateTime.Now;
}

return condition;
}


Expand Down

0 comments on commit b5a456f

Please sign in to comment.