Skip to content

Commit

Permalink
Fix unintentional button press on boot (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
TillFleisch authored Jan 27, 2024
1 parent fb8dd71 commit 30ef3e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/philips_action_button/action_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace esphome
void ActionButton::loop()
{
// Repeated message sending for long presses
if (millis() - press_start_ <= LONG_PRESS_DURATION)
if (should_long_press_ && millis() - press_start_ <= LONG_PRESS_DURATION)
{
if (millis() - last_message_sent_ > LONG_PRESS_REPETITION_DELAY)
{
Expand Down
2 changes: 1 addition & 1 deletion components/philips_action_button/action_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace esphome
/// @brief true if the component is currently performing a long press
bool is_long_pressing_ = false;
/// @brief time at which the button press was started
long press_start_ = 0;
long press_start_ = -(LONG_PRESS_DURATION + 1);
/// @brief time at which the last message was sent
long last_message_sent_ = 0;
};
Expand Down

0 comments on commit 30ef3e5

Please sign in to comment.