A few minors changes following the code review : rename fs -> filesystem, use std::array instead of raw array,...

This commit is contained in:
Jean-François Milants 2022-09-27 18:06:15 +02:00
parent 58bb0e77db
commit 56f315b94a
6 changed files with 17 additions and 17 deletions

View File

@ -2,7 +2,7 @@
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <task.h> #include <task.h>
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include <components/fs/FS.h> #include "components/fs/FS.h"
#include "components/rle/RleDecoder.h" #include "components/rle/RleDecoder.h"
#include "touchhandler/TouchHandler.h" #include "touchhandler/TouchHandler.h"
#include "displayapp/icons/infinitime/infinitime-nb.c" #include "displayapp/icons/infinitime/infinitime-nb.c"

View File

@ -20,7 +20,7 @@ CheckboxList::CheckboxList(const uint8_t screenID,
const char* optionsSymbol, const char* optionsSymbol,
void (Controllers::Settings::*SetOptionIndex)(uint8_t), void (Controllers::Settings::*SetOptionIndex)(uint8_t),
uint8_t (Controllers::Settings::*GetOptionIndex)() const, uint8_t (Controllers::Settings::*GetOptionIndex)() const,
std::array<const char*, MAXLISTITEMS> options) std::array<const char*, MaxItems> options)
: Screen(app), : Screen(app),
screenID {screenID}, screenID {screenID},
settingsController {settingsController}, settingsController {settingsController},
@ -42,7 +42,7 @@ CheckboxList::CheckboxList(const uint8_t screenID,
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL); 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_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_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 indicatorSize = LV_VER_RES / numScreens;
const uint16_t indicatorPos = indicatorSize * screenID; const uint16_t indicatorPos = indicatorSize * screenID;
@ -55,7 +55,7 @@ CheckboxList::CheckboxList(const uint8_t screenID,
pageIndicator = lv_line_create(lv_scr_act(), NULL); 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_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_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); lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);

View File

@ -14,6 +14,8 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class CheckboxList : public Screen { class CheckboxList : public Screen {
public: public:
static constexpr size_t MaxItems = 4;
CheckboxList(const uint8_t screenID, CheckboxList(const uint8_t screenID,
const uint8_t numScreens, const uint8_t numScreens,
DisplayApp* app, DisplayApp* app,
@ -22,7 +24,7 @@ namespace Pinetime {
const char* optionsSymbol, const char* optionsSymbol,
void (Controllers::Settings::*SetOptionIndex)(uint8_t), void (Controllers::Settings::*SetOptionIndex)(uint8_t),
uint8_t (Controllers::Settings::*GetOptionIndex)() const, uint8_t (Controllers::Settings::*GetOptionIndex)() const,
std::array<const char*, MAXLISTITEMS> options); std::array<const char*, MaxItems> options);
~CheckboxList() override; ~CheckboxList() override;
@ -35,12 +37,10 @@ namespace Pinetime {
const char* optionsSymbol; const char* optionsSymbol;
void (Controllers::Settings::*SetOptionIndex)(uint8_t); void (Controllers::Settings::*SetOptionIndex)(uint8_t);
uint8_t (Controllers::Settings::*GetOptionIndex)() const; uint8_t (Controllers::Settings::*GetOptionIndex)() const;
std::array<const char*, MAXLISTITEMS> options; std::array<const char*, MaxItems> options;
std::array<lv_obj_t*, MaxItems> cbOption;
lv_obj_t* cbOption[MAXLISTITEMS]; std::array<lv_point_t, 2> pageIndicatorBasePoints;
std::array<lv_point_t, 2> pageIndicatorPoints;
lv_point_t pageIndicatorBasePoints[2];
lv_point_t pageIndicatorPoints[2];
lv_obj_t* pageIndicatorBase; lv_obj_t* pageIndicatorBase;
lv_obj_t* pageIndicator; lv_obj_t* pageIndicator;
}; };

View File

@ -24,7 +24,7 @@ Clock::Clock(DisplayApp* app,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController, Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController, Controllers::MotionController& motionController,
Controllers::FS& fs) Controllers::FS& filesystem)
: Screen(app), : Screen(app),
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
batteryController {batteryController}, batteryController {batteryController},
@ -33,7 +33,7 @@ Clock::Clock(DisplayApp* app,
settingsController {settingsController}, settingsController {settingsController},
heartRateController {heartRateController}, heartRateController {heartRateController},
motionController {motionController}, motionController {motionController},
fs {fs}, filesystem {filesystem},
screen {[this, &settingsController]() { screen {[this, &settingsController]() {
switch (settingsController.GetClockFace()) { switch (settingsController.GetClockFace()) {
case 0: case 0:
@ -118,5 +118,5 @@ std::unique_ptr<Screen> Clock::WatchFaceInfineatScreen() {
notificatioManager, notificatioManager,
settingsController, settingsController,
motionController, motionController,
fs); filesystem);
} }

View File

@ -29,7 +29,7 @@ namespace Pinetime {
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController, Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController, Controllers::MotionController& motionController,
Controllers::FS& fs); Controllers::FS& filesystem);
~Clock() override; ~Clock() override;
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
@ -43,7 +43,7 @@ namespace Pinetime {
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
Controllers::FS& fs; Controllers::FS& filesystem;
std::unique_ptr<Screen> screen; std::unique_ptr<Screen> screen;
std::unique_ptr<Screen> WatchFaceDigitalScreen(); std::unique_ptr<Screen> WatchFaceDigitalScreen();

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <lvgl/src/lv_core/lv_obj.h> #include <lvgl/lvgl.h>
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>