Skip to content

Commit

Permalink
Merge branch 'fix/button_multiple_click' into 'master'
Browse files Browse the repository at this point in the history
fix: Modify check for BUTTON_MULTIPLE_CLICK and prevent crash

See merge request ae_group/esp-iot-solution!871
  • Loading branch information
leeebo committed Oct 19, 2023
2 parents 14593b8 + 58f21af commit ecdc384
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion components/button/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## v3.1.1 - 2023-10-18

### bugfix

* Fixed a bug where multiple callbacks feature crashes for BUTTON_MULTIPLE_CLICK

## v3.1.0 - 2023-10-9

### Enhancements:
Expand Down Expand Up @@ -73,4 +79,4 @@
### Enhancements:

* Support custom button
* Add BUTTON_PRESS_REPEAT_DONE event
* Add BUTTON_PRESS_REPEAT_DONE event
2 changes: 1 addition & 1 deletion components/button/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.1.0"
version: "3.1.1"
description: GPIO and ADC button driver
url: https://github.com/espressif/esp-iot-solution/tree/master/components/button
repository: https://github.com/espressif/esp-iot-solution.git
Expand Down
2 changes: 1 addition & 1 deletion components/button/iot_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static void button_handler(button_dev_t *btn)
do {
btn->cb_info[btn->event][i].cb(btn, btn->cb_info[btn->event][i].usr_data);
i++;
if (i > btn->size[btn->event])
if (i >= btn->size[btn->event])
break;
} while (btn->cb_info[btn->event][i].event_data.multiple_clicks.clicks == btn->repeat);
}
Expand Down

0 comments on commit ecdc384

Please sign in to comment.