summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Motion.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2021-05-21 09:38:38 (GMT)
committerGitea <gitea@fake.local>2021-05-21 09:38:38 (GMT)
commitde69905c0647997091d9e385538c96de30be93e6 (patch)
tree4775001d808da520c93a7552da1bea80e7714a30 /src/displayapp/screens/Motion.cpp
parenta80e782f267cd2424d22da23d809c0c6a8ff8761 (diff)
parent7c9513be8a3bf36fda5706cb0fb1bd6232d42ffd (diff)
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/displayapp/screens/Motion.cpp')
-rw-r--r--src/displayapp/screens/Motion.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index ed4b819..a8bb3c1 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -3,17 +3,15 @@
#include "../DisplayApp.h"
using namespace Pinetime::Applications::Screens;
-extern lv_font_t jetbrains_mono_extrabold_compressed;
-extern lv_font_t jetbrains_mono_bold_20;
-
-Motion::Motion(Pinetime::Applications::DisplayApp *app, Controllers::MotionController& motionController) : Screen(app), motionController{motionController} {
+Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController)
+ : Screen(app), motionController {motionController} {
chart = lv_chart_create(lv_scr_act(), NULL);
lv_obj_set_size(chart, 240, 240);
lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
- lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
- //lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
- //lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
+ lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
+ // lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
+ // lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
lv_chart_set_range(chart, -1100, 1100);
lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT);
@@ -29,13 +27,16 @@ Motion::Motion(Pinetime::Applications::DisplayApp *app, Controllers::MotionContr
lv_chart_init_points(chart, ser3, 0);
lv_chart_refresh(chart); /*Required after direct set*/
+ label = lv_label_create(lv_scr_act(), NULL);
+ lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", 0, 0, 0);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
+ lv_label_set_recolor(label, true);
+
labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
- lv_label_set_text(labelStep, "Steps: ");
+ lv_label_set_text(labelStep, "Steps ---");
- labelStepValue = lv_label_create(lv_scr_act(), NULL);
- lv_obj_align(labelStepValue, labelStep, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
- lv_label_set_text(labelStepValue, "-");
}
Motion::~Motion() {
@@ -47,8 +48,10 @@ bool Motion::Refresh() {
lv_chart_set_next(chart, ser2, motionController.Y());
lv_chart_set_next(chart, ser3, motionController.Z());
- snprintf(nbStepsBuffer, nbStepsBufferSize, "%lu", motionController.NbSteps());
- lv_label_set_text(labelStepValue, nbStepsBuffer);
+ lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps());
+
+ lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10);
+ lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
return running;
}