diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-03-26 03:11:04 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-03-26 03:25:17 (GMT) |
| commit | 8b7bbf4b84a008e42a0ebba8af316690af696d5b (patch) | |
| tree | 21bcfb4f4da4b3f6b3ebb21d6dd85f080f8cecd3 /src/displayapp/screens | |
| parent | 1589e31b71b0f45eebd6fb95b53248a156821abb (diff) | |
compactify app list
Diffstat (limited to 'src/displayapp/screens')
| -rw-r--r-- | src/displayapp/screens/ApplicationList.cpp | 26 | ||||
| -rw-r--r-- | src/displayapp/screens/ApplicationList.h | 4 | ||||
| -rw-r--r-- | src/displayapp/screens/Motion.cpp | 61 | ||||
| -rw-r--r-- | src/displayapp/screens/Motion.h | 34 |
4 files changed, 3 insertions, 122 deletions
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index a34a255..b7498aa 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -21,11 +21,7 @@ ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app, { [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); - }, - [this]() -> std::unique_ptr<Screen> { - return CreateScreen2(); - }, - //[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); } + } }, Screens::ScreenListModes::UpDown} { } @@ -42,27 +38,9 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() { std::array<Screens::Tile::Applications, 6> applications {{ {Symbols::shoe, Apps::Steps}, {Symbols::heartBeat, Apps::HeartRate}, - }}; - - return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications); -} - -std::unique_ptr<Screen> ApplicationList::CreateScreen2() { - std::array<Screens::Tile::Applications, 6> applications {{ - {Symbols::chartLine, Apps::Motion}, {Symbols::clock, Apps::Alarm}, }}; - return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications); + return std::make_unique<Screens::Tile>(0, 1, app, settingsController, batteryController, dateTimeController, applications); } -/*std::unique_ptr<Screen> ApplicationList::CreateScreen3() { - std::array<Screens::Tile::Applications, 6> applications { - {{"A", Apps::Meter}, - {"C", Apps::Clock}, - {"F", Apps::Brightness} - } - }; - - return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications); -}*/ diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index f430a89..9cd8efa 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -25,10 +25,8 @@ namespace Pinetime { Pinetime::Controllers::Battery& batteryController; Controllers::DateTime& dateTimeController; - ScreenList<2> screens; + ScreenList<1> screens; std::unique_ptr<Screen> CreateScreen1(); - std::unique_ptr<Screen> CreateScreen2(); - // std::unique_ptr<Screen> CreateScreen3(); }; } } diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp deleted file mode 100644 index 23eb276..0000000 --- a/src/displayapp/screens/Motion.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "displayapp/screens/Motion.h" -#include <lvgl/lvgl.h> -#include "displayapp/DisplayApp.h" - -using namespace Pinetime::Applications::Screens; - -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_range(chart, -1100, 1100); - lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT); - lv_chart_set_point_count(chart, 10); - - /*Add 3 data series*/ - ser1 = lv_chart_add_series(chart, LV_COLOR_RED); - ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN); - ser3 = lv_chart_add_series(chart, LV_COLOR_YELLOW); - - lv_chart_init_points(chart, ser1, 0); - lv_chart_init_points(chart, ser2, 0); - 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 ---"); - - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); -} - -Motion::~Motion() { - lv_task_del(taskRefresh); - lv_obj_clean(lv_scr_act()); -} - -void Motion::Refresh() { - lv_chart_set_next(chart, ser1, motionController.X()); - lv_chart_set_next(chart, ser2, motionController.Y()); - lv_chart_set_next(chart, ser3, motionController.Z()); - - 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); -} diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h deleted file mode 100644 index 4d2bd4f..0000000 --- a/src/displayapp/screens/Motion.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <cstdint> -#include <chrono> -#include "displayapp/screens/Screen.h" -#include <lvgl/src/lv_core/lv_style.h> -#include <lvgl/src/lv_core/lv_obj.h> -#include <components/motion/MotionController.h> - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Motion : public Screen { - public: - Motion(DisplayApp* app, Controllers::MotionController& motionController); - ~Motion() override; - - void Refresh() override; - - private: - Controllers::MotionController& motionController; - lv_obj_t* chart; - lv_chart_series_t* ser1; - lv_chart_series_t* ser2; - lv_chart_series_t* ser3; - lv_obj_t* label; - - lv_obj_t* labelStep; - lv_task_t* taskRefresh; - }; - } - } -} |
