Author: Jean-François Milants <jf@codingfield.com>
A few minors changes following the code review : rename fs -> filesystem, use std::array instead of raw array,...
src/displayapp/DisplayAppRecovery.cpp | 2 +- src/displayapp/screens/CheckboxList.cpp | 6 +++--- src/displayapp/screens/CheckboxList.h | 14 +++++++------- src/displayapp/screens/Clock.cpp | 6 +++--- src/displayapp/screens/Clock.h | 4 ++-- src/displayapp/screens/WatchFaceInfineat.h | 2 +-
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index 6ec67ceae1def9cfeb6a3253f1bf5129eed2d998..e553aa8794c30aa3d766dd5903908fd7618bb611 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -2,7 +2,7 @@ #include "displayapp/DisplayAppRecovery.h" #include <FreeRTOS.h> #include <task.h> #include <libraries/log/nrf_log.h> -#include <components/fs/FS.h> +#include "components/fs/FS.h" #include "components/rle/RleDecoder.h" #include "touchhandler/TouchHandler.h" #include "displayapp/icons/infinitime/infinitime-nb.c" diff --git a/src/displayapp/screens/CheckboxList.cpp b/src/displayapp/screens/CheckboxList.cpp index 177a9718196a6c6130abde298bea105e036ffaa8..d351a852a5f164012766d6ddd792f29de512c7ed 100644 --- a/src/displayapp/screens/CheckboxList.cpp +++ b/src/displayapp/screens/CheckboxList.cpp @@ -20,7 +20,7 @@ const char* optionsTitle, const char* optionsSymbol, void (Controllers::Settings::*SetOptionIndex)(uint8_t), uint8_t (Controllers::Settings::*GetOptionIndex)() const, - std::array<const char*, MAXLISTITEMS> options) + std::array<const char*, MaxItems> options) : Screen(app), screenID {screenID}, settingsController {settingsController}, @@ -42,7 +42,7 @@ pageIndicatorBase = lv_line_create(lv_scr_act(), NULL); lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); - lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); + lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints.data(), 2); const uint16_t indicatorSize = LV_VER_RES / numScreens; const uint16_t indicatorPos = indicatorSize * screenID; @@ -55,7 +55,7 @@ pageIndicator = lv_line_create(lv_scr_act(), NULL); lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); + lv_line_set_points(pageIndicator, pageIndicatorPoints.data(), 2); } lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); diff --git a/src/displayapp/screens/CheckboxList.h b/src/displayapp/screens/CheckboxList.h index 6660acde0894fce3d62ab4153194d4f9e492c938..68280edd06efc889cac0927f0a070f5564747337 100644 --- a/src/displayapp/screens/CheckboxList.h +++ b/src/displayapp/screens/CheckboxList.h @@ -14,6 +14,8 @@ namespace Applications { namespace Screens { class CheckboxList : public Screen { public: + static constexpr size_t MaxItems = 4; + CheckboxList(const uint8_t screenID, const uint8_t numScreens, DisplayApp* app, @@ -22,7 +24,7 @@ const char* optionsTitle, const char* optionsSymbol, void (Controllers::Settings::*SetOptionIndex)(uint8_t), uint8_t (Controllers::Settings::*GetOptionIndex)() const, - std::array<const char*, MAXLISTITEMS> options); + std::array<const char*, MaxItems> options); ~CheckboxList() override; @@ -35,12 +37,10 @@ const char* optionsTitle; const char* optionsSymbol; void (Controllers::Settings::*SetOptionIndex)(uint8_t); uint8_t (Controllers::Settings::*GetOptionIndex)() const; - std::array<const char*, MAXLISTITEMS> options; - - lv_obj_t* cbOption[MAXLISTITEMS]; - - lv_point_t pageIndicatorBasePoints[2]; - lv_point_t pageIndicatorPoints[2]; + std::array<const char*, MaxItems> options; + std::array<lv_obj_t*, MaxItems> cbOption; + std::array<lv_point_t, 2> pageIndicatorBasePoints; + std::array<lv_point_t, 2> pageIndicatorPoints; lv_obj_t* pageIndicatorBase; lv_obj_t* pageIndicator; }; diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 90b65ebdeed447c07227aae58b2479f6aaf9a38c..443506e0fcd22b6ba287b3fbbb8e58b676f398c3 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -24,7 +24,7 @@ Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::FS& fs) + Controllers::FS& filesystem) : Screen(app), dateTimeController {dateTimeController}, batteryController {batteryController}, @@ -33,7 +33,7 @@ notificatioManager {notificatioManager}, settingsController {settingsController}, heartRateController {heartRateController}, motionController {motionController}, - fs {fs}, + filesystem {filesystem}, screen {[this, &settingsController]() { switch (settingsController.GetClockFace()) { case 0: @@ -118,5 +118,5 @@ bleController, notificatioManager, settingsController, motionController, - fs); + filesystem); } diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 0cdc60288a5cc47372d276b71af4e8cee3e2d9ed..b48c9ba25c5dd0f1e1dc6fcc157126be125c3e51 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -29,7 +29,7 @@ Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::FS& fs); + Controllers::FS& filesystem); ~Clock() override; bool OnTouchEvent(TouchEvents event) override; @@ -43,7 +43,7 @@ Controllers::NotificationManager& notificatioManager; Controllers::Settings& settingsController; Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; - Controllers::FS& fs; + Controllers::FS& filesystem; std::unique_ptr<Screen> screen; std::unique_ptr<Screen> WatchFaceDigitalScreen(); diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index c306b53c8fb686028d44d87db3ab2f7be5c4bc08..4a7dbebdc7a6e16a212677369cffb3e61989f04e 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -1,6 +1,6 @@ #pragma once -#include <lvgl/src/lv_core/lv_obj.h> +#include <lvgl/lvgl.h> #include <chrono> #include <cstdint> #include <memory>