From 80af98a157de1a0600106ae6af1ba9d26ff7010e Mon Sep 17 00:00:00 2001 From: Johann Chang Date: Fri, 8 Aug 2025 13:05:45 +0800 Subject: [PATCH] refactor: simplify the callback handling of multi-click --- components/button/iot_button.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/components/button/iot_button.c b/components/button/iot_button.c index 42acd8883..9175d3db3 100644 --- a/components/button/iot_button.c +++ b/components/button/iot_button.c @@ -191,13 +191,7 @@ static void button_handler(button_dev_t *btn) /** Calling the callbacks for MULTIPLE BUTTON CLICKS */ for (int i = 0; i < btn->size[btn->event]; i++) { if (btn->repeat == btn->cb_info[btn->event][i].event_args.multiple_clicks.clicks) { - do { - btn->cb_info[btn->event][i].cb(btn, btn->cb_info[btn->event][i].usr_data); - i++; - if (i >= btn->size[btn->event]) { - break; - } - } while (btn->cb_info[btn->event][i].event_args.multiple_clicks.clicks == btn->repeat); + btn->cb_info[btn->event][i].cb(btn, btn->cb_info[btn->event][i].usr_data); } }