Signal function handles group related signals when LV_USE_GROUP is disabled

Description

In my project, the size of the ROM is relatively small (only 128k).
So I turned off all unnecessary components, including LV_USE_GROUP.
Then I found that LV_SIGNAL_CONTROL and LV_SIGNAL_GET_EDITABLE are still handled in signal_cb of many controls.

What MCU/Processor/Board and compiler are you using?

Cortex-M3 with 128k rom, 64k ram

What do you experience?

If these codes are not blocked, it will increase unnecessary size

What do you expect?

LV_USE_GROUP can turn off all GROUP-related singles, or provide a new macro to do this

Code to reproduce

static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_signal(btn, sign, param);
    if(res != LV_RES_OK) return res;
    if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);

    bool tgl           = lv_btn_get_checkable(btn);

    if(sign == LV_SIGNAL_RELEASED) {
        /*If not dragged and it was not long press action then
         *change state and run the action*/
        if(lv_indev_is_dragging(param) == false && tgl) {
            uint32_t toggled = 0;
            if(lv_obj_get_state(btn, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
                lv_btn_set_state(btn, LV_BTN_STATE_RELEASED);
                toggled = 0;
            }
            else {
                lv_btn_set_state(btn, LV_BTN_STATE_CHECKED_RELEASED);
                toggled = 1;
            }

            res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &toggled);
            if(res != LV_RES_OK) return res;
        }
    }
    else if(sign == LV_SIGNAL_CONTROL) {
        char c = *((char *)param);
        if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
            if(lv_btn_get_checkable(btn)) {
                lv_btn_set_state(btn, LV_BTN_STATE_CHECKED_RELEASED);

                uint32_t state = 1;
                res            = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
                if(res != LV_RES_OK) return res;
            }

        }
        else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
            if(lv_btn_get_checkable(btn)) {
                lv_btn_set_state(btn, LV_BTN_STATE_RELEASED);

                uint32_t state = 0;
                res            = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
                if(res != LV_RES_OK) return res;
            }
        }
    }

    return res;
}

Screenshot and/or video

NULL

Hi,

Good point!

Can you send a Pull request with these updates?

OK, I will submit a Pull request later, when LV_USE_GROUP is closed, mask all signals related to GROUP.

In addition, how about this problem in the V6 version (we are using the V6 version, because the size can be smaller)

Pull request has been merged: https://github.com/lvgl/lvgl/pull/1619

1 Like

Thank you!