aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/Apps.h3
-rw-r--r--src/displayapp/Controllers.h5
-rw-r--r--src/displayapp/DisplayApp.cpp26
-rw-r--r--src/displayapp/DisplayAppRecovery.h1
-rw-r--r--src/displayapp/UserApps.h2
-rw-r--r--src/displayapp/screens/Alarm.h10
-rw-r--r--src/displayapp/screens/ApplicationList.cpp10
-rw-r--r--src/displayapp/screens/ApplicationList.h2
-rw-r--r--src/displayapp/screens/HeartRate.h2
-rw-r--r--src/displayapp/screens/InfiniPaint.h2
-rw-r--r--src/displayapp/screens/Metronome.h2
-rw-r--r--src/displayapp/screens/Motion.h2
-rw-r--r--src/displayapp/screens/Music.h2
-rw-r--r--src/displayapp/screens/Navigation.h2
-rw-r--r--src/displayapp/screens/Paddle.h2
-rw-r--r--src/displayapp/screens/Steps.h2
-rw-r--r--src/displayapp/screens/StopWatch.h2
-rw-r--r--src/displayapp/screens/Timer.h9
-rw-r--r--src/displayapp/screens/Twos.h8
-rw-r--r--src/displayapp/screens/Weather.h2
20 files changed, 72 insertions, 24 deletions
diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h
index d96e6ea7..0dd8157e 100644
--- a/src/displayapp/Apps.h
+++ b/src/displayapp/Apps.h
@@ -40,10 +40,11 @@ namespace Pinetime {
Error,
Weather
};
+
template <Apps>
struct AppTraits {};
- template<Apps ...As>
+ template <Apps... As>
struct TypeList {
static constexpr size_t Count = sizeof...(As);
};
diff --git a/src/displayapp/Controllers.h b/src/displayapp/Controllers.h
index a2f82388..df6b2284 100644
--- a/src/displayapp/Controllers.h
+++ b/src/displayapp/Controllers.h
@@ -1,11 +1,14 @@
#pragma once
+
namespace Pinetime {
namespace Applications {
class DisplayApp;
}
+
namespace Components {
class LittleVgl;
}
+
namespace Controllers {
class Battery;
class Ble;
@@ -23,9 +26,11 @@ namespace Pinetime {
class MusicService;
class NavigationService;
}
+
namespace System {
class SystemTask;
}
+
namespace Applications {
struct AppControllers {
const Pinetime::Controllers::Battery& batteryController;
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index a195361d..98be6324 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -98,11 +98,24 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
filesystem {filesystem},
lvgl {lcd, filesystem},
timer(this, TimerCallback),
- controllers{
- batteryController, bleController, dateTimeController, notificationManager, heartRateController,
- settingsController, motorController, motionController, alarmController, brightnessController,
- nullptr, filesystem, timer, nullptr, this, lvgl, nullptr, nullptr}
- {
+ controllers {batteryController,
+ bleController,
+ dateTimeController,
+ notificationManager,
+ heartRateController,
+ settingsController,
+ motorController,
+ motionController,
+ alarmController,
+ brightnessController,
+ nullptr,
+ filesystem,
+ timer,
+ nullptr,
+ this,
+ lvgl,
+ nullptr,
+ nullptr} {
}
void DisplayApp::Start(System::BootErrors error) {
@@ -421,8 +434,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
dateTimeController,
filesystem,
std::move(apps));
- }
- break;
+ } break;
case Apps::Clock:
currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
batteryController,
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index a42d3e2f..41aedb17 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -73,7 +73,6 @@ namespace Pinetime {
void Register(Pinetime::Controllers::MusicService* musicService);
void Register(Pinetime::Controllers::NavigationService* NavigationService);
-
private:
TaskHandle_t taskHandle;
static void Process(void* instance);
diff --git a/src/displayapp/UserApps.h b/src/displayapp/UserApps.h
index d0165cf9..0ed9d602 100644
--- a/src/displayapp/UserApps.h
+++ b/src/displayapp/UserApps.h
@@ -26,7 +26,7 @@ namespace Pinetime {
return {AppTraits<t>::app, AppTraits<t>::icon, &AppTraits<t>::Create};
}
- template <template<Apps...> typename T, Apps ...ts>
+ template <template <Apps...> typename T, Apps... ts>
consteval std::array<AppDescription, sizeof...(ts)> CreateAppDescriptions(T<ts...>) {
return {CreateAppDescription<ts>()...};
}
diff --git a/src/displayapp/screens/Alarm.h b/src/displayapp/screens/Alarm.h
index efa38eb7..d8ed9668 100644
--- a/src/displayapp/screens/Alarm.h
+++ b/src/displayapp/screens/Alarm.h
@@ -65,14 +65,18 @@ namespace Pinetime {
Widgets::Counter minuteCounter = Widgets::Counter(0, 59, jetbrains_mono_76);
};
}
- template<>
+
+ template <>
struct AppTraits<Apps::Alarm> {
static constexpr Apps app = Apps::Alarm;
static constexpr const char* icon = Screens::Symbols::clock;
- static Screens::Screen *Create(AppControllers& controllers) { return new Screens::Alarm(controllers.alarmController,
+
+ static Screens::Screen* Create(AppControllers& controllers) {
+ return new Screens::Alarm(controllers.alarmController,
controllers.settingsController.GetClockType(),
*controllers.systemTask,
- controllers.motorController); };
+ controllers.motorController);
+ };
};
}
}
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp
index e5e26098..41735349 100644
--- a/src/displayapp/screens/ApplicationList.cpp
+++ b/src/displayapp/screens/ApplicationList.cpp
@@ -2,7 +2,7 @@
#include "displayapp/screens/Tile.h"
#include <lvgl/lvgl.h>
#include <functional>
-#include <algorithm>
+#include <algorithm>
#include "components/settings/Settings.h"
using namespace Pinetime::Applications::Screens;
@@ -29,8 +29,8 @@ ApplicationList::ApplicationList(DisplayApp* app,
batteryController {batteryController},
bleController {bleController},
dateTimeController {dateTimeController},
- filesystem{filesystem},
- apps{std::move(apps)},
+ filesystem {filesystem},
+ apps {std::move(apps)},
screens {app, settingsController.GetAppMenu(), CreateScreenList(), Screens::ScreenListModes::UpDown} {
}
@@ -45,8 +45,8 @@ bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
std::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) const {
std::array<Tile::Applications, appsPerScreen> pageApps;
- for(int i = 0; i < appsPerScreen; i++) {
- if(i+(screenNum * appsPerScreen) >= apps.size()) {
+ for (int i = 0; i < appsPerScreen; i++) {
+ if (i + (screenNum * appsPerScreen) >= apps.size()) {
pageApps[i] = {"", Pinetime::Applications::Apps::None, false};
} else {
pageApps[i] = apps[i + (screenNum * appsPerScreen)];
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h
index 2ad9c7c7..f8a6be66 100644
--- a/src/displayapp/screens/ApplicationList.h
+++ b/src/displayapp/screens/ApplicationList.h
@@ -39,7 +39,7 @@ namespace Pinetime {
static constexpr int appsPerScreen = 6;
// Increment this when more space is needed
- static constexpr int nScreens = (UserAppTypes::Count/appsPerScreen)+1;
+ static constexpr int nScreens = (UserAppTypes::Count / appsPerScreen) + 1;
ScreenList<nScreens> screens;
};
diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h
index 85da8dee..bf39209a 100644
--- a/src/displayapp/screens/HeartRate.h
+++ b/src/displayapp/screens/HeartRate.h
@@ -38,10 +38,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::HeartRate> {
static constexpr Apps app = Apps::HeartRate;
static constexpr const char* icon = Screens::Symbols::heartBeat;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
};
diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h
index a25ace55..f7d6de53 100644
--- a/src/displayapp/screens/InfiniPaint.h
+++ b/src/displayapp/screens/InfiniPaint.h
@@ -38,10 +38,12 @@ namespace Pinetime {
uint8_t color = 2;
};
}
+
template <>
struct AppTraits<Apps::Paint> {
static constexpr Apps app = Apps::Paint;
static constexpr const char* icon = Screens::Symbols::paintbrush;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
};
diff --git a/src/displayapp/screens/Metronome.h b/src/displayapp/screens/Metronome.h
index 8820962d..c498048e 100644
--- a/src/displayapp/screens/Metronome.h
+++ b/src/displayapp/screens/Metronome.h
@@ -37,10 +37,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::Metronome> {
static constexpr Apps app = Apps::Metronome;
static constexpr const char* icon = Screens::Symbols::drum;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
};
diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h
index 3ef570d6..9cd126f4 100644
--- a/src/displayapp/screens/Motion.h
+++ b/src/displayapp/screens/Motion.h
@@ -32,10 +32,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::Motion> {
static constexpr Apps app = Apps::Motion;
static constexpr const char* icon = "M";
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Motion(controllers.motionController);
};
diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h
index acbb6312..062bd968 100644
--- a/src/displayapp/screens/Music.h
+++ b/src/displayapp/screens/Music.h
@@ -85,10 +85,12 @@ namespace Pinetime {
/** Watchapp */
};
}
+
template <>
struct AppTraits<Apps::Music> {
static constexpr Apps app = Apps::Music;
static constexpr const char* icon = Screens::Symbols::music;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Music(*controllers.musicService);
};
diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h
index d54df13c..e62745b2 100644
--- a/src/displayapp/screens/Navigation.h
+++ b/src/displayapp/screens/Navigation.h
@@ -58,10 +58,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::Navigation> {
static constexpr Apps app = Apps::Navigation;
static constexpr const char* icon = Screens::Symbols::map;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Navigation(*controllers.navigationService);
};
diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h
index 0670e5b1..1ea25158 100644
--- a/src/displayapp/screens/Paddle.h
+++ b/src/displayapp/screens/Paddle.h
@@ -48,10 +48,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::Paddle> {
static constexpr Apps app = Apps::Paddle;
static constexpr const char* icon = Screens::Symbols::paddle;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Paddle(controllers.lvgl);
};
diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h
index 5299d67f..428e4b29 100644
--- a/src/displayapp/screens/Steps.h
+++ b/src/displayapp/screens/Steps.h
@@ -42,10 +42,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::Steps> {
static constexpr Apps app = Apps::Steps;
static constexpr const char* icon = Screens::Symbols::shoe;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Steps(controllers.motionController, controllers.settingsController);
};
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index c3550fc4..b3bbba87 100644
--- a/src/displayapp/screens/StopWatch.h
+++ b/src/displayapp/screens/StopWatch.h
@@ -59,10 +59,12 @@ namespace Pinetime {
lv_task_t* taskRefresh;
};
}
+
template <>
struct AppTraits<Apps::StopWatch> {
static constexpr Apps app = Apps::StopWatch;
static constexpr const char* icon = Screens::Symbols::stopWatch;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::StopWatch(*controllers.systemTask);
};
diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h
index f8e337c2..409cae1c 100644
--- a/src/displayapp/screens/Timer.h
+++ b/src/displayapp/screens/Timer.h
@@ -10,7 +10,7 @@
#include "components/timer/Timer.h"
#include "Symbols.h"
-namespace Pinetime::Applications{
+namespace Pinetime::Applications {
namespace Screens {
class Timer : public Screen {
public:
@@ -46,10 +46,13 @@ namespace Pinetime::Applications{
};
}
- template<>
+ template <>
struct AppTraits<Apps::Timer> {
static constexpr Apps app = Apps::Timer;
static constexpr const char* icon = Screens::Symbols::hourGlass;
- static Screens::Screen *Create(AppControllers& controllers) { return new Screens::Timer(controllers.timer); };
+
+ static Screens::Screen* Create(AppControllers& controllers) {
+ return new Screens::Timer(controllers.timer);
+ };
};
}
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h
index 4e6980f5..d983d136 100644
--- a/src/displayapp/screens/Twos.h
+++ b/src/displayapp/screens/Twos.h
@@ -36,11 +36,15 @@ namespace Pinetime {
bool placeNewTile();
};
}
- template<>
+
+ template <>
struct AppTraits<Apps::Twos> {
static constexpr Apps app = Apps::Twos;
static constexpr const char* icon = "2";
- static Screens::Screen *Create(AppControllers& /*controllers*/) { return new Screens::Twos(); };
+
+ static Screens::Screen* Create(AppControllers& /*controllers*/) {
+ return new Screens::Twos();
+ };
};
}
}
diff --git a/src/displayapp/screens/Weather.h b/src/displayapp/screens/Weather.h
index 888dc257..84177ea6 100644
--- a/src/displayapp/screens/Weather.h
+++ b/src/displayapp/screens/Weather.h
@@ -44,10 +44,12 @@ namespace Pinetime {
std::unique_ptr<Screen> CreateScreenHumidity();
};
}
+
template <>
struct AppTraits<Apps::Weather> {
static constexpr Apps app = Apps::Weather;
static constexpr const char* icon = Screens::Symbols::sun;
+
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Weather(controllers.displayApp, *controllers.weatherController);
};