Skip to content

Commit

Permalink
Fix clothing of SettingSetter if timer run
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1ol committed Jun 29, 2024
1 parent 3265998 commit 2664ee3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SettingsSetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ void SettingsSetter::process() {
break;
}
}

bool SettingsSetter::couldBeClosed() const {
return m_timer.state() == Timer::STOPPED;
}
2 changes: 2 additions & 0 deletions src/SettingsSetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class SettingsSetter final {

void process();

bool couldBeClosed() const;

private:
void processSetLagTime();
void processSetBacklight();
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void loop() {

if (gRelayState == LOW && gTimer.state() != Timer::RUNNING && gSettingBtn.hold()) {
if (gSettingsSetter) {
if (!gSettingsSetter->couldBeClosed())
return;
delete gSettingsSetter;
gSettingsSetter = nullptr;
} else {
Expand Down

0 comments on commit 2664ee3

Please sign in to comment.