Add option to ignore pause during condition check

This commit is contained in:
WarmUpTill 2024-06-06 20:19:13 +02:00 committed by WarmUpTill
parent 7e1d20031c
commit 99c8a46296
2 changed files with 4 additions and 3 deletions

View File

@ -101,7 +101,7 @@ void Macro::PrepareMoveToGroup(std::shared_ptr<Macro> group,
}
}
bool Macro::CeckMatch()
bool Macro::CeckMatch(bool ignorePause)
{
if (_isGroup) {
return false;
@ -109,7 +109,7 @@ bool Macro::CeckMatch()
_matched = false;
for (auto &c : _conditions) {
if (_paused) {
if (_paused && !ignorePause) {
vblog(LOG_INFO, "Macro %s is paused", _name.c_str());
return false;
}
@ -185,6 +185,7 @@ bool Macro::CeckMatch()
if (!_conditionSateChanged && _performActionsOnChange) {
_onPreventedActionExecution = true;
}
_lastMatched = _matched;
_lastCheckTime = std::chrono::high_resolution_clock::now();
return _matched;

View File

@ -29,7 +29,7 @@ public:
std::string Name() const { return _name; }
void SetName(const std::string &name);
bool CeckMatch();
bool CeckMatch(bool ignorePause = false);
bool Matched() const { return _matched; }
int64_t MsSinceLastCheck() const;
bool ShouldRunActions() const;