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 committed Nov 12, 2024
1 parent 314e6c2 commit 5c8d8f8
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 5c8d8f8

Please sign in to comment.