amobbs.com 阿莫电子技术论坛

标题: 请教: 大神帮忙看看 LVGL 8.0 表盘设置动态刷新导致重启 [打印本页]

作者: 磊磊映画    时间: 2022-6-6 07:34
标题: 请教: 大神帮忙看看 LVGL 8.0 表盘设置动态刷新导致重启
平台:esp32  platformio 加插件方式开发arduino    esp32 导入了LVGL 8.0
         
arduino 这里使用C++ 开发的 搞起来非常不方便,很多函数不知道如何调用。


现在打算用LVGL 做个车速表盘,用lv_meter 的demo 跑起来,但是demo只初始化一次就用动画方式无线刷新表盘了。

实际用起来需要函数调用周期性刷新的 所以 将 动态刷新部分抽象出了一个函数供外部调用,就是这个接口 TemplateView::Screen_update(int speed)

这个接口放到TemplateView 文件中 初始化部分调用 是能够正常显示的,说明函数功能正常的。


但是把这个接口放到  

  1. /*2022-6-5 19:07:31
  2. **共外部调用
  3. **
  4. */
  5. void TemplateView::Screen_update(int speed)
  6. {

  7.    
  8.     static int pre_value =0;
  9.         TemplateView* instance = (TemplateView*)timer->user_data;
  10.    
  11.     Serial.println(speed);
  12.     /*2022年6月5日 20:15:34  
  13.     **全注释掉这里就不重启了
  14.     **
  15.     */
  16.     #if    0
  17.     if(speed>1)
  18.     {
  19.         lv_anim_init(&a);
  20.         lv_anim_set_exec_cb(&a,set_value);
  21.         lv_anim_set_var(&a, indic);
  22.         lv_anim_set_values(&a, pre_value, speed);
  23.         Serial.println(pre_value);
  24.       
  25.         lv_anim_set_time(&a, 100);
  26.         lv_anim_set_path_cb(&a, &lv_anim_path_overshoot); /* 设置路径(曲线) */
  27.         lv_anim_start(&a);
  28.         pre_value = speed;
  29.     }
  30.    
  31.     #endif
  32.        
  33.         
  34. }
复制代码






外部文件 Template  调用时 不注释 lv_meter 相关代码(#if 0注释部分)就会重启, 注释掉lv_meter 就不会重启,说明lv_meter 相关代码导致的重启。

请大神帮忙定位原因,是不是lv_meter 不能放到别的文件里去调用? 为什么一执行就重启?  主要还是想通过外部的速度去刷新表盘指针。




崩溃时捕获的日志:
  1. meter

  2. 50
  3. Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.

  4. Core  0 register dump:
  5. PC      : 0x40152bc8  PS      : 0x00060a30  A0      : 0x800e7724  A1      : 0x3fff4200
  6. A2      : 0x00000000  A3      : 0x00000044  A4      : 0x0000000a  A5      : 0x00000000
  7. A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x00000020
  8. A10     : 0x00000002  A11     : 0x3f4594dc  A12     : 0xcc88035f  A13     : 0x3ffc611c
  9. A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000000a  EXCCAUSE: 0x0000001d  
  10. EXCVADDR: 0x00000000  LBEG    : 0x400917ad  LEND    : 0x400917bd  LCOUNT  : 0xffffffff


  11. Backtrace:0x40152bc5:0x3fff42000x400e7721:0x3fff4220 0x400d477c:0x3fff4240 0x400d44db:0x3fff4260 0x400e9d5a:0x3fff4280 0x400d8204:0x3fff42b0
复制代码






外部调用:

  1. void Template::onTimerUpdate(lv_timer_t* timer)
  2. {
  3.         Template* instance = (Template*)timer->user_data;
  4.     TemplateView* screen;

  5.     static int   i =0;

  6.     ///Serial.println("update\r\n");
  7.     if(0==i%2)
  8.     {
  9.          instance->Update();
  10.          Serial.println("num\r\n");
  11.     }
  12.     if(1==i%2)
  13.     {
  14.         
  15.              Serial.println("meter\r\n");
  16.          screen->Screen_update(50);
  17.      
  18.     }
  19.     i++;
  20.    
  21. }

复制代码




[attach]587962[/attach]


















  1. #include "TemplateView.h"
  2. #include "App/Configs/Version.h"
  3. #include "lvgl.h"
  4. ///#include "src/widgets/lv_gauge.h"



  5. using namespace Page;




  6. static lv_obj_t * meter;

  7. static void set_value(void * indic, int32_t v)
  8. {
  9.     lv_meter_set_indicator_end_value(meter, (lv_meter_indicator_t *)indic, v);
  10. }


  11. /*2022-6-5 19:07:31  zhanglei
  12. **共外部调用
  13. **
  14. */
  15. void TemplateView::Screen_update(int speed)
  16. {

  17.    
  18.     static int pre_value =0;
  19.         TemplateView* instance = (TemplateView*)timer->user_data;
  20.    
  21.     Serial.println(speed);
  22.     /*2022年6月5日 20:15:34  zhanglei
  23.     **全注释掉这里就不重启了
  24.     **
  25.     */
  26.     #if    0
  27.     if(speed>1)
  28.     {
  29.         lv_anim_init(&a);
  30.         lv_anim_set_exec_cb(&a,set_value);
  31.         lv_anim_set_var(&a, indic);
  32.         lv_anim_set_values(&a, pre_value, speed);
  33.         Serial.println(pre_value);
  34.       
  35.         lv_anim_set_time(&a, 100);
  36.         lv_anim_set_path_cb(&a, &lv_anim_path_overshoot); /* 设置路径(曲线) */
  37.         lv_anim_start(&a);
  38.         pre_value = speed;
  39.     }
  40.    
  41.     #endif
  42.        
  43.         
  44. }

  45. /*2022-6-5 19:07:31  zhanglei
  46. **共外部调用
  47. **
  48. */
  49. void TemplateView::Screen_update2(lv_timer_t* timer)
  50. {

  51.    
  52.     static int pre_value =0;
  53.         TemplateView* instance = (TemplateView*)timer->user_data;
  54.    
  55.     //Serial.println(speed);
  56.     /*2022年6月5日 20:15:34  zhanglei
  57.     **全注释掉这里就不重启了
  58.     **
  59.     */
  60.     #if    0
  61.     if(speed>1)
  62.     {
  63.         lv_anim_init(&a);
  64.         lv_anim_set_exec_cb(&a,set_value);
  65.         lv_anim_set_var(&a, indic);
  66.         lv_anim_set_values(&a, pre_value, speed);
  67.         Serial.println(pre_value);
  68.       
  69.         lv_anim_set_time(&a, 100);
  70.         lv_anim_set_path_cb(&a, &lv_anim_path_overshoot); /* 设置路径(曲线) */
  71.         lv_anim_start(&a);
  72.         pre_value = speed;
  73.     }
  74.    
  75.     #endif
  76.        
  77.         
  78. }


  79. /*2022-6-4 15:08:58  
  80. ** 速度界面控件
  81. **
  82. */
  83. void TemplateView::TopInfo_Create(lv_obj_t* par)
  84. {   
  85.     #if  1
  86.    
  87.     lv_obj_t* cont = lv_obj_create(par);
  88.     lv_obj_remove_style_all(cont);
  89.     lv_obj_set_size(cont, LV_HOR_RES, 142);
  90.     #if    1
  91.     /*2022-6-4 21:44:03  zhanglei
  92.     **方便两层叠加 改成透明处理
  93.     **
  94.     */
  95.     lv_obj_set_style_bg_opa(cont, LV_OPA_TRANSP   , 0);//改成半透明
  96.     lv_obj_set_style_bg_color(cont, lv_color_hex(0x333333), 0);

  97.     lv_obj_set_style_radius(cont, 27, 0);
  98.     lv_obj_set_y(cont, -36);
  99.     ui.topInfo.cont = cont;

  100.     lv_obj_t* label = lv_label_create(cont);
  101.     lv_obj_set_style_text_font(label, Resource.GetFont("bahnschrift_65"), 0);
  102.     lv_obj_set_style_text_color(label, lv_color_white(), 0);
  103.     lv_label_set_text(label, "00");
  104.     lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 83);
  105.     ui.topInfo.labelSpeed = label;
  106.     #endif
  107.     #if    0
  108.     label = lv_label_create(cont);
  109.     lv_obj_set_style_text_font(label, Resource.GetFont("bahnschrift_17"), 0);
  110.     lv_obj_set_style_text_color(label, lv_color_white(), 0);
  111.     lv_label_set_text(label, "km/h");
  112.     lv_obj_align_to(label, ui.topInfo.labelSpeed, LV_ALIGN_OUT_BOTTOM_MID, 0, 8);
  113.     ui.topInfo.labelUint = label;
  114.     #endif
  115.     #endif

  116.     #define  STANDARD

  117.     #ifdef  STANDARD
  118.     meter = lv_meter_create(lv_scr_act());
  119.     lv_obj_center(meter);
  120.     lv_obj_set_size(meter, 200, 200);

  121.     /*Add a scale first*/
  122.     lv_meter_scale_t * scale = lv_meter_add_scale(meter);
  123.     lv_meter_set_scale_ticks(meter, scale, 41, 2, 10, lv_palette_main(LV_PALETTE_GREY));
  124.     lv_meter_set_scale_major_ticks(meter, scale, 8, 4, 15, lv_color_black(), 10);

  125.    

  126.     /*Add a blue arc to the start*/
  127.     indic = lv_meter_add_arc(meter, scale, 5, lv_palette_main(LV_PALETTE_BLUE), 0);
  128.     lv_meter_set_indicator_start_value(meter, indic, 0);
  129.     lv_meter_set_indicator_end_value(meter, indic, 20);

  130.     /*Make the tick lines blue at the start of the scale*/
  131.     indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_BLUE),
  132.                                      false, 0);
  133.     lv_meter_set_indicator_start_value(meter, indic, 0);
  134.     lv_meter_set_indicator_end_value(meter, indic, 70);

  135.     /*Add a red arc to the end*/
  136.     indic = lv_meter_add_arc(meter, scale, 5, lv_palette_main(LV_PALETTE_RED), 0);
  137.     lv_meter_set_indicator_start_value(meter, indic, 70);
  138.     lv_meter_set_indicator_end_value(meter, indic, 100);

  139.     /*Make the tick lines red at the end of the scale*/
  140.     indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_RED), lv_palette_main(LV_PALETTE_RED), false,
  141.                                      0);
  142.     lv_meter_set_indicator_start_value(meter, indic, 70);
  143.     lv_meter_set_indicator_end_value(meter, indic, 100);

  144.     /*Add a needle line indicator*/
  145.     indic = lv_meter_add_needle_line(meter, scale, 4, lv_palette_main(LV_PALETTE_ORANGE), -10);
  146.     #endif


  147.     #if  0
  148.     /*Create an animation to set the value*/
  149.     lv_anim_init(&a);
  150.     lv_anim_set_exec_cb(&a,set_value);
  151.     lv_anim_set_var(&a, indic);
  152.     lv_anim_set_values(&a, 0, 40);
  153.     lv_anim_set_time(&a, 2000);
  154.     lv_anim_set_path_cb(&a, &lv_anim_path_overshoot); /* 设置路径(曲线) */
  155.     lv_anim_start(&a);
  156.    

  157.     //Screen_update(100);
  158.    

  159.     #else
  160.     lv_anim_t a;
  161.     lv_anim_init(&a);
  162.     lv_anim_set_exec_cb(&a, set_value);
  163.     lv_anim_set_var(&a, indic);
  164.     lv_anim_set_values(&a, 0, 100);
  165.     lv_anim_set_time(&a, 2000);
  166.     lv_anim_set_repeat_delay(&a, 100);
  167.     lv_anim_set_playback_time(&a, 500);
  168.     lv_anim_set_playback_delay(&a, 100);
  169.     lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
  170.     lv_anim_start(&a);
  171.    
  172.     #endif

  173.     #ifdef    MIDDLE_LEVEL
  174.      meter = lv_meter_create(lv_scr_act());
  175.     lv_obj_center(meter);
  176.     lv_obj_set_size(meter, 200, 200);

  177.     /*Remove the circle from the middle*/
  178.     lv_obj_remove_style(meter, NULL, LV_PART_INDICATOR);

  179.     /*Add a scale first*/
  180.     lv_meter_scale_t * scale = lv_meter_add_scale(meter);
  181.     lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, lv_palette_main(LV_PALETTE_GREY));
  182.     lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 15);
  183.     lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90);

  184.     /*Add a three arc indicator*/
  185.     lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_RED), 0);
  186.     lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_GREEN), -10);
  187.     lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_BLUE), -20);

  188.     /*Create an animation to set the value*/
  189.     lv_anim_t a;
  190.     lv_anim_init(&a);
  191.     lv_anim_set_exec_cb(&a, set_value);
  192.     lv_anim_set_values(&a, 0, 100);
  193.     lv_anim_set_repeat_delay(&a, 100);
  194.     lv_anim_set_playback_delay(&a, 100);
  195.     lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);

  196.     lv_anim_set_time(&a, 2000);
  197.     lv_anim_set_playback_time(&a, 500);
  198.     lv_anim_set_var(&a, indic1);
  199.     lv_anim_start(&a);

  200.     lv_anim_set_time(&a, 1000);
  201.     lv_anim_set_playback_time(&a, 1000);
  202.     lv_anim_set_var(&a, indic2);
  203.     lv_anim_start(&a);

  204.     lv_anim_set_time(&a, 1000);
  205.     lv_anim_set_playback_time(&a, 2000);
  206.     lv_anim_set_var(&a, indic3);
  207.     lv_anim_start(&a);
  208.     #endif
  209.   

  210. }

  211. void TemplateView::BottomInfo_Create(lv_obj_t* par)
  212. {
  213.     lv_obj_t* cont = lv_obj_create(par);
  214.     lv_obj_remove_style_all(cont);
  215.     lv_obj_set_style_bg_color(cont, lv_color_black(), 0);
  216.     lv_obj_set_size(cont, LV_HOR_RES, 90);
  217.     lv_obj_align(cont, LV_ALIGN_TOP_MID, 0, 106);

  218.     lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);

  219.     lv_obj_set_flex_align(
  220.         cont,
  221.         LV_FLEX_ALIGN_SPACE_EVENLY,
  222.         LV_FLEX_ALIGN_CENTER,
  223.         LV_FLEX_ALIGN_CENTER
  224.     );

  225.     ui.bottomInfo.cont = cont;

  226.     const char* unitText[4] =
  227.     {
  228.         "AVG",
  229.         "Time",
  230.         "Trip",
  231.         "Calorie"
  232.     };

  233.     for (int i = 0; i < ARRAY_SIZE(ui.bottomInfo.labelInfoGrp); i++)
  234.     {
  235.         SubInfoGrp_Create(
  236.             cont,
  237.             &(ui.bottomInfo.labelInfoGrp[i]),
  238.             unitText[i]
  239.         );
  240.     }
  241. }

  242. void TemplateView::SubInfoGrp_Create(lv_obj_t* par, SubInfo_t* info, const char* unitText)
  243. {
  244.     lv_obj_t* cont = lv_obj_create(par);
  245.     lv_obj_remove_style_all(cont);
  246.     lv_obj_set_size(cont, 93, 39);

  247.     lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
  248.     lv_obj_set_flex_align(
  249.         cont,
  250.         LV_FLEX_ALIGN_SPACE_AROUND,
  251.         LV_FLEX_ALIGN_CENTER,
  252.         LV_FLEX_ALIGN_CENTER
  253.     );

  254.     lv_obj_t* label = lv_label_create(cont);
  255.     lv_obj_set_style_text_font(label, Resource.GetFont("bahnschrift_17"), 0);
  256.     lv_obj_set_style_text_color(label, lv_color_white(), 0);
  257.     info->lableValue = label;

  258.     label = lv_label_create(cont);
  259.     lv_obj_set_style_text_font(label, Resource.GetFont("bahnschrift_13"), 0);
  260.     lv_obj_set_style_text_color(label, lv_color_hex(0xb3b3b3), 0);
  261.     lv_label_set_text(label, unitText);
  262.     info->lableUnit = label;

  263.     info->cont = cont;
  264. }

  265. void TemplateView::BtnCont_Create(lv_obj_t* par)
  266. {
  267.     lv_obj_t* cont = lv_obj_create(par);
  268.     lv_obj_remove_style_all(cont);
  269.     lv_obj_set_size(cont, LV_HOR_RES, 40);
  270.     lv_obj_align_to(cont, ui.bottomInfo.cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);

  271.     /*lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);
  272.     lv_obj_set_flex_place(
  273.         cont,
  274.         LV_FLEX_PLACE_SPACE_AROUND,
  275.         LV_FLEX_PLACE_CENTER,
  276.         LV_FLEX_PLACE_CENTER
  277.     );*/

  278.     ui.btnCont.cont = cont;

  279.     ui.btnCont.btnMap = Btn_Create(cont, Resource.GetImage("locate"), -80);
  280.     ui.btnCont.btnRec = Btn_Create(cont, Resource.GetImage("start"), 0);
  281.     ui.btnCont.btnMenu = Btn_Create(cont, Resource.GetImage("menu"), 80);
  282. }

  283. lv_obj_t* TemplateView::Btn_Create(lv_obj_t* par, const void* img_src, lv_coord_t x_ofs)
  284. {
  285.     lv_obj_t* obj = lv_obj_create(par);
  286.     lv_obj_remove_style_all(obj);
  287.     lv_obj_set_size(obj, 40, 31);
  288.     lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);

  289.     lv_obj_align(obj, LV_ALIGN_CENTER, x_ofs, 0);
  290.     lv_obj_set_style_bg_img_src(obj, img_src, 0);

  291.     lv_obj_set_style_bg_opa(obj, LV_OPA_COVER, 0);
  292.     lv_obj_set_style_width(obj, 45, LV_STATE_PRESSED);
  293.     lv_obj_set_style_height(obj, 25, LV_STATE_PRESSED);
  294.     lv_obj_set_style_bg_color(obj, lv_color_hex(0x666666), 0);
  295.     lv_obj_set_style_bg_color(obj, lv_color_hex(0xbbbbbb), LV_STATE_PRESSED);
  296.     lv_obj_set_style_bg_color(obj, lv_color_hex(0xff931e), LV_STATE_FOCUSED);
  297.     lv_obj_set_style_radius(obj, 9, 0);

  298.     static lv_style_transition_dsc_t tran;
  299.     static const lv_style_prop_t prop[] = { LV_STYLE_WIDTH, LV_STYLE_HEIGHT, LV_STYLE_PROP_INV};
  300.     lv_style_transition_dsc_init(
  301.         &tran,
  302.         prop,
  303.         lv_anim_path_ease_out,
  304.         200,
  305.         0,
  306.         nullptr
  307.     );
  308.     lv_obj_set_style_transition(obj, &tran, LV_STATE_PRESSED);
  309.     lv_obj_set_style_transition(obj, &tran, LV_STATE_FOCUSED);

  310.     lv_obj_update_layout(obj);

  311.     return obj;
  312. }

  313. void TemplateView::AppearAnimStart(bool reverse)
  314. {
  315.     lv_anim_timeline_set_reverse(ui.anim_timeline, reverse);
  316.     lv_anim_timeline_start(ui.anim_timeline);
  317. }
  318. void TemplateView::onViewWillAppear()
  319. {

  320.      /// timer = lv_timer_create((lv_timer_cb_t)Screen_update2(), 500, this);

  321.    

  322. }

  323. void TemplateView::Create(lv_obj_t* root)
  324. {
  325.         #if       1
  326.         lv_obj_t* label = lv_label_create(root);
  327.         lv_obj_set_style_text_font(label, &lv_font_montserrat_14, 0);
  328.         lv_obj_set_style_text_color(label, lv_color_white(), 0);
  329.         lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 30);
  330.         lv_label_set_text(label, "");
  331.         ui.labelTitle = label;

  332.         label = lv_label_create(root);
  333.         lv_obj_set_style_text_font(label, &lv_font_montserrat_10, 0);
  334.         lv_obj_set_style_text_color(label, lv_color_white(), 0);
  335.         lv_label_set_text(label, "");
  336.         lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 50);
  337.         ui.labelTick = label;

  338.         lv_obj_t* img = lv_img_create(root);
  339.         ///lv_img_set_src(img, Resource.GetImage("arm"));
  340.         ///lv_obj_center(img);
  341.         BottomInfo_Create(root);
  342.     TopInfo_Create(root);
  343.     BtnCont_Create(root);

  344.         ui.canvas = img;

  345.         ui.group = lv_group_create();
  346.         lv_indev_set_group(lv_get_indev(LV_INDEV_TYPE_ENCODER), ui.group);

  347.         lv_group_add_obj(ui.group, ui.canvas);
  348.         lv_group_add_obj(ui.group, ui.labelTitle);
  349.         lv_group_focus_obj(ui.canvas);


  350.    
  351.     /*
  352.     **2022-6-4 10:09:09 zhanglei
  353.     **add
  354.     */
  355.     #if  1
  356.      ui.anim_timeline = lv_anim_timeline_create();

  357. #define ANIM_DEF(start_time, obj, attr, start, end) \
  358.     {start_time, obj, LV_ANIM_EXEC(attr), start, end, 500, lv_anim_path_ease_out, true}

  359. #define ANIM_OPA_DEF(start_time, obj) \
  360.     ANIM_DEF(start_time, obj, opa_scale, LV_OPA_TRANSP, LV_OPA_COVER)

  361.     lv_coord_t y_tar_top = lv_obj_get_y(ui.topInfo.cont);
  362.     lv_coord_t y_tar_bottom = lv_obj_get_y(ui.bottomInfo.cont);
  363.     lv_coord_t h_tar_btn = lv_obj_get_height(ui.btnCont.btnRec);

  364.     lv_anim_timeline_wrapper_t wrapper[] =
  365.     {
  366.         ANIM_DEF(0, ui.topInfo.cont, y, -lv_obj_get_height(ui.topInfo.cont), y_tar_top),

  367.         ANIM_DEF(200, ui.bottomInfo.cont, y, -lv_obj_get_height(ui.bottomInfo.cont), y_tar_bottom),
  368.         ANIM_OPA_DEF(200, ui.bottomInfo.cont),

  369.         ANIM_DEF(500, ui.btnCont.btnMap, height, 0, h_tar_btn),
  370.         ANIM_DEF(600, ui.btnCont.btnRec, height, 0, h_tar_btn),
  371.         ANIM_DEF(700, ui.btnCont.btnMenu, height, 0, h_tar_btn),
  372.         LV_ANIM_TIMELINE_WRAPPER_END
  373.     };
  374.     lv_anim_timeline_add_wrapper(ui.anim_timeline, wrapper);



  375.    
  376.      
  377.    
  378.     #endif

  379.         Serial.println("templateview init");

  380.    
  381.   



  382.     #else

  383.     lv_obj_remove_style_all(root);
  384.     lv_obj_set_size(root, LV_HOR_RES, LV_VER_RES);

  385.     BottomInfo_Create(root);
  386.     TopInfo_Create(root);
  387.     BtnCont_Create(root);

  388.     ui.anim_timeline = lv_anim_timeline_create();

  389. #define ANIM_DEF(start_time, obj, attr, start, end) \
  390.     {start_time, obj, LV_ANIM_EXEC(attr), start, end, 500, lv_anim_path_ease_out, true}

  391. #define ANIM_OPA_DEF(start_time, obj) \
  392.     ANIM_DEF(start_time, obj, opa_scale, LV_OPA_TRANSP, LV_OPA_COVER)

  393.     lv_coord_t y_tar_top = lv_obj_get_y(ui.topInfo.cont);
  394.     lv_coord_t y_tar_bottom = lv_obj_get_y(ui.bottomInfo.cont);
  395.     lv_coord_t h_tar_btn = lv_obj_get_height(ui.btnCont.btnRec);

  396.     lv_anim_timeline_wrapper_t wrapper[] =
  397.     {
  398.         ANIM_DEF(0, ui.topInfo.cont, y, -lv_obj_get_height(ui.topInfo.cont), y_tar_top),

  399.         ANIM_DEF(200, ui.bottomInfo.cont, y, -lv_obj_get_height(ui.bottomInfo.cont), y_tar_bottom),
  400.         ANIM_OPA_DEF(200, ui.bottomInfo.cont),

  401.         ANIM_DEF(500, ui.btnCont.btnMap, height, 0, h_tar_btn),
  402.         ANIM_DEF(600, ui.btnCont.btnRec, height, 0, h_tar_btn),
  403.         ANIM_DEF(700, ui.btnCont.btnMenu, height, 0, h_tar_btn),
  404.         LV_ANIM_TIMELINE_WRAPPER_END
  405.     };
  406.     lv_anim_timeline_add_wrapper(ui.anim_timeline, wrapper);


  407.         #endif
  408. }
复制代码

作者: 磊磊映画    时间: 2022-6-6 07:47
完整工程传到百度网盘了  链接:https://pan.baidu.com/s/1Lq_h9PJn18XtXFMJoD8-Dw  提取码:3z7f
作者: 磊磊映画    时间: 2022-6-6 16:40
顶一下  有没有
作者: 嵌入之梦2    时间: 2023-2-5 21:03
请问楼主问题解决了吗?最近我使用ESP 32 移植lvgl gui刷屏一段时间后会死机,不知道问题出在哪?




欢迎光临 amobbs.com 阿莫电子技术论坛 (https://www.amobbs.com/) Powered by Discuz! X3.4