diff options
| author | JF <jf@codingfield.com> | 2021-05-21 09:38:38 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-05-21 09:38:38 (GMT) |
| commit | de69905c0647997091d9e385538c96de30be93e6 (patch) | |
| tree | 4775001d808da520c93a7552da1bea80e7714a30 /src/displayapp/screens/Meter.cpp | |
| parent | a80e782f267cd2424d22da23d809c0c6a8ff8761 (diff) | |
| parent | 7c9513be8a3bf36fda5706cb0fb1bd6232d42ffd (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/displayapp/screens/Meter.cpp')
| -rw-r--r-- | src/displayapp/screens/Meter.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index 2c042ca..e0dbdfa 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -4,35 +4,33 @@ using namespace Pinetime::Applications::Screens; - -Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { +Meter::Meter(Pinetime::Applications::DisplayApp* app) : Screen(app) { /*Create a line meter */ 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_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_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_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); - } Meter::~Meter() { - lv_obj_clean(lv_scr_act()); } bool Meter::Refresh() { - lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ - if(value>=60) value = 0; + lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ + if (value >= 60) + value = 0; return running; } |
