diff options
| author | Joaquim <joaquim.org@gmail.com> | 2021-01-28 17:13:28 (GMT) |
|---|---|---|
| committer | Joaquim <joaquim.org@gmail.com> | 2021-01-28 17:13:28 (GMT) |
| commit | a456887eff1bc0de6c6a8ecb49a961ffe75661db (patch) | |
| tree | ef283f671a452c767a1bee0a87f1592e698e07ef /src/displayapp/screens/Meter.cpp | |
| parent | efa99da44d52235bfbf40120f9c1faeb42ce36a7 (diff) | |
LVGL v7.10.0
Diffstat (limited to 'src/displayapp/screens/Meter.cpp')
| -rw-r--r-- | src/displayapp/screens/Meter.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index 3c8e703..58a0636 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -3,27 +3,23 @@ #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { - lv_style_copy(&style_lmeter, &lv_style_pretty_color); - style_lmeter.line.width = 2; - style_lmeter.line.color = LV_COLOR_SILVER; - style_lmeter.body.main_color = lv_color_make(255,0,0); - style_lmeter.body.grad_color = lv_color_make(160,0,0); - style_lmeter.body.padding.left = 16; /*Line length*/ - /*Create a line meter */ - lmeter = lv_lmeter_create(lv_scr_act(), nullptr); - lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ - lv_lmeter_set_value(lmeter, value); /*Set the current value*/ - lv_lmeter_set_angle_offset(lmeter, 180); - lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ - lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ - lv_obj_set_size(lmeter, 150, 150); + lmeter = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/ + lv_linemeter_set_value(lmeter, value); /*Set the current value*/ + lv_linemeter_set_angle_offset(lmeter, 180); + lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ + + lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255,0,0)); + lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160,0,0)); + lv_obj_set_style_local_line_width(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_line_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_SILVER); + + lv_obj_set_size(lmeter, 200, 200); lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0); } @@ -35,7 +31,7 @@ Meter::~Meter() { } bool Meter::Refresh() { - lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ + lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ if(value>=60) value = 0; return running; |
