Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ set(INCLUDE_FILES
displayapp/screens/FirmwareValidation.h
displayapp/screens/ApplicationList.h
displayapp/screens/CheckboxList.h
displayapp/Apps.h
displayapp/WatchFaces.h
displayapp/ScreenIds.h
displayapp/screens/Notifications.h
displayapp/screens/HeartRate.h
displayapp/screens/Metronome.h
Expand Down
156 changes: 78 additions & 78 deletions src/displayapp/DisplayApp.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <task.h>
#include <memory>
#include <systemtask/Messages.h>
#include "displayapp/Apps.h"
#include "displayapp/LittleVgl.h"
#include "displayapp/TouchEvents.h"
#include "components/brightness/BrightnessController.h"
Expand All @@ -13,6 +12,7 @@
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
#include "components/timer/Timer.h"
#include "displayapp/ScreenIds.h"
#include "components/alarm/AlarmController.h"
#include "touchhandler/TouchHandler.h"

Expand Down Expand Up @@ -68,7 +68,7 @@ namespace Pinetime {
void Start(System::BootErrors error);
void PushMessage(Display::Messages msg);

void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
void StartApp(ScreenId screenId, DisplayApp::FullRefreshDirections direction);

void SetFullRefresh(FullRefreshDirections direction);

Expand Down Expand Up @@ -106,27 +106,27 @@ namespace Pinetime {

std::unique_ptr<Screens::Screen> currentScreen;

Apps currentApp = Apps::None;
Apps returnToApp = Apps::None;
ScreenId currentScreenId = ScreenId::None;
ScreenId returnToScreenId = ScreenId::None;
FullRefreshDirections returnDirection = FullRefreshDirections::None;
TouchEvents returnTouchEvent = TouchEvents::None;

TouchEvents GetGesture();
static void Process(void* instance);
void InitHw();
void Refresh();
void LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction);
void LoadScreen(Apps app, DisplayApp::FullRefreshDirections direction);
void LoadNewScreen(ScreenId screenId, DisplayApp::FullRefreshDirections direction);
void LoadScreen(ScreenId screenId, DisplayApp::FullRefreshDirections direction);
void PushMessageToSystemTask(Pinetime::System::Messages message);

Apps nextApp = Apps::None;
ScreenId nextScreenId = ScreenId::None;
DisplayApp::FullRefreshDirections nextDirection;
System::BootErrors bootError;
void ApplyBrightness();

static constexpr size_t returnAppStackSize = 10;
Utility::StaticStack<Apps, returnAppStackSize> returnAppStack;
Utility::StaticStack<FullRefreshDirections, returnAppStackSize> appStackDirections;
static constexpr size_t returnStackSize = 10;
Utility::StaticStack<ScreenId, returnStackSize> returnStack;
Utility::StaticStack<FullRefreshDirections, returnStackSize> stackDirections;

bool isDimmed = false;
};
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/DisplayAppRecovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <components/motor/MotorController.h>
#include "BootErrors.h"
#include "displayapp/TouchEvents.h"
#include "displayapp/Apps.h"
#include "displayapp/Messages.h"

namespace Pinetime {
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/Apps.h → src/displayapp/ScreenIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Pinetime {
namespace Applications {
enum class Apps {
enum class ScreenId {
None,
Launcher,
Clock,
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/ApplicationList.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "displayapp/screens/ApplicationList.h"
#include <lvgl/lvgl.h>
#include <functional>
#include "displayapp/Apps.h"
#include "displayapp/DisplayApp.h"

using namespace Pinetime::Applications::Screens;
Expand Down
31 changes: 16 additions & 15 deletions src/displayapp/screens/ApplicationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <array>
#include <memory>

#include "displayapp/ScreenIds.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h"
Expand Down Expand Up @@ -40,21 +41,21 @@ namespace Pinetime {
static constexpr int nScreens = 2;

static constexpr std::array<Tile::Applications, appsPerScreen * nScreens> applications {{
{Symbols::stopWatch, Apps::StopWatch},
{Symbols::clock, Apps::Alarm},
{Symbols::hourGlass, Apps::Timer},
{Symbols::shoe, Apps::Steps},
{Symbols::heartBeat, Apps::HeartRate},
{Symbols::music, Apps::Music},

{Symbols::paintbrush, Apps::Paint},
{Symbols::paddle, Apps::Paddle},
{"2", Apps::Twos},
{Symbols::drum, Apps::Metronome},
{Symbols::map, Apps::Navigation},
{Symbols::none, Apps::None},

// {"M", Apps::Motion},
{Symbols::stopWatch, ScreenId::StopWatch},
{Symbols::clock, ScreenId::Alarm},
{Symbols::hourGlass, ScreenId::Timer},
{Symbols::shoe, ScreenId::Steps},
{Symbols::heartBeat, ScreenId::HeartRate},
{Symbols::music, ScreenId::Music},

{Symbols::paintbrush, ScreenId::Paint},
{Symbols::paddle, ScreenId::Paddle},
{"2", ScreenId::Twos},
{Symbols::drum, ScreenId::Metronome},
{Symbols::map, ScreenId::Navigation},
{Symbols::none, ScreenId::None},

// {"M", ScreenId::Motion},
}};
ScreenList<nScreens> screens;
};
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/CheckboxList.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "displayapp/Apps.h"
#include "displayapp/screens/Screen.h"
#include <array>
#include <cstdint>
Expand Down
4 changes: 2 additions & 2 deletions src/displayapp/screens/List.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ List::List(uint8_t screenID,

for (int i = 0; i < MAXLISTITEMS; i++) {
apps[i] = applications[i].application;
if (applications[i].application != Apps::None) {
if (applications[i].application != ScreenId::None) {

static constexpr int btnHeight = (LV_HOR_RES_MAX - ((MAXLISTITEMS - 1) * innerPad)) / MAXLISTITEMS;
itemApps[i] = lv_btn_create(container, nullptr);
Expand Down Expand Up @@ -75,7 +75,7 @@ List::~List() {
void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
for (int i = 0; i < MAXLISTITEMS; i++) {
if (apps[i] != Apps::None && object == itemApps[i]) {
if (apps[i] != ScreenId::None && object == itemApps[i]) {
app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up);
running = false;
return;
Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/screens/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <array>
#include "displayapp/screens/Screen.h"
#include "displayapp/widgets/PageIndicator.h"
#include "displayapp/Apps.h"
#include "displayapp/ScreenIds.h"
#include "components/settings/Settings.h"

#define MAXLISTITEMS 4
Expand All @@ -18,7 +18,7 @@ namespace Pinetime {
struct Applications {
const char* icon;
const char* name;
Pinetime::Applications::Apps application;
Pinetime::Applications::ScreenId application;
};

explicit List(uint8_t screenID,
Expand All @@ -33,7 +33,7 @@ namespace Pinetime {
private:
DisplayApp* app;
Controllers::Settings& settingsController;
Pinetime::Applications::Apps apps[MAXLISTITEMS];
Pinetime::Applications::ScreenId apps[MAXLISTITEMS];

lv_obj_t* itemApps[MAXLISTITEMS];

Expand Down
4 changes: 2 additions & 2 deletions src/displayapp/screens/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Tile::Tile(uint8_t screenID,
if (i == 3) {
btnmMap[btIndex++] = "\n";
}
if (applications[i].application == Apps::None) {
if (applications[i].application == ScreenId::None) {
btnmMap[btIndex] = " ";
} else {
btnmMap[btIndex] = applications[i].icon;
Expand All @@ -76,7 +76,7 @@ Tile::Tile(uint8_t screenID,

for (uint8_t i = 0; i < 6; i++) {
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_CLICK_TRIG);
if (applications[i].application == Apps::None) {
if (applications[i].application == ScreenId::None) {
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/screens/Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstdint>
#include <memory>
#include "displayapp/screens/Screen.h"
#include "displayapp/Apps.h"
#include "displayapp/ScreenIds.h"
#include "components/datetime/DateTimeController.h"
#include "components/settings/Settings.h"
#include "components/battery/BatteryController.h"
Expand All @@ -18,7 +18,7 @@ namespace Pinetime {
public:
struct Applications {
const char* icon;
Pinetime::Applications::Apps application;
Pinetime::Applications::ScreenId application;
};

explicit Tile(uint8_t screenID,
Expand Down Expand Up @@ -48,7 +48,7 @@ namespace Pinetime {
Widgets::StatusIcons statusIcons;

const char* btnmMap[8];
Pinetime::Applications::Apps apps[6];
Pinetime::Applications::ScreenId apps[6];
};
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/displayapp/screens/settings/QuickSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "displayapp/screens/BatteryIcon.h"
#include "components/ble/BleController.h"
#include "displayapp/InfiniTimeTheme.h"
#include "displayapp/ScreenIds.h"

using namespace Pinetime::Applications::Screens;

Expand Down Expand Up @@ -137,7 +138,7 @@ void QuickSettings::UpdateScreen() {

void QuickSettings::OnButtonEvent(lv_obj_t* object) {
if (object == btn2) {
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
app->StartApp(ScreenId::FlashLight, DisplayApp::FullRefreshDirections::Up);
} else if (object == btn1) {

brightness.Step();
Expand All @@ -163,6 +164,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object) {

} else if (object == btn4) {
settingsController.SetSettingsMenu(0);
app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up);
app->StartApp(ScreenId::Settings, DisplayApp::FullRefreshDirections::Up);
}
}
1 change: 0 additions & 1 deletion src/displayapp/screens/settings/Settings.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "displayapp/screens/settings/Settings.h"
#include <lvgl/lvgl.h>
#include <functional>
#include "displayapp/Apps.h"
#include "displayapp/DisplayApp.h"

using namespace Pinetime::Applications::Screens;
Expand Down
39 changes: 20 additions & 19 deletions src/displayapp/screens/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <array>
#include <memory>
#include "displayapp/ScreenIds.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/ScreenList.h"
#include "displayapp/screens/Symbols.h"
Expand Down Expand Up @@ -32,25 +33,25 @@ namespace Pinetime {
static constexpr int nScreens = 3;

static constexpr std::array<List::Applications, entriesPerScreen * nScreens> entries {{
{Symbols::sun, "Display", Apps::SettingDisplay},
{Symbols::eye, "Wake Up", Apps::SettingWakeUp},
{Symbols::clock, "Time format", Apps::SettingTimeFormat},
{Symbols::home, "Watch face", Apps::SettingWatchFace},

{Symbols::shoe, "Steps", Apps::SettingSteps},
{Symbols::clock, "Date&Time", Apps::SettingSetDateTime},
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
{Symbols::clock, "Chimes", Apps::SettingChimes},

{Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold},
{Symbols::check, "Firmware", Apps::FirmwareValidation},
{Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth},
{Symbols::list, "About", Apps::SysInfo},

// {Symbols::none, "None", Apps::None},
// {Symbols::none, "None", Apps::None},
// {Symbols::none, "None", Apps::None},
// {Symbols::none, "None", Apps::None},
{Symbols::sun, "Display", ScreenId::SettingDisplay},
{Symbols::eye, "Wake Up", ScreenId::SettingWakeUp},
{Symbols::clock, "Time format", ScreenId::SettingTimeFormat},
{Symbols::home, "Watch face", ScreenId::SettingWatchFace},

{Symbols::shoe, "Steps", ScreenId::SettingSteps},
{Symbols::clock, "Date&Time", ScreenId::SettingSetDateTime},
{Symbols::batteryHalf, "Battery", ScreenId::BatteryInfo},
{Symbols::clock, "Chimes", ScreenId::SettingChimes},

{Symbols::tachometer, "Shake Calib.", ScreenId::SettingShakeThreshold},
{Symbols::check, "Firmware", ScreenId::FirmwareValidation},
{Symbols::bluetooth, "Bluetooth", ScreenId::SettingBluetooth},
{Symbols::list, "About", ScreenId::SysInfo},

// {Symbols::none, "None", ScreenId::None},
// {Symbols::none, "None", ScreenId::None},
// {Symbols::none, "None", ScreenId::None},
// {Symbols::none, "None", ScreenId::None},

}};
ScreenList<nScreens> screens;
Expand Down