Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JF002 committed Nov 1, 2023
1 parent 4430c1f commit 8b3ff0d
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/components/gfx/Gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void Gfx::SetBackgroundColor(uint16_t color) {
bool Gfx::GetNextBuffer(uint8_t** data, size_t& size) {
if (!state.busy)
return false;
state.remainingIterations = state.remainingIterations-1;
state.remainingIterations = state.remainingIterations - 1;
if (state.remainingIterations == 0) {
state.busy = false;
NotifyEndOfTransfer(state.taskToNotify);
Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/Apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
5 changes: 5 additions & 0 deletions src/displayapp/Controllers.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#pragma once

namespace Pinetime {
namespace Applications {
class DisplayApp;
}

namespace Components {
class LittleVgl;
}

namespace Controllers {
class Battery;
class Ble;
Expand All @@ -23,9 +26,11 @@ namespace Pinetime {
class MusicService;
class NavigationService;
}

namespace System {
class SystemTask;
}

namespace Applications {
struct AppControllers {
const Pinetime::Controllers::Battery& batteryController;
Expand Down
26 changes: 19 additions & 7 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/DisplayAppRecovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/UserApps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>()...};
}
Expand Down
10 changes: 7 additions & 3 deletions src/displayapp/screens/Alarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
};
}
}
10 changes: 5 additions & 5 deletions src/displayapp/screens/ApplicationList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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} {
}

Expand All @@ -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)];
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/ApplicationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/HeartRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/InfiniPaint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Metronome.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Music.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Paddle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/Steps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/screens/StopWatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
9 changes: 6 additions & 3 deletions src/displayapp/screens/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
};
};
}
8 changes: 6 additions & 2 deletions src/displayapp/screens/Twos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
};
}
}
2 changes: 2 additions & 0 deletions src/displayapp/screens/Weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 8b3ff0d

Please sign in to comment.