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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")
project(pinetime VERSION 1.11.0 LANGUAGES C CXX ASM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)

# set(CMAKE_GENERATOR "Unix Makefiles")
set(CMAKE_C_EXTENSIONS OFF)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,10 @@ add_definitions(-D__STACK_SIZE=1024)
add_definitions(-D__HEAP_SIZE=4096)
add_definitions(-DMYNEWT_VAL_BLE_LL_RFMGMT_ENABLE_TIME=1500)

if(DISABLED_APPS)
add_definitions(-DDISABLED_APPS=${DISABLED_APPS})
endif()

# Note: Only use this for debugging
# Derive the low frequency clock from the main clock (SYNT)
# add_definitions(-DCLOCK_CONFIG_LF_SRC=2)
Expand Down
89 changes: 53 additions & 36 deletions src/displayapp/Apps.h
Original file line number Diff line number Diff line change
@@ -1,43 +1,60 @@
#pragma once

#include <cstdint>

namespace Pinetime {
namespace Applications {
enum class Apps {
None,
Launcher,
Clock,
SysInfo,
FirmwareUpdate,
FirmwareValidation,
NotificationsPreview,
Notifications,
Timer,
Alarm,
FlashLight,
BatteryInfo,
Music,
Paint,
Paddle,
Twos,
HeartRate,
Navigation,
StopWatch,
Metronome,
Motion,
Steps,
PassKey,
QuickSettings,
Settings,
SettingWatchFace,
SettingTimeFormat,
SettingDisplay,
SettingWakeUp,
SettingSteps,
SettingSetDateTime,
SettingChimes,
SettingShakeThreshold,
SettingBluetooth,
Error
constexpr uint64_t rightShift(uint64_t nb) {
return UINT64_C(1) << nb;
}

enum class Apps : uint64_t {
None = rightShift(63),
Launcher = rightShift(62),
Clock = rightShift(61),
SysInfo = rightShift(60),
FirmwareUpdate = rightShift(59),
FirmwareValidation = rightShift(58),
NotificationsPreview = rightShift(57),
Notifications = rightShift(56),
Timer = rightShift(55),
Alarm = rightShift(54),
FlashLight = rightShift(53),
BatteryInfo = rightShift(52),
HeartRate = rightShift(51),
StopWatch = rightShift(50),
Steps = rightShift(49),
PassKey = rightShift(48),
QuickSettings = rightShift(47),
Settings = rightShift(46),
SettingWatchFace = rightShift(45),
SettingTimeFormat = rightShift(44),
SettingDisplay = rightShift(43),
SettingWakeUp = rightShift(42),
SettingSteps = rightShift(41),
SettingSetDateTime = rightShift(40),
SettingChimes = rightShift(39),
SettingShakeThreshold = rightShift(38),
SettingBluetooth = rightShift(37),
Error = rightShift(36),

Music = rightShift(0),
Paint = rightShift(1),
Paddle = rightShift(2),
Twos = rightShift(3),
Navigation = rightShift(4),
Metronome = rightShift(5),
Motion = rightShift(6),
};

#ifndef DISABLED_APPS
constexpr uint64_t disabledApps = static_cast<uint64_t>(Apps::Motion);
#else
constexpr uint64_t disabledApps = DISABLED_APPS;
#endif

constexpr bool isDisabled(Apps app) {
return disabledApps & static_cast<uint64_t>(app);
}
}
}
33 changes: 24 additions & 9 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "displayapp/DisplayApp.h"
#include <displayapp/Apps.h>
#include <libraries/log/nrf_log.h>
#include "displayapp/screens/HeartRate.h"
#include "displayapp/screens/Motion.h"
Expand Down Expand Up @@ -363,9 +364,6 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen =
std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, bleController, dateTimeController);
break;
case Apps::Motion:
// currentScreen = std::make_unique<Screens::Motion>(motionController);
// break;
case Apps::None:
case Apps::Clock:
currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
Expand Down Expand Up @@ -476,25 +474,42 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::StopWatch>(*systemTask);
break;
case Apps::Twos:
currentScreen = std::make_unique<Screens::Twos>();
if constexpr (!(disabledApps & static_cast<uint64_t>(Apps::Twos))) {
currentScreen = std::make_unique<Screens::Twos>();
}
break;
case Apps::Paint:
currentScreen = std::make_unique<Screens::InfiniPaint>(lvgl, motorController);
if constexpr (!isDisabled(Apps::Paint)) {
currentScreen = std::make_unique<Screens::InfiniPaint>(lvgl, motorController);
}
break;
case Apps::Paddle:
currentScreen = std::make_unique<Screens::Paddle>(lvgl);
if constexpr (!isDisabled(Apps::Paddle)) {
currentScreen = std::make_unique<Screens::Paddle>(lvgl);
}
break;
case Apps::Music:
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music());
if constexpr (!isDisabled(Apps::Music)) {
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music());
}
break;
case Apps::Navigation:
currentScreen = std::make_unique<Screens::Navigation>(systemTask->nimble().navigation());
if constexpr (!isDisabled(Apps::Navigation)) {
currentScreen = std::make_unique<Screens::Navigation>(systemTask->nimble().navigation());
}
break;
case Apps::HeartRate:
currentScreen = std::make_unique<Screens::HeartRate>(heartRateController, *systemTask);
break;
case Apps::Metronome:
currentScreen = std::make_unique<Screens::Metronome>(motorController, *systemTask);
if constexpr (!isDisabled(Apps::Metronome)) {
currentScreen = std::make_unique<Screens::Metronome>(motorController, *systemTask);
}
break;
case Apps::Motion:
if constexpr (!isDisabled(Apps::Motion)) {
currentScreen = std::make_unique<Screens::Motion>(motionController);
}
break;
case Apps::Steps:
currentScreen = std::make_unique<Screens::Steps>(motionController, settingsController);
Expand Down
18 changes: 8 additions & 10 deletions src/displayapp/screens/ApplicationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ namespace Pinetime {
{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},
{isDisabled(Apps::Music) ? Symbols::none : Symbols::music, isDisabled(Apps::Music) ? Apps::None : Apps::Music},

{isDisabled(Apps::Paint) ? Symbols::none : Symbols::paintbrush, isDisabled(Apps::Paint) ? Apps::None : Apps::Paint},
{isDisabled(Apps::Paddle) ? Symbols::none : Symbols::paddle, isDisabled(Apps::Paddle) ? Apps::None : Apps::Paddle},
{isDisabled(Apps::Twos) ? Symbols::none : "2", isDisabled(Apps::Twos) ? Apps::None : Apps::Twos},
{isDisabled(Apps::Metronome) ? Symbols::none : Symbols::drum, isDisabled(Apps::Metronome) ? Apps::None : Apps::Metronome},
{isDisabled(Apps::Navigation) ? Symbols::none : Symbols::map, isDisabled(Apps::Navigation) ? Apps::None : Apps::Navigation},
{isDisabled(Apps::Motion) ? Symbols::none : "M", isDisabled(Apps::Motion) ? Apps::None : Apps::Motion},
}};
ScreenList<nScreens> screens;
};
Expand Down