Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOT button uses too much power (CON-1486) #1218

Open
AlexVaq opened this issue Dec 20, 2024 · 2 comments
Open

IOT button uses too much power (CON-1486) #1218

AlexVaq opened this issue Dec 20, 2024 · 2 comments

Comments

@AlexVaq
Copy link

AlexVaq commented Dec 20, 2024

I'm trying to design a low-power, sleepy thread device for homekit, based on the icd_app example of esp-matter.I'm currently working with a devboard esp32c6 devkitM-1.

I noticed that if I initialize the button (which is quite useful to unpair from the thread network, reboot, etc), the minimum consumption I measure is around 3-4 mA, whereas if I don't, the consumption goes back down to the microA level.
I don't think this is intended. Maybe this is a specific problem of the development board, but I'm inclined to think that the code related to the iot button is not as efficient as it should.

Apart from the esp32c6 devkitM-1 board I'm using esp-idf 5.4 and I'm installing esp-matter directly from vscode.

The code I use to initialize the button is the following:

app_driver_handle_t AppDriverButtonInit()
{
    /* Initialize button */

    button_config_t config = button_driver_get_config();
    button_handle_t handle = iot_button_create(&config);

    iot_button_register_cb(handle, BUTTON_PRESS_DOWN,        AppDriverButtonToggleCb,           NULL);
    iot_button_register_cb(handle, BUTTON_LONG_PRESS_HOLD,   AppDriverButtonLongPressCb,        NULL);
    iot_button_register_cb(handle, BUTTON_PRESS_UP,          AppDriverButtonLongPressReleaseCb, NULL);
    iot_button_register_cb(handle, BUTTON_DOUBLE_CLICK,      AppDriverButtonDoubleClickCb,      NULL);
    iot_button_register_cb(handle, BUTTON_PRESS_REPEAT,      AppDriverButtonRepeatCb,           NULL);
    iot_button_register_cb(handle, BUTTON_PRESS_REPEAT_DONE, AppDriverButtonRepeatDoneCb,       NULL);

    return (app_driver_handle_t)handle;
}

but the consumption is the same even if I just call iot_button_create without registering any callbacks. The only workaround I found is to ignore the button functionality.

@github-actions github-actions bot changed the title IOT button uses too much power IOT button uses too much power (CON-1486) Dec 20, 2024
@wqx6
Copy link
Contributor

wqx6 commented Dec 23, 2024

It seems that the iot_button component prevents the device from entering sleep mode, resulting in a current of approximately 3-4 mA. We will add a button for the ICD example in a later update so that you can use that button for your application.
Before that you can refer to the button class in the upstream repo https://github.com/project-chip/connectedhomeip/blob/master/examples/lit-icd-app/esp32/main/include/IcdUatButton.h and use it for your device.

@AlexVaq
Copy link
Author

AlexVaq commented Dec 23, 2024

That makes a lot of sense, thank you so much.
I think I should keep the issue opened until the button is added to the ICD example in the esp-matter repo.
I'll keep an eye on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants