X-AIOS-LT00-V1.0.4/sdk/X-AIOS-LT00/core/apps/launcher/backup.txt
2026-01-19 17:23:53 +08:00

115 lines
4.4 KiB
Plaintext

#if 0
static void _launcher_tileview_event_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *obj = lv_event_get_target(e);
lv_obj_t *tile = lv_tileview_get_tile_act(obj);
lv_obj_t * tv = obj;
if (LV_EVENT_KEY == code)
{
// lv_res_t res;
uint16_t i;
char c = *((char *)lv_event_get_param(e));
uint16_t child_cnt = lv_obj_get_child_cnt(obj);
LV_LOG_USER("%d %d %d %d", __LINE__, code, c, child_cnt);
if (c == LV_KEY_LEFT)
{
for (i = 0; i < child_cnt; i++)
{
lv_obj_t *tile_obj = lv_obj_get_child(obj, i);
if (tile_obj == tile)
{
uint16_t tile_id = (i == 0) ? child_cnt - 1 : (i - 1);
lv_coord_t x = lv_obj_get_x(tile_obj);
lv_coord_t y = lv_obj_get_y(tile_obj);
uint8_t col_id = x / lv_obj_get_content_width(tv);
uint8_t row_id = y / lv_obj_get_content_height(tv);
LV_LOG_USER("%d %d %d (%d %d)", __LINE__, code, tile_id, col_id, row_id);
lv_obj_set_tile_id(obj, col_id-1, row_id, LV_ANIM_ON);
uint8_t led_id = (col_id - 1 >= 0)? (col_id - 1) : 0;
return;
}
}
}
else if (c == LV_KEY_RIGHT)
{
for (i = 0; i < child_cnt; i++)
{
lv_obj_t *tile_obj = lv_obj_get_child(obj, i);
if (tile_obj == tile)
{
uint16_t tile_id = ((i + 1) >= child_cnt) ? 0 : (i + 1);
lv_coord_t x = lv_obj_get_x(tile_obj);
lv_coord_t y = lv_obj_get_y(tile_obj);
uint8_t col_id = x / lv_obj_get_content_width(tv);
uint8_t row_id = y / lv_obj_get_content_height(tv);
LV_LOG_USER("%d %d %d (%d %d)", __LINE__, code, tile_id, col_id, row_id);
lv_obj_set_tile_id(obj, col_id+1, row_id, LV_ANIM_ON);
uint8_t led_id = (col_id + 1 <= 5)? (col_id + 1) : 5;
//lv_led_on(led_table[led_id]);
return;
}
}
}
if (c == LV_KEY_UP)
{
for (i = 0; i < child_cnt; i++)
{
lv_obj_t *tile_obj = lv_obj_get_child(obj, i);
if (tile_obj == tile)
{
lv_coord_t x = lv_obj_get_x(tile_obj);
lv_coord_t y = lv_obj_get_y(tile_obj);
uint8_t col_id = x / lv_obj_get_content_width(tv);
uint8_t row_id = y / lv_obj_get_content_height(tv);
LV_LOG_USER("%d %d %d (%d %d)", __LINE__, code, i, col_id, row_id);
lv_obj_set_tile_id(obj, col_id, row_id-1, LV_ANIM_ON);
uint8_t led_id = (row_id - 1 >= 0)? (row_id - 1) : 0;
//lv_led_on(led_table[led_id]);
return;
}
}
}
else if (c == LV_KEY_DOWN)
{
for (i = 0; i < child_cnt; i++)
{
lv_obj_t *tile_obj = lv_obj_get_child(obj, i);
if (tile_obj == tile)
{
lv_coord_t x = lv_obj_get_x(tile_obj);
lv_coord_t y = lv_obj_get_y(tile_obj);
uint8_t col_id = x / lv_obj_get_content_width(tv);
uint8_t row_id = y / lv_obj_get_content_height(tv);
LV_LOG_USER("%d %d %d (%d %d)", __LINE__, code, i, col_id, row_id);
lv_obj_set_tile_id(obj, col_id, row_id+1, LV_ANIM_ON);
uint8_t led_id = (row_id + 1 <= 5)? (row_id + 1) : 5;
//lv_led_on(led_table[led_id]);
return;
}
}
}
else if (LV_KEY_ENTER == c)
{
for (i = 0; i < child_cnt; i++)
{
lv_obj_t *tile_obj = lv_obj_get_child(obj, i);
if (tile_obj == tile && (i == 4 || i == 5))
{
lv_obj_t *panel = lv_obj_get_child(tile, 0);
lv_group_add_obj(g_indev_group, panel);
lv_group_focus_obj(panel);
lv_event_send(panel, LV_EVENT_KEY, &c);
return;
}
}
}
}
}
#endif