各位大佬,LABEL旋转90度后,更新字符,跑飞,请帮忙看一下,谢谢!
LVGL9.2.2,
初始化:
void APP_MENU_Init( void )
{
lv_obj_t *pxScreen = lv_screen_active( );
lv_obj_add_style( pxScreen, &g_xMenuStyles.xScreen, LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_t *pxDevName = lv_label_create( pxScreen );
lv_obj_align( pxDevName, LV_ALIGN_CENTER, 150, 0 );
lv_obj_set_style_text_font( pxDevName, &lv_font_montserrat_48, 0 );
lv_obj_set_style_text_color( pxDevName, lv_color_hex( 0xFFFFFF ), 0 );
lv_label_set_text( pxDevName, “XXX” );
lv_obj_set_style_transform_rotation(pxDevName,900,LV_PART_MAIN);
lv_obj_set_style_transform_pivot_y(pxDevName, 0, 0);
lv_obj_set_style_transform_pivot_x(pxDevName, 0, 0);
lv_obj_t *pxInputSrc = lv_label_create( pxScreen );
lv_obj_align( pxInputSrc, LV_ALIGN_CENTER, 70, 0 );
lv_obj_set_style_text_font( pxInputSrc, &lv_font_montserrat_24, 0 );
lv_obj_set_style_text_color( pxInputSrc, lv_color_hex( 0xFFFFFF ), 0 );
lv_label_set_text( pxInputSrc, "aaaaa: abcde" );
lv_obj_set_style_transform_rotation(pxInputSrc,900,LV_PART_MAIN);
lv_obj_set_style_transform_pivot_y(pxInputSrc, 0, 0);
lv_obj_set_style_transform_pivot_x(pxInputSrc, 0, 0);
sprintf( cValue, "%d", 100 );
strcat( cVolume, cValue );
strcat( cVolume, "%" );
i = sizeof(cVolume);
for(;i<12;i++)
{
cVolume[i] =' ';
}
cVolume[12] = 0;
lv_obj_t *pxVolume = lv_label_create( pxScreen );
lv_obj_align( pxVolume, LV_ALIGN_CENTER, 30, 0 );
lv_obj_set_style_text_font( pxVolume, &lv_font_montserrat_24, 0 );
lv_obj_set_style_text_color( pxVolume, lv_color_hex( 0xFFFFFF ), 0 );
lv_label_set_text( pxVolume, cVolume );
lv_obj_set_style_transform_rotation(pxVolume,900,LV_PART_MAIN);
lv_obj_set_style_transform_pivot_y(pxVolume, 0, 0);
lv_obj_set_style_transform_pivot_x(pxVolume, 0, 0);
}
显示是正常的。
刷新:
menu_update()
{
bsp_display_lock( 0 );
lv_obj_t *pxVolume = lv_obj_get_child( lv_screen_active( ), 2 );
char cVolume[ 50 ] = "Volume: ";
char cValue[ 10 ] = { 0 };
sprintf( cValue, “%d”, *pData );
strcat( cVolume, cValue );
strcat( cVolume, “%” );
i = sizeof(cVolume);
for(;i<12;i++)
{
cVolume[i] =’ ';
}
cVolume[12] = 0;
lv_label_set_text( pxVolume, cVolume );
bsp_display_unlock( );
}
刷新几次,就跑飞了。如果不旋转90度,可以正常工作的。
跑飞的地方定位到了:managed_components/lvgl__lvgl/src/draw/sw/lv_draw_sw_img.c:322 (discriminator 1)