Fix code formatting
This commit is contained in:
parent
97ba1a456d
commit
473d9c4fa4
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>()...};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)];
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user