Hi, I’m a new user to LVGL, I have a project that’s kinda running (I guess). I have created a simple taskbar with a battery timer running every second, updating the battery status and it’s working fine. I wanted to write a deep sleep function that will put the chip into deep sleep after a button hold, but after a lot of debugging, I found out my indev callbacks are not running. The code looks like this:
void ui::setup_indev() {
lv_indev_t *encoder = lv_indev_create();
lv_indev_set_type(encoder, LV_INDEV_TYPE_ENCODER);
lv_indev_set_read_cb(encoder, ui::encoder_read);
lv_indev_set_group(encoder, app.lv_group);
lv_indev_enable(encoder, true); //this line of code is added when I'm trying to solve the issue
lv_indev_t *key = lv_indev_create();
lv_indev_set_type(key, LV_INDEV_TYPE_KEYPAD);
lv_indev_set_read_cb(key, ui::key_read);
lv_indev_set_group(key, app.lv_group);
lv_indev_enable(encoder, true);
// setup deep sleep callback
lv_indev_add_event_cb(key, ui::userkeySleep_cb, LV_EVENT_KEY, NULL);
}
But turns out, the callbacks are never called, here’s how it looks like:
void ui::encoder_read(lv_indev_t *indev, lv_indev_data_t *data) {
Serial.println("reading encoder key");
/* code for reading indev */
}
but I never saw my callback print anything, is there something I’m missing?