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) {
|
bool Gfx::GetNextBuffer(uint8_t** data, size_t& size) {
|
||||||
if (!state.busy)
|
if (!state.busy)
|
||||||
return false;
|
return false;
|
||||||
state.remainingIterations = state.remainingIterations-1;
|
state.remainingIterations = state.remainingIterations - 1;
|
||||||
if (state.remainingIterations == 0) {
|
if (state.remainingIterations == 0) {
|
||||||
state.busy = false;
|
state.busy = false;
|
||||||
NotifyEndOfTransfer(state.taskToNotify);
|
NotifyEndOfTransfer(state.taskToNotify);
|
||||||
|
|
|
@ -40,10 +40,11 @@ namespace Pinetime {
|
||||||
Error,
|
Error,
|
||||||
Weather
|
Weather
|
||||||
};
|
};
|
||||||
|
|
||||||
template <Apps>
|
template <Apps>
|
||||||
struct AppTraits {};
|
struct AppTraits {};
|
||||||
|
|
||||||
template<Apps ...As>
|
template <Apps... As>
|
||||||
struct TypeList {
|
struct TypeList {
|
||||||
static constexpr size_t Count = sizeof...(As);
|
static constexpr size_t Count = sizeof...(As);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace Applications {
|
namespace Applications {
|
||||||
class DisplayApp;
|
class DisplayApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Components {
|
namespace Components {
|
||||||
class LittleVgl;
|
class LittleVgl;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Controllers {
|
namespace Controllers {
|
||||||
class Battery;
|
class Battery;
|
||||||
class Ble;
|
class Ble;
|
||||||
|
@ -23,9 +26,11 @@ namespace Pinetime {
|
||||||
class MusicService;
|
class MusicService;
|
||||||
class NavigationService;
|
class NavigationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace System {
|
namespace System {
|
||||||
class SystemTask;
|
class SystemTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Applications {
|
namespace Applications {
|
||||||
struct AppControllers {
|
struct AppControllers {
|
||||||
const Pinetime::Controllers::Battery& batteryController;
|
const Pinetime::Controllers::Battery& batteryController;
|
||||||
|
|
|
@ -98,11 +98,24 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
filesystem {filesystem},
|
filesystem {filesystem},
|
||||||
lvgl {lcd, filesystem},
|
lvgl {lcd, filesystem},
|
||||||
timer(this, TimerCallback),
|
timer(this, TimerCallback),
|
||||||
controllers{
|
controllers {batteryController,
|
||||||
batteryController, bleController, dateTimeController, notificationManager, heartRateController,
|
bleController,
|
||||||
settingsController, motorController, motionController, alarmController, brightnessController,
|
dateTimeController,
|
||||||
nullptr, filesystem, timer, nullptr, this, lvgl, nullptr, nullptr}
|
notificationManager,
|
||||||
{
|
heartRateController,
|
||||||
|
settingsController,
|
||||||
|
motorController,
|
||||||
|
motionController,
|
||||||
|
alarmController,
|
||||||
|
brightnessController,
|
||||||
|
nullptr,
|
||||||
|
filesystem,
|
||||||
|
timer,
|
||||||
|
nullptr,
|
||||||
|
this,
|
||||||
|
lvgl,
|
||||||
|
nullptr,
|
||||||
|
nullptr} {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::Start(System::BootErrors error) {
|
void DisplayApp::Start(System::BootErrors error) {
|
||||||
|
@ -421,8 +434,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
|
||||||
dateTimeController,
|
dateTimeController,
|
||||||
filesystem,
|
filesystem,
|
||||||
std::move(apps));
|
std::move(apps));
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case Apps::Clock:
|
case Apps::Clock:
|
||||||
currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
|
currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
|
||||||
batteryController,
|
batteryController,
|
||||||
|
|
|
@ -73,7 +73,6 @@ namespace Pinetime {
|
||||||
void Register(Pinetime::Controllers::MusicService* musicService);
|
void Register(Pinetime::Controllers::MusicService* musicService);
|
||||||
void Register(Pinetime::Controllers::NavigationService* NavigationService);
|
void Register(Pinetime::Controllers::NavigationService* NavigationService);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskHandle_t taskHandle;
|
TaskHandle_t taskHandle;
|
||||||
static void Process(void* instance);
|
static void Process(void* instance);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Pinetime {
|
||||||
return {AppTraits<t>::app, AppTraits<t>::icon, &AppTraits<t>::Create};
|
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...>) {
|
consteval std::array<AppDescription, sizeof...(ts)> CreateAppDescriptions(T<ts...>) {
|
||||||
return {CreateAppDescription<ts>()...};
|
return {CreateAppDescription<ts>()...};
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,14 +65,18 @@ namespace Pinetime {
|
||||||
Widgets::Counter minuteCounter = Widgets::Counter(0, 59, jetbrains_mono_76);
|
Widgets::Counter minuteCounter = Widgets::Counter(0, 59, jetbrains_mono_76);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
template<>
|
|
||||||
|
template <>
|
||||||
struct AppTraits<Apps::Alarm> {
|
struct AppTraits<Apps::Alarm> {
|
||||||
static constexpr Apps app = Apps::Alarm;
|
static constexpr Apps app = Apps::Alarm;
|
||||||
static constexpr const char* icon = Screens::Symbols::clock;
|
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.settingsController.GetClockType(),
|
||||||
*controllers.systemTask,
|
*controllers.systemTask,
|
||||||
controllers.motorController); };
|
controllers.motorController);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ ApplicationList::ApplicationList(DisplayApp* app,
|
||||||
batteryController {batteryController},
|
batteryController {batteryController},
|
||||||
bleController {bleController},
|
bleController {bleController},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
filesystem{filesystem},
|
filesystem {filesystem},
|
||||||
apps{std::move(apps)},
|
apps {std::move(apps)},
|
||||||
screens {app, settingsController.GetAppMenu(), CreateScreenList(), Screens::ScreenListModes::UpDown} {
|
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::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) const {
|
||||||
std::array<Tile::Applications, appsPerScreen> pageApps;
|
std::array<Tile::Applications, appsPerScreen> pageApps;
|
||||||
|
|
||||||
for(int i = 0; i < appsPerScreen; i++) {
|
for (int i = 0; i < appsPerScreen; i++) {
|
||||||
if(i+(screenNum * appsPerScreen) >= apps.size()) {
|
if (i + (screenNum * appsPerScreen) >= apps.size()) {
|
||||||
pageApps[i] = {"", Pinetime::Applications::Apps::None, false};
|
pageApps[i] = {"", Pinetime::Applications::Apps::None, false};
|
||||||
} else {
|
} else {
|
||||||
pageApps[i] = apps[i + (screenNum * appsPerScreen)];
|
pageApps[i] = apps[i + (screenNum * appsPerScreen)];
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Pinetime {
|
||||||
static constexpr int appsPerScreen = 6;
|
static constexpr int appsPerScreen = 6;
|
||||||
|
|
||||||
// Increment this when more space is needed
|
// 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;
|
ScreenList<nScreens> screens;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,10 +38,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::HeartRate> {
|
struct AppTraits<Apps::HeartRate> {
|
||||||
static constexpr Apps app = Apps::HeartRate;
|
static constexpr Apps app = Apps::HeartRate;
|
||||||
static constexpr const char* icon = Screens::Symbols::heartBeat;
|
static constexpr const char* icon = Screens::Symbols::heartBeat;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
|
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,10 +38,12 @@ namespace Pinetime {
|
||||||
uint8_t color = 2;
|
uint8_t color = 2;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Paint> {
|
struct AppTraits<Apps::Paint> {
|
||||||
static constexpr Apps app = Apps::Paint;
|
static constexpr Apps app = Apps::Paint;
|
||||||
static constexpr const char* icon = Screens::Symbols::paintbrush;
|
static constexpr const char* icon = Screens::Symbols::paintbrush;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
|
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,10 +37,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Metronome> {
|
struct AppTraits<Apps::Metronome> {
|
||||||
static constexpr Apps app = Apps::Metronome;
|
static constexpr Apps app = Apps::Metronome;
|
||||||
static constexpr const char* icon = Screens::Symbols::drum;
|
static constexpr const char* icon = Screens::Symbols::drum;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
|
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,10 +32,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Motion> {
|
struct AppTraits<Apps::Motion> {
|
||||||
static constexpr Apps app = Apps::Motion;
|
static constexpr Apps app = Apps::Motion;
|
||||||
static constexpr const char* icon = "M";
|
static constexpr const char* icon = "M";
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Motion(controllers.motionController);
|
return new Screens::Motion(controllers.motionController);
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,10 +85,12 @@ namespace Pinetime {
|
||||||
/** Watchapp */
|
/** Watchapp */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Music> {
|
struct AppTraits<Apps::Music> {
|
||||||
static constexpr Apps app = Apps::Music;
|
static constexpr Apps app = Apps::Music;
|
||||||
static constexpr const char* icon = Screens::Symbols::music;
|
static constexpr const char* icon = Screens::Symbols::music;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Music(*controllers.musicService);
|
return new Screens::Music(*controllers.musicService);
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,10 +58,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Navigation> {
|
struct AppTraits<Apps::Navigation> {
|
||||||
static constexpr Apps app = Apps::Navigation;
|
static constexpr Apps app = Apps::Navigation;
|
||||||
static constexpr const char* icon = Screens::Symbols::map;
|
static constexpr const char* icon = Screens::Symbols::map;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Navigation(*controllers.navigationService);
|
return new Screens::Navigation(*controllers.navigationService);
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,10 +48,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Paddle> {
|
struct AppTraits<Apps::Paddle> {
|
||||||
static constexpr Apps app = Apps::Paddle;
|
static constexpr Apps app = Apps::Paddle;
|
||||||
static constexpr const char* icon = Screens::Symbols::paddle;
|
static constexpr const char* icon = Screens::Symbols::paddle;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Paddle(controllers.lvgl);
|
return new Screens::Paddle(controllers.lvgl);
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,10 +42,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Steps> {
|
struct AppTraits<Apps::Steps> {
|
||||||
static constexpr Apps app = Apps::Steps;
|
static constexpr Apps app = Apps::Steps;
|
||||||
static constexpr const char* icon = Screens::Symbols::shoe;
|
static constexpr const char* icon = Screens::Symbols::shoe;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Steps(controllers.motionController, controllers.settingsController);
|
return new Screens::Steps(controllers.motionController, controllers.settingsController);
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,10 +59,12 @@ namespace Pinetime {
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::StopWatch> {
|
struct AppTraits<Apps::StopWatch> {
|
||||||
static constexpr Apps app = Apps::StopWatch;
|
static constexpr Apps app = Apps::StopWatch;
|
||||||
static constexpr const char* icon = Screens::Symbols::stopWatch;
|
static constexpr const char* icon = Screens::Symbols::stopWatch;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::StopWatch(*controllers.systemTask);
|
return new Screens::StopWatch(*controllers.systemTask);
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "components/timer/Timer.h"
|
#include "components/timer/Timer.h"
|
||||||
#include "Symbols.h"
|
#include "Symbols.h"
|
||||||
|
|
||||||
namespace Pinetime::Applications{
|
namespace Pinetime::Applications {
|
||||||
namespace Screens {
|
namespace Screens {
|
||||||
class Timer : public Screen {
|
class Timer : public Screen {
|
||||||
public:
|
public:
|
||||||
|
@ -46,10 +46,13 @@ namespace Pinetime::Applications{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
struct AppTraits<Apps::Timer> {
|
struct AppTraits<Apps::Timer> {
|
||||||
static constexpr Apps app = Apps::Timer;
|
static constexpr Apps app = Apps::Timer;
|
||||||
static constexpr const char* icon = Screens::Symbols::hourGlass;
|
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();
|
bool placeNewTile();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
template<>
|
|
||||||
|
template <>
|
||||||
struct AppTraits<Apps::Twos> {
|
struct AppTraits<Apps::Twos> {
|
||||||
static constexpr Apps app = Apps::Twos;
|
static constexpr Apps app = Apps::Twos;
|
||||||
static constexpr const char* icon = "2";
|
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();
|
std::unique_ptr<Screen> CreateScreenHumidity();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AppTraits<Apps::Weather> {
|
struct AppTraits<Apps::Weather> {
|
||||||
static constexpr Apps app = Apps::Weather;
|
static constexpr Apps app = Apps::Weather;
|
||||||
static constexpr const char* icon = Screens::Symbols::sun;
|
static constexpr const char* icon = Screens::Symbols::sun;
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Weather(controllers.displayApp, *controllers.weatherController);
|
return new Screens::Weather(controllers.displayApp, *controllers.weatherController);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user