Skip to content

Commit

Permalink
Merge pull request #213: Issue_212: Sleep Timer Modification card doe…
Browse files Browse the repository at this point in the history
…sn't work properly with
  • Loading branch information
boerge1 authored Jul 31, 2024
2 parents b5b9404 + b09c09f commit 4999ad2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Die SD Karte (Ordner mp3 und advert) hat sich gegenüber der Version 3.1.9 geän

# Change Log

## Version 3.1.11 (04.07.2024)
- [Issue 212](https://github.com/tonuino/TonUINO-TNG/issues/212): Sleep Timer Modification card doesn't work properly with NeoPixel Ring

## Version 3.1.10 (27.06.2024)
- [Issue 210](https://github.com/tonuino/TonUINO-TNG/issues/210): Make text in the admin menu for switching volume button more clearer

Expand Down
2 changes: 1 addition & 1 deletion TonUINO-TNG.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void setup()
LOG(init_log, s_error, F("TonUINO Version 3.1 - refactored by Boerge1\n"));
LOG(init_log, s_error, F("created by Thorsten Voß and licensed under GNU/GPL."));
LOG(init_log, s_error, F("Information and contribution at https://tonuino.de.\n"));
LOG(init_log, s_error, F("V3.1.10 27.06.24\n"));
LOG(init_log, s_error, F("V3.1.11 04.07.24\n"));

#ifdef TonUINO_Classic
LOG(init_log, s_error, F("C "), lf_no);
Expand Down
20 changes: 20 additions & 0 deletions src/modifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void SleepTimer::loop() {
LOG(modifier_log, s_info, str_SleepTimer(), F(" -> SLEEP!"));
if (SM_tonuino::is_in_state<Play>())
SM_tonuino::dispatch(command_e(commandRaw::pause));
fired = true;
//tonuino.resetActiveModifier();
}
else {
Expand All @@ -38,13 +39,15 @@ bool SleepTimer::handleNext() {
mp3.clearFolderQueue();
stopAfterTrackFinished_active = false;
sleepTimer.stop();
fired = true;
//tonuino.resetActiveModifier();
}
return false;
}

void SleepTimer::init(pmode_t, uint8_t special /* is minutes*/) {
LOG(modifier_log, s_info, str_SleepTimer(), F(" minutes: "), special);
fired = false;
stopAfterTrackFinished_active = false;
if (special > 0x80) {
stopAfterTrackFinished = true;
Expand All @@ -55,6 +58,23 @@ void SleepTimer::init(pmode_t, uint8_t special /* is minutes*/) {
sleepTimer.start(special * 60000);
}

bool SleepTimer::handleButton(command cmd) {
if (cmd == command::pause && fired) {
LOG(modifier_log, s_debug, F("SleepTimer::PauseButton -> LOCKED!"));
return true;
}
return false;
}

bool SleepTimer::handleRFID(const folderSettings &/*newCard*/) {
if (fired) {
LOG(modifier_log, s_debug, F("SleepTimer::handleRFID -> LOCKED!"));
return true;
}
return false;
}


void DanceGame::init(pmode_t a_mode, uint8_t a_t) {
LOG(modifier_log, s_info, str_danceGame(), F("t : "), a_t);
mode = a_mode;
Expand Down
3 changes: 3 additions & 0 deletions src/modifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class SleepTimer: public Modifier {
SleepTimer() {}
void loop () final;
bool handleNext () final;
bool handleButton(command cmd ) final;
bool handleRFID (const folderSettings &newCard) final;

pmode_t getActive () final { return pmode_t::sleep_timer; }
void init(pmode_t, uint8_t) final;
Expand All @@ -41,6 +43,7 @@ class SleepTimer: public Modifier {
Timer sleepTimer{};
bool stopAfterTrackFinished{};
bool stopAfterTrackFinished_active{};
bool fired{};
};

class DanceGame: public Modifier {
Expand Down
2 changes: 2 additions & 0 deletions test/src/modifier_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TEST_F(tonuino_test_fixture, SleepTimer_in_play) {
execute_cycle_for_ms(1000);
EXPECT_TRUE(SM_tonuino::is_in_state<Pause>());

tonuino.resetActiveModifier();
goto_idle();
//EXPECT_TRUE(false) << "log: " << Print::get_output();
}
Expand Down Expand Up @@ -83,6 +84,7 @@ TEST_F(tonuino_test_fixture, SleepTimer_in_idle) {
execute_cycle_for_ms(1000);
EXPECT_TRUE(SM_tonuino::is_in_state<Pause>());

tonuino.resetActiveModifier();
goto_idle();
//EXPECT_TRUE(false) << "log: " << Print::get_output();
}
Expand Down

0 comments on commit 4999ad2

Please sign in to comment.