Skip to content

Commit

Permalink
Fix type in beeper.h
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mpr1c3 committed Sep 16, 2023
1 parent d1aecf2 commit 7fa5d06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ayab/beeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

enum class BeepState : unsigned char {Idle, Wait, On, Off};

constexpr unsigned int BEEP_DELAY = 0U; // ms
constexpr unsigned int BEEP_DELAY = 50U; // ms

constexpr uint8_t BEEP_NUM_READY = 5U;
constexpr uint8_t BEEP_NUM_FINISHEDLINE = 3U;
Expand Down
11 changes: 7 additions & 4 deletions test/test_beeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ class BeeperTest : public ::testing::Test {
ASSERT_EQ(beeper->getState(), BeepState::Wait);
for (uint8_t i = 0; i < repeats; i++) {
expectedBeepSchedule(BEEP_DELAY * 2 * i);
ASSERT_EQ(beeper->getState(), BeepState::On);
EXPECT_CALL(*arduinoMock, analogWrite(PIEZO_PIN, BEEP_ON_DUTY));
expectedBeepSchedule(BEEP_DELAY * 2 * i + 1);
expectedBeepSchedule(BEEP_DELAY * 2 * i);
ASSERT_EQ(beeper->getState(), BeepState::Wait);
expectedBeepSchedule(BEEP_DELAY * (2 * i + 1));
ASSERT_EQ(beeper->getState(), BeepState::Off);
EXPECT_CALL(*arduinoMock, analogWrite(PIEZO_PIN, BEEP_OFF_DUTY));
expectedBeepSchedule(BEEP_DELAY * (2 * i + 1) + 1);
expectedBeepSchedule(BEEP_DELAY * (2 * i + 1));
ASSERT_EQ(beeper->getState(), BeepState::Wait);
}
expectedBeepSchedule(BEEP_DELAY * (2 * repeats));
EXPECT_CALL(*arduinoMock, analogWrite(PIEZO_PIN, BEEP_NO_DUTY));
expectedBeepSchedule(BEEP_DELAY * (2 * repeats) + 1);
expectedBeepSchedule(BEEP_DELAY * (2 * repeats));
}
ASSERT_EQ(beeper->getState(), BeepState::Idle);
}
Expand Down

0 comments on commit 7fa5d06

Please sign in to comment.