summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BootloaderVersion.h3
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/Version.h.in2
-rw-r--r--src/buttonhandler/ButtonActions.h7
-rw-r--r--src/buttonhandler/ButtonHandler.cpp78
-rw-r--r--src/buttonhandler/ButtonHandler.h24
-rw-r--r--src/components/alarm/AlarmController.cpp2
-rw-r--r--src/components/battery/BatteryController.cpp2
-rw-r--r--src/components/ble/AlertNotificationClient.cpp4
-rw-r--r--src/components/ble/AlertNotificationClient.h2
-rw-r--r--src/components/ble/AlertNotificationService.cpp4
-rw-r--r--src/components/ble/BatteryInformationService.cpp2
-rw-r--r--src/components/ble/BleController.cpp2
-rw-r--r--src/components/ble/CurrentTimeClient.cpp2
-rw-r--r--src/components/ble/CurrentTimeClient.h2
-rw-r--r--src/components/ble/CurrentTimeService.cpp2
-rw-r--r--src/components/ble/DeviceInformationService.cpp2
-rw-r--r--src/components/ble/DeviceInformationService.h1
-rw-r--r--src/components/ble/DfuService.cpp2
-rw-r--r--src/components/ble/HeartRateService.cpp2
-rw-r--r--src/components/ble/ImmediateAlertService.cpp4
-rw-r--r--src/components/ble/MotionService.cpp6
-rw-r--r--src/components/ble/MusicService.cpp2
-rw-r--r--src/components/ble/NavigationService.cpp2
-rw-r--r--src/components/ble/NimbleController.cpp2
-rw-r--r--src/components/ble/NimbleController.h26
-rw-r--r--src/components/ble/NotificationManager.cpp2
-rw-r--r--src/components/ble/ServiceDiscovery.cpp4
-rw-r--r--src/components/brightness/BrightnessController.cpp2
-rw-r--r--src/components/datetime/DateTimeController.cpp2
-rw-r--r--src/components/firmwarevalidator/FirmwareValidator.cpp2
-rw-r--r--src/components/fs/FS.cpp2
-rw-r--r--src/components/gfx/Gfx.cpp2
-rw-r--r--src/components/heartrate/Biquad.cpp2
-rw-r--r--src/components/heartrate/HeartRateController.cpp2
-rw-r--r--src/components/heartrate/Ppg.cpp2
-rw-r--r--src/components/heartrate/Ppg.h4
-rw-r--r--src/components/heartrate/Ptagc.cpp2
-rw-r--r--src/components/motion/MotionController.cpp2
-rw-r--r--src/components/motor/MotorController.cpp2
-rw-r--r--src/components/rle/RleDecoder.cpp2
-rw-r--r--src/components/settings/Settings.cpp2
-rw-r--r--src/components/timer/TimerController.cpp2
-rw-r--r--src/displayapp/Colors.cpp2
-rw-r--r--src/displayapp/Colors.h2
-rw-r--r--src/displayapp/DisplayApp.cpp30
-rw-r--r--src/displayapp/DisplayApp.h8
-rw-r--r--src/displayapp/DisplayAppRecovery.cpp6
-rw-r--r--src/displayapp/DisplayAppRecovery.h10
-rw-r--r--src/displayapp/DummyLittleVgl.h6
-rw-r--r--src/displayapp/LittleVgl.cpp4
-rw-r--r--src/displayapp/Messages.h4
-rw-r--r--src/displayapp/lv_pinetime_theme.c2
-rw-r--r--src/displayapp/screens/Alarm.cpp6
-rw-r--r--src/displayapp/screens/Alarm.h8
-rw-r--r--src/displayapp/screens/ApplicationList.cpp8
-rw-r--r--src/displayapp/screens/ApplicationList.h4
-rw-r--r--src/displayapp/screens/BatteryIcon.cpp4
-rw-r--r--src/displayapp/screens/BatteryIcon.h1
-rw-r--r--src/displayapp/screens/BatteryInfo.cpp4
-rw-r--r--src/displayapp/screens/BatteryInfo.h4
-rw-r--r--src/displayapp/screens/BleIcon.cpp4
-rw-r--r--src/displayapp/screens/Brightness.cpp2
-rw-r--r--src/displayapp/screens/Brightness.h2
-rw-r--r--src/displayapp/screens/Clock.cpp10
-rw-r--r--src/displayapp/screens/Clock.h2
-rw-r--r--src/displayapp/screens/DropDownDemo.cpp4
-rw-r--r--src/displayapp/screens/DropDownDemo.h2
-rw-r--r--src/displayapp/screens/Error.cpp2
-rw-r--r--src/displayapp/screens/Error.h2
-rw-r--r--src/displayapp/screens/FirmwareUpdate.cpp4
-rw-r--r--src/displayapp/screens/FirmwareUpdate.h2
-rw-r--r--src/displayapp/screens/FirmwareValidation.cpp4
-rw-r--r--src/displayapp/screens/FirmwareValidation.h2
-rw-r--r--src/displayapp/screens/FlashLight.cpp6
-rw-r--r--src/displayapp/screens/FlashLight.h2
-rw-r--r--src/displayapp/screens/HeartRate.cpp6
-rw-r--r--src/displayapp/screens/HeartRate.h6
-rw-r--r--src/displayapp/screens/InfiniPaint.cpp6
-rw-r--r--src/displayapp/screens/InfiniPaint.h3
-rw-r--r--src/displayapp/screens/Label.cpp2
-rw-r--r--src/displayapp/screens/Label.h2
-rw-r--r--src/displayapp/screens/List.cpp6
-rw-r--r--src/displayapp/screens/List.h4
-rw-r--r--src/displayapp/screens/Meter.cpp4
-rw-r--r--src/displayapp/screens/Meter.h2
-rw-r--r--src/displayapp/screens/Metronome.cpp4
-rw-r--r--src/displayapp/screens/Motion.cpp6
-rw-r--r--src/displayapp/screens/Motion.h6
-rw-r--r--src/displayapp/screens/Music.cpp6
-rw-r--r--src/displayapp/screens/Music.h2
-rw-r--r--src/displayapp/screens/Navigation.cpp4
-rw-r--r--src/displayapp/screens/Navigation.h2
-rw-r--r--src/displayapp/screens/NotificationIcon.cpp4
-rw-r--r--src/displayapp/screens/Notifications.cpp6
-rw-r--r--src/displayapp/screens/Notifications.h2
-rw-r--r--src/displayapp/screens/Paddle.cpp6
-rw-r--r--src/displayapp/screens/Paddle.h2
-rw-r--r--src/displayapp/screens/PineTimeStyle.cpp12
-rw-r--r--src/displayapp/screens/PineTimeStyle.h4
-rw-r--r--src/displayapp/screens/Screen.cpp2
-rw-r--r--src/displayapp/screens/Screen.h2
-rw-r--r--src/displayapp/screens/ScreenList.h4
-rw-r--r--src/displayapp/screens/Steps.cpp6
-rw-r--r--src/displayapp/screens/Steps.h2
-rw-r--r--src/displayapp/screens/StopWatch.cpp6
-rw-r--r--src/displayapp/screens/StopWatch.h4
-rw-r--r--src/displayapp/screens/SystemInfo.cpp32
-rw-r--r--src/displayapp/screens/SystemInfo.h4
-rw-r--r--src/displayapp/screens/Tile.cpp6
-rw-r--r--src/displayapp/screens/Tile.h4
-rw-r--r--src/displayapp/screens/Timer.cpp8
-rw-r--r--src/displayapp/screens/Timer.h4
-rw-r--r--src/displayapp/screens/Twos.cpp14
-rw-r--r--src/displayapp/screens/Twos.h2
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp12
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.h4
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp10
-rw-r--r--src/displayapp/screens/WatchFaceDigital.h4
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingPineTimeStyle.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingSetDate.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingSetTime.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingSteps.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp2
-rw-r--r--src/displayapp/screens/settings/Settings.cpp2
-rw-r--r--src/drivers/Bma421.cpp4
-rw-r--r--src/drivers/Cst816s.cpp69
-rw-r--r--src/drivers/Cst816s.h9
-rw-r--r--src/drivers/DebugPins.cpp2
-rw-r--r--src/drivers/Hrs3300.cpp2
-rw-r--r--src/drivers/Hrs3300.h2
-rw-r--r--src/drivers/InternalFlash.cpp2
-rw-r--r--src/drivers/PinMap.h1
-rw-r--r--src/drivers/Spi.cpp2
-rw-r--r--src/drivers/Spi.h2
-rw-r--r--src/drivers/SpiMaster.cpp2
-rw-r--r--src/drivers/SpiNorFlash.cpp4
-rw-r--r--src/drivers/St7789.cpp4
-rw-r--r--src/drivers/TwiMaster.cpp2
-rw-r--r--src/drivers/Watchdog.cpp2
-rw-r--r--src/heartratetask/HeartRateTask.cpp2
-rw-r--r--src/logging/DummyLogger.h2
-rw-r--r--src/logging/NrfLogger.cpp2
-rw-r--r--src/logging/NrfLogger.h2
-rw-r--r--src/main.cpp23
-rw-r--r--src/systemtask/Messages.h3
-rw-r--r--src/systemtask/SystemTask.cpp86
-rw-r--r--src/systemtask/SystemTask.h15
-rw-r--r--src/touchhandler/TouchHandler.cpp2
153 files changed, 564 insertions, 330 deletions
diff --git a/src/BootloaderVersion.h b/src/BootloaderVersion.h
index f8127414..309c23c3 100644
--- a/src/BootloaderVersion.h
+++ b/src/BootloaderVersion.h
@@ -1,5 +1,8 @@
#pragma once
+#include <cstdint>
+#include <cstddef>
+
namespace Pinetime {
class BootloaderVersion {
public:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a839e080..e727b2b0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -507,6 +507,7 @@ list(APPEND SOURCE_FILES
components/heartrate/Ptagc.cpp
components/heartrate/HeartRateController.cpp
+ buttonhandler/ButtonHandler.cpp
touchhandler/TouchHandler.cpp
)
@@ -567,6 +568,7 @@ list(APPEND RECOVERY_SOURCE_FILES
components/heartrate/Ptagc.cpp
components/motor/MotorController.cpp
components/fs/FS.cpp
+ buttonhandler/ButtonHandler.cpp
touchhandler/TouchHandler.cpp
)
@@ -681,6 +683,7 @@ set(INCLUDE_FILES
components/heartrate/Ptagc.h
components/heartrate/HeartRateController.h
components/motor/MotorController.h
+ buttonhandler/ButtonHandler.h
touchhandler/TouchHandler.h
)
diff --git a/src/Version.h.in b/src/Version.h.in
index 8cd39c96..0d6219c0 100644
--- a/src/Version.h.in
+++ b/src/Version.h.in
@@ -2,6 +2,8 @@
@VERSION_EDIT_WARNING@
+#include <cstdint>
+
namespace Pinetime {
class Version {
public:
diff --git a/src/buttonhandler/ButtonActions.h b/src/buttonhandler/ButtonActions.h
new file mode 100644
index 00000000..21be441b
--- /dev/null
+++ b/src/buttonhandler/ButtonActions.h
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace Pinetime {
+ namespace Controllers {
+ enum class ButtonActions { None, Click, DoubleClick, LongPress, LongerPress };
+ }
+}
diff --git a/src/buttonhandler/ButtonHandler.cpp b/src/buttonhandler/ButtonHandler.cpp
new file mode 100644
index 00000000..91e8bbd0
--- /dev/null
+++ b/src/buttonhandler/ButtonHandler.cpp
@@ -0,0 +1,78 @@
+#include "ButtonHandler.h"
+
+using namespace Pinetime::Controllers;
+
+void ButtonTimerCallback(TimerHandle_t xTimer) {
+ auto* sysTask = static_cast<Pinetime::System::SystemTask*>(pvTimerGetTimerID(xTimer));
+ sysTask->PushMessage(Pinetime::System::Messages::HandleButtonTimerEvent);
+}
+
+void ButtonHandler::Init(Pinetime::System::SystemTask* systemTask) {
+ buttonTimer = xTimerCreate("buttonTimer", 0, pdFALSE, systemTask, ButtonTimerCallback);
+}
+
+ButtonActions ButtonHandler::HandleEvent(Events event) {
+ static constexpr TickType_t doubleClickTime = pdMS_TO_TICKS(200);
+ static constexpr TickType_t longPressTime = pdMS_TO_TICKS(400);
+ static constexpr TickType_t longerPressTime = pdMS_TO_TICKS(2000);
+
+ if (event == Events::Press) {
+ buttonPressed = true;
+ } else if (event == Events::Release) {
+ releaseTime = xTaskGetTickCount();
+ buttonPressed = false;
+ }
+
+ switch (state) {
+ case States::Idle:
+ if (event == Events::Press) {
+ xTimerChangePeriod(buttonTimer, doubleClickTime, 0);
+ xTimerStart(buttonTimer, 0);
+ state = States::Pressed;
+ }
+ break;
+ case States::Pressed:
+ if (event == Events::Press) {
+ if (xTaskGetTickCount() - releaseTime < doubleClickTime) {
+ xTimerStop(buttonTimer, 0);
+ state = States::Idle;
+ return ButtonActions::DoubleClick;
+ }
+ } else if (event == Events::Release) {
+ xTimerChangePeriod(buttonTimer, doubleClickTime, 0);
+ xTimerStart(buttonTimer, 0);
+ } else if (event == Events::Timer) {
+ if (buttonPressed) {
+ xTimerChangePeriod(buttonTimer, longPressTime - doubleClickTime, 0);
+ xTimerStart(buttonTimer, 0);
+ state = States::Holding;
+ } else {
+ state = States::Idle;
+ return ButtonActions::Click;
+ }
+ }
+ break;
+ case States::Holding:
+ if (event == Events::Release) {
+ xTimerStop(buttonTimer, 0);
+ state = States::Idle;
+ return ButtonActions::Click;
+ } else if (event == Events::Timer) {
+ xTimerChangePeriod(buttonTimer, longerPressTime - longPressTime - doubleClickTime, 0);
+ xTimerStart(buttonTimer, 0);
+ state = States::LongHeld;
+ return ButtonActions::LongPress;
+ }
+ break;
+ case States::LongHeld:
+ if (event == Events::Release) {
+ xTimerStop(buttonTimer, 0);
+ state = States::Idle;
+ } else if (event == Events::Timer) {
+ state = States::Idle;
+ return ButtonActions::LongerPress;
+ }
+ break;
+ }
+ return ButtonActions::None;
+}
diff --git a/src/buttonhandler/ButtonHandler.h b/src/buttonhandler/ButtonHandler.h
new file mode 100644
index 00000000..44b20f19
--- /dev/null
+++ b/src/buttonhandler/ButtonHandler.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "ButtonActions.h"
+#include "systemtask/SystemTask.h"
+#include <FreeRTOS.h>
+#include <timers.h>
+
+namespace Pinetime {
+ namespace Controllers {
+ class ButtonHandler {
+ public:
+ enum class Events : uint8_t { Press, Release, Timer };
+ void Init(Pinetime::System::SystemTask* systemTask);
+ ButtonActions HandleEvent(Events event);
+
+ private:
+ enum class States : uint8_t { Idle, Pressed, Holding, LongHeld };
+ TickType_t releaseTime = 0;
+ TimerHandle_t buttonTimer;
+ bool buttonPressed = false;
+ States state = States::Idle;
+ };
+ }
+}
diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp
index 67ca05a9..28b328d5 100644
--- a/src/components/alarm/AlarmController.cpp
+++ b/src/components/alarm/AlarmController.cpp
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "AlarmController.h"
+#include "components/alarm/AlarmController.h"
#include "systemtask/SystemTask.h"
#include "app_timer.h"
#include "task.h"
diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp
index e807f033..c875cb8d 100644
--- a/src/components/battery/BatteryController.cpp
+++ b/src/components/battery/BatteryController.cpp
@@ -1,4 +1,4 @@
-#include "BatteryController.h"
+#include "components/battery/BatteryController.h"
#include "drivers/PinMap.h"
#include <hal/nrf_gpio.h>
#include <nrfx_saadc.h>
diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp
index 5e5c25cf..0f850874 100644
--- a/src/components/ble/AlertNotificationClient.cpp
+++ b/src/components/ble/AlertNotificationClient.cpp
@@ -1,6 +1,6 @@
-#include "AlertNotificationClient.h"
+#include "components/ble/AlertNotificationClient.h"
#include <algorithm>
-#include "NotificationManager.h"
+#include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/AlertNotificationClient.h b/src/components/ble/AlertNotificationClient.h
index dfba8143..2d6a3873 100644
--- a/src/components/ble/AlertNotificationClient.h
+++ b/src/components/ble/AlertNotificationClient.h
@@ -7,7 +7,7 @@
#include <host/ble_gap.h>
#undef max
#undef min
-#include "BleClient.h"
+#include "components/ble/BleClient.h"
namespace Pinetime {
diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp
index 56fc595f..f616cce8 100644
--- a/src/components/ble/AlertNotificationService.cpp
+++ b/src/components/ble/AlertNotificationService.cpp
@@ -1,8 +1,8 @@
-#include "AlertNotificationService.h"
+#include "components/ble/AlertNotificationService.h"
#include <hal/nrf_rtc.h>
#include <cstring>
#include <algorithm>
-#include "NotificationManager.h"
+#include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/BatteryInformationService.cpp b/src/components/ble/BatteryInformationService.cpp
index 29178667..9a3f86f5 100644
--- a/src/components/ble/BatteryInformationService.cpp
+++ b/src/components/ble/BatteryInformationService.cpp
@@ -1,5 +1,5 @@
+#include "components/ble/BatteryInformationService.h"
#include <nrf_log.h>
-#include "BatteryInformationService.h"
#include "components/battery/BatteryController.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp
index 7c14aeb7..a80c9719 100644
--- a/src/components/ble/BleController.cpp
+++ b/src/components/ble/BleController.cpp
@@ -1,4 +1,4 @@
-#include "BleController.h"
+#include "components/ble/BleController.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/CurrentTimeClient.cpp b/src/components/ble/CurrentTimeClient.cpp
index 90d1f0c7..dd8171b9 100644
--- a/src/components/ble/CurrentTimeClient.cpp
+++ b/src/components/ble/CurrentTimeClient.cpp
@@ -1,4 +1,4 @@
-#include "CurrentTimeClient.h"
+#include "components/ble/CurrentTimeClient.h"
#include <hal/nrf_rtc.h>
#include <nrf_log.h>
#include "components/datetime/DateTimeController.h"
diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h
index 6424c035..9e48be79 100644
--- a/src/components/ble/CurrentTimeClient.h
+++ b/src/components/ble/CurrentTimeClient.h
@@ -5,7 +5,7 @@
#undef max
#undef min
#include <cstdint>
-#include "BleClient.h"
+#include "components/ble/BleClient.h"
namespace Pinetime {
namespace Controllers {
diff --git a/src/components/ble/CurrentTimeService.cpp b/src/components/ble/CurrentTimeService.cpp
index eefb7ec1..e509aeaf 100644
--- a/src/components/ble/CurrentTimeService.cpp
+++ b/src/components/ble/CurrentTimeService.cpp
@@ -1,4 +1,4 @@
-#include "CurrentTimeService.h"
+#include "components/ble/CurrentTimeService.h"
#include <hal/nrf_rtc.h>
#include <nrf_log.h>
diff --git a/src/components/ble/DeviceInformationService.cpp b/src/components/ble/DeviceInformationService.cpp
index 778d6e35..0f47c90f 100644
--- a/src/components/ble/DeviceInformationService.cpp
+++ b/src/components/ble/DeviceInformationService.cpp
@@ -1,4 +1,4 @@
-#include "DeviceInformationService.h"
+#include "components/ble/DeviceInformationService.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/DeviceInformationService.h b/src/components/ble/DeviceInformationService.h
index 54b3e961..a269afb4 100644
--- a/src/components/ble/DeviceInformationService.h
+++ b/src/components/ble/DeviceInformationService.h
@@ -1,4 +1,5 @@
#pragma once
+#include <cstdint>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp
index 3d6416fa..71dcc7e6 100644
--- a/src/components/ble/DfuService.cpp
+++ b/src/components/ble/DfuService.cpp
@@ -1,4 +1,4 @@
-#include "DfuService.h"
+#include "components/ble/DfuService.h"
#include <cstring>
#include "components/ble/BleController.h"
#include "drivers/SpiNorFlash.h"
diff --git a/src/components/ble/HeartRateService.cpp b/src/components/ble/HeartRateService.cpp
index 75a038a2..f178af79 100644
--- a/src/components/ble/HeartRateService.cpp
+++ b/src/components/ble/HeartRateService.cpp
@@ -1,4 +1,4 @@
-#include "HeartRateService.h"
+#include "components/ble/HeartRateService.h"
#include "components/heartrate/HeartRateController.h"
#include "systemtask/SystemTask.h"
diff --git a/src/components/ble/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp
index 17ed1a96..c80b3783 100644
--- a/src/components/ble/ImmediateAlertService.cpp
+++ b/src/components/ble/ImmediateAlertService.cpp
@@ -1,6 +1,6 @@
-#include "ImmediateAlertService.h"
+#include "components/ble/ImmediateAlertService.h"
#include <cstring>
-#include "NotificationManager.h"
+#include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp
index 50693057..6381915d 100644
--- a/src/components/ble/MotionService.cpp
+++ b/src/components/ble/MotionService.cpp
@@ -1,11 +1,11 @@
-#include "MotionService.h"
+#include "components/ble/MotionService.h"
#include "components/motion/MotionController.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
namespace {
- // 0002yyxx-78fc-48fe-8e23-433b3a1942d0
+ // 0003yyxx-78fc-48fe-8e23-433b3a1942d0
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
return ble_uuid128_t{
.u = {.type = BLE_UUID_TYPE_128},
@@ -13,7 +13,7 @@ namespace {
};
}
- // 00020000-78fc-48fe-8e23-433b3a1942d0
+ // 00030000-78fc-48fe-8e23-433b3a1942d0
constexpr ble_uuid128_t BaseUuid() {
return CharUuid(0x00, 0x00);
}
diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp
index 74fe9522..3457ce4c 100644
--- a/src/components/ble/MusicService.cpp
+++ b/src/components/ble/MusicService.cpp
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "MusicService.h"
+#include "components/ble/MusicService.h"
#include "systemtask/SystemTask.h"
namespace {
diff --git a/src/components/ble/NavigationService.cpp b/src/components/ble/NavigationService.cpp
index b49148d2..5418b9e5 100644
--- a/src/components/ble/NavigationService.cpp
+++ b/src/components/ble/NavigationService.cpp
@@ -16,7 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "NavigationService.h"
+#include "components/ble/NavigationService.h"
#include "systemtask/SystemTask.h"
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 1bcae1bc..43a8b0d6 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -1,4 +1,4 @@
-#include "NimbleController.h"
+#include "components/ble/NimbleController.h"
#include <hal/nrf_rtc.h>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index 76f89ba8..895b87f2 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -7,19 +7,19 @@
#include <host/ble_gap.h>
#undef max
#undef min
-#include "AlertNotificationClient.h"
-#include "AlertNotificationService.h"
-#include "BatteryInformationService.h"
-#include "CurrentTimeClient.h"
-#include "CurrentTimeService.h"
-#include "DeviceInformationService.h"
-#include "DfuService.h"
-#include "ImmediateAlertService.h"
-#include "MusicService.h"
-#include "NavigationService.h"
-#include "ServiceDiscovery.h"
-#include "HeartRateService.h"
-#include "MotionService.h"
+#include "components/ble/AlertNotificationClient.h"
+#include "components/ble/AlertNotificationService.h"
+#include "components/ble/BatteryInformationService.h"
+#include "components/ble/CurrentTimeClient.h"
+#include "components/ble/CurrentTimeService.h"
+#include "components/ble/DeviceInformationService.h"
+#include "components/ble/DfuService.h"
+#include "components/ble/ImmediateAlertService.h"
+#include "components/ble/MusicService.h"
+#include "components/ble/NavigationService.h"
+#include "components/ble/ServiceDiscovery.h"
+#include "components/ble/HeartRateService.h"
+#include "components/ble/MotionService.h"
namespace Pinetime {
namespace Drivers {
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp
index 7ffed300..ec99c4ed 100644
--- a/src/components/ble/NotificationManager.cpp
+++ b/src/components/ble/NotificationManager.cpp
@@ -1,4 +1,4 @@
-#include "NotificationManager.h"
+#include "components/ble/NotificationManager.h"
#include <cstring>
#include <algorithm>
diff --git a/src/components/ble/ServiceDiscovery.cpp b/src/components/ble/ServiceDiscovery.cpp
index b36b241c..03bcfeb4 100644
--- a/src/components/ble/ServiceDiscovery.cpp
+++ b/src/components/ble/ServiceDiscovery.cpp
@@ -1,6 +1,6 @@
-#include "ServiceDiscovery.h"
+#include "components/ble/ServiceDiscovery.h"
#include <libraries/log/nrf_log.h>
-#include "BleClient.h"
+#include "components/ble/BleClient.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp
index 6c524679..2d9f980a 100644
--- a/src/components/brightness/BrightnessController.cpp
+++ b/src/components/brightness/BrightnessController.cpp
@@ -1,4 +1,4 @@
-#include "BrightnessController.h"
+#include "components/brightness/BrightnessController.h"
#include <hal/nrf_gpio.h>
#include "displayapp/screens/Symbols.h"
#include "drivers/PinMap.h"
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp
index e9c5d870..4ac9e1f1 100644
--- a/src/components/datetime/DateTimeController.cpp
+++ b/src/components/datetime/DateTimeController.cpp
@@ -1,4 +1,4 @@
-#include "DateTimeController.h"
+#include "components/datetime/DateTimeController.h"
#include <date/date.h>
#include <libraries/log/nrf_log.h>
#include <systemtask/SystemTask.h>
diff --git a/src/components/firmwarevalidator/FirmwareValidator.cpp b/src/components/firmwarevalidator/FirmwareValidator.cpp
index 68e66d37..5a63b6b4 100644
--- a/src/components/firmwarevalidator/FirmwareValidator.cpp
+++ b/src/components/firmwarevalidator/FirmwareValidator.cpp
@@ -1,4 +1,4 @@
-#include "FirmwareValidator.h"
+#include "components/firmwarevalidator/FirmwareValidator.h"
#include <hal/nrf_rtc.h>
#include "drivers/InternalFlash.h"
diff --git a/src/components/fs/FS.cpp b/src/components/fs/FS.cpp
index 857e6bf9..1cad4f02 100644
--- a/src/components/fs/FS.cpp
+++ b/src/components/fs/FS.cpp
@@ -1,4 +1,4 @@
-#include "FS.h"
+#include "components/fs/FS.h"
#include <cstring>
#include <littlefs/lfs.h>
#include <lvgl/lvgl.h>
diff --git a/src/components/gfx/Gfx.cpp b/src/components/gfx/Gfx.cpp
index cf271032..3eaaa3fe 100644
--- a/src/components/gfx/Gfx.cpp
+++ b/src/components/gfx/Gfx.cpp
@@ -1,4 +1,4 @@
-#include "Gfx.h"
+#include "components/gfx/Gfx.h"
#include "drivers/St7789.h"
using namespace Pinetime::Components;
diff --git a/src/components/heartrate/Biquad.cpp b/src/components/heartrate/Biquad.cpp
index 0341eda6..b7edd403 100644
--- a/src/components/heartrate/Biquad.cpp
+++ b/src/components/heartrate/Biquad.cpp
@@ -4,7 +4,7 @@
C++ port Copyright (C) 2021 Jean-François Milants
*/
-#include "Biquad.h"
+#include "components/heartrate/Biquad.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/heartrate/HeartRateController.cpp b/src/components/heartrate/HeartRateController.cpp
index 716813b3..e0d69272 100644
--- a/src/components/heartrate/HeartRateController.cpp
+++ b/src/components/heartrate/HeartRateController.cpp
@@ -1,4 +1,4 @@
-#include "HeartRateController.h"
+#include "components/heartrate/HeartRateController.h"
#include <heartratetask/HeartRateTask.h>
#include <systemtask/SystemTask.h>
diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp
index fcba3815..a5d83696 100644
--- a/src/components/heartrate/Ppg.cpp
+++ b/src/components/heartrate/Ppg.cpp
@@ -4,9 +4,9 @@
C++ port Copyright (C) 2021 Jean-François Milants
*/
+#include "components/heartrate/Ppg.h"
#include <vector>
#include <nrf_log.h>
-#include "Ppg.h"
using namespace Pinetime::Controllers;
/** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */
diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h
index 00014162..ed79b082 100644
--- a/src/components/heartrate/Ppg.h
+++ b/src/components/heartrate/Ppg.h
@@ -1,8 +1,8 @@
#pragma once
#include <array>
-#include "Biquad.h"
-#include "Ptagc.h"
+#include "components/heartrate/Biquad.h"
+#include "components/heartrate/Ptagc.h"
namespace Pinetime {
namespace Controllers {
diff --git a/src/components/heartrate/Ptagc.cpp b/src/components/heartrate/Ptagc.cpp
index e358371e..1c60bc23 100644
--- a/src/components/heartrate/Ptagc.cpp
+++ b/src/components/heartrate/Ptagc.cpp
@@ -4,8 +4,8 @@
C++ port Copyright (C) 2021 Jean-François Milants
*/
+#include "components/heartrate/Ptagc.h"
#include <cmath>
-#include "Ptagc.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index a2384d79..cae49105 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -1,4 +1,4 @@
-#include "MotionController.h"
+#include "components/motion/MotionController.h"
using namespace Pinetime::Controllers;
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp
index f596c718..c794a02c 100644
--- a/src/components/motor/MotorController.cpp
+++ b/src/components/motor/MotorController.cpp
@@ -1,4 +1,4 @@
-#include "MotorController.h"
+#include "components/motor/MotorController.h"
#include <hal/nrf_gpio.h>
#include "systemtask/SystemTask.h"
#include "app_timer.h"
diff --git a/src/components/rle/RleDecoder.cpp b/src/components/rle/RleDecoder.cpp
index df2bcb6b..19ebfec0 100644
--- a/src/components/rle/RleDecoder.cpp
+++ b/src/components/rle/RleDecoder.cpp
@@ -1,4 +1,4 @@
-#include "RleDecoder.h"
+#include "components/rle/RleDecoder.h"
using namespace Pinetime::Tools;
diff --git a/src/components/settings/Settings.cpp b/src/components/settings/Settings.cpp
index 37c09f91..ef73ad1c 100644
--- a/src/components/settings/Settings.cpp
+++ b/src/components/settings/Settings.cpp
@@ -1,4 +1,4 @@
-#include "Settings.h"
+#include "components/settings/Settings.h"
#include <cstdlib>
#include <cstring>
diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/TimerController.cpp
index 8d5f5c33..79e44d6f 100644
--- a/src/components/timer/TimerController.cpp
+++ b/src/components/timer/TimerController.cpp
@@ -2,7 +2,7 @@
// Created by florian on 16.05.21.
//
-#include "TimerController.h"
+#include "components/timer/TimerController.h"
#include "systemtask/SystemTask.h"
#include "app_timer.h"
#include "task.h"
diff --git a/src/displayapp/Colors.cpp b/src/displayapp/Colors.cpp
index f45f0722..93b1aa06 100644
--- a/src/displayapp/Colors.cpp
+++ b/src/displayapp/Colors.cpp
@@ -1,4 +1,4 @@
-#include "Colors.h"
+#include "displayapp/Colors.h"
using namespace Pinetime::Applications;
using namespace Pinetime::Controllers;
diff --git a/src/displayapp/Colors.h b/src/displayapp/Colors.h
index 9db7dd20..43e2b801 100644
--- a/src/displayapp/Colors.h
+++ b/src/displayapp/Colors.h
@@ -1,7 +1,7 @@
#pragma once
#include <lvgl/src/lv_misc/lv_color.h>
-#include <components/settings/Settings.h>
+#include "components/settings/Settings.h"
namespace Pinetime {
namespace Applications {
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index abe5851e..38ce930a 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -1,9 +1,9 @@
-#include "DisplayApp.h"
+#include "displayapp/DisplayApp.h"
#include <libraries/log/nrf_log.h>
-#include <displayapp/screens/HeartRate.h>
-#include <displayapp/screens/Motion.h>
-#include <displayapp/screens/Timer.h>
-#include <displayapp/screens/Alarm.h>
+#include "displayapp/screens/HeartRate.h"
+#include "displayapp/screens/Motion.h"
+#include "displayapp/screens/Timer.h"
+#include "displayapp/screens/Alarm.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/datetime/DateTimeController.h"
@@ -260,6 +260,26 @@ void DisplayApp::Refresh() {
}
}
break;
+ case Messages::ButtonLongPressed:
+ if (currentApp != Apps::Clock) {
+ if (currentApp == Apps::Notifications) {
+ LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Up);
+ } else if (currentApp == Apps::QuickSettings) {
+ LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim);
+ } else {
+ LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down);
+ }
+ }
+ break;
+ case Messages::ButtonLongerPressed:
+ // Create reboot app and open it instead
+ LoadApp(Apps::SysInfo, DisplayApp::FullRefreshDirections::Up);
+ break;
+ case Messages::ButtonDoubleClicked:
+ if (currentApp != Apps::Notifications && currentApp != Apps::NotificationsPreview) {
+ LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
+ }
+ break;
case Messages::BleFirmwareUpdateStarted:
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index a87cab0b..39fe6314 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -5,9 +5,9 @@
#include <task.h>
#include <memory>
#include <systemtask/Messages.h>
-#include "Apps.h"
-#include "LittleVgl.h"
-#include "TouchEvents.h"
+#include "displayapp/Apps.h"
+#include "displayapp/LittleVgl.h"
+#include "displayapp/TouchEvents.h"
#include "components/brightness/BrightnessController.h"
#include "components/motor/MotorController.h"
#include "components/firmwarevalidator/FirmwareValidator.h"
@@ -17,7 +17,7 @@
#include "components/alarm/AlarmController.h"
#include "touchhandler/TouchHandler.h"
-#include "Messages.h"
+#include "displayapp/Messages.h"
#include "BootErrors.h"
namespace Pinetime {
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp
index a42d81a2..fd7017a4 100644
--- a/src/displayapp/DisplayAppRecovery.cpp
+++ b/src/displayapp/DisplayAppRecovery.cpp
@@ -1,9 +1,9 @@
-#include "DisplayAppRecovery.h"
+#include "displayapp/DisplayAppRecovery.h"
#include <FreeRTOS.h>
#include <task.h>
#include <libraries/log/nrf_log.h>
-#include <components/rle/RleDecoder.h>
-#include <touchhandler/TouchHandler.h>
+#include "components/rle/RleDecoder.h"
+#include "touchhandler/TouchHandler.h"
#include "displayapp/icons/infinitime/infinitime-nb.c"
#include "components/ble/BleController.h"
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index 9f5fb130..86e956d1 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -10,11 +10,11 @@
#include <date/date.h>
#include <drivers/Watchdog.h>
#include <components/motor/MotorController.h>
-#include <BootErrors.h>
-#include "TouchEvents.h"
-#include "Apps.h"
-#include "Messages.h"
-#include "DummyLittleVgl.h"
+#include "BootErrors.h"
+#include "displayapp/TouchEvents.h"
+#include "displayapp/Apps.h"
+#include "displayapp/Messages.h"
+#include "displayapp/DummyLittleVgl.h"
namespace Pinetime {
namespace Drivers {
diff --git a/src/displayapp/DummyLittleVgl.h b/src/displayapp/DummyLittleVgl.h
index 1db51343..47c9e021 100644
--- a/src/displayapp/DummyLittleVgl.h
+++ b/src/displayapp/DummyLittleVgl.h
@@ -1,8 +1,8 @@
#pragma once
-#include <libs/lvgl/src/lv_core/lv_style.h>
-#include <libs/lvgl/src/lv_themes/lv_theme.h>
-#include <libs/lvgl/src/lv_hal/lv_hal.h>
+#include <lvgl/src/lv_core/lv_style.h>
+#include <lvgl/src/lv_themes/lv_theme.h>
+#include <lvgl/src/lv_hal/lv_hal.h>
#include <drivers/St7789.h>
#include <drivers/Cst816s.h>
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp
index 2bd5e57b..e7b58c16 100644
--- a/src/displayapp/LittleVgl.cpp
+++ b/src/displayapp/LittleVgl.cpp
@@ -1,5 +1,5 @@
-#include "LittleVgl.h"
-#include "lv_pinetime_theme.h"
+#include "displayapp/LittleVgl.h"
+#include "displayapp/lv_pinetime_theme.h"
#include <FreeRTOS.h>
#include <task.h>
diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index d48b646f..29e09eb3 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -1,4 +1,5 @@
#pragma once
+#include <cstdint>
namespace Pinetime {
namespace Applications {
namespace Display {
@@ -9,6 +10,9 @@ namespace Pinetime {
UpdateBleConnection,
TouchEvent,
ButtonPushed,
+ ButtonLongPressed,
+ ButtonLongerPressed,
+ ButtonDoubleClicked,
NewNotification,
TimerDone,
BleFirmwareUpdateStarted,
diff --git a/src/displayapp/lv_pinetime_theme.c b/src/displayapp/lv_pinetime_theme.c
index 1b8b1980..1780e64b 100644
--- a/src/displayapp/lv_pinetime_theme.c
+++ b/src/displayapp/lv_pinetime_theme.c
@@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
-#include "lv_pinetime_theme.h"
+#include "displayapp/lv_pinetime_theme.h"
/*********************
* DEFINES
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp
index 6b45a36e..772e5d45 100644
--- a/src/displayapp/screens/Alarm.cpp
+++ b/src/displayapp/screens/Alarm.cpp
@@ -15,9 +15,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "Alarm.h"
-#include "Screen.h"
-#include "Symbols.h"
+#include "displayapp/screens/Alarm.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
using Pinetime::Controllers::AlarmController;
diff --git a/src/displayapp/screens/Alarm.h b/src/displayapp/screens/Alarm.h
index 32a14d2f..4b301ce1 100644
--- a/src/displayapp/screens/Alarm.h
+++ b/src/displayapp/screens/Alarm.h
@@ -17,9 +17,9 @@
*/
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "systemtask/SystemTask.h"
-#include "../LittleVgl.h"
+#include "displayapp/LittleVgl.h"
#include "components/alarm/AlarmController.h"
namespace Pinetime {
@@ -40,7 +40,9 @@ namespace Pinetime {
Controllers::AlarmController& alarmController;
lv_obj_t *time, *btnEnable, *txtEnable, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown,
- *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnMessage, *txtMessage, *btnInfo, *txtInfo;
+ *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo;
+ lv_obj_t* txtMessage = nullptr;
+ lv_obj_t* btnMessage = nullptr;
enum class EnableButtonState { On, Off, Alerting };
void SetEnableButtonState();
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp
index 5c582f60..29c8affb 100644
--- a/src/displayapp/screens/ApplicationList.cpp
+++ b/src/displayapp/screens/ApplicationList.cpp
@@ -1,10 +1,10 @@
-#include "ApplicationList.h"
+#include "displayapp/screens/ApplicationList.h"
#include <lvgl/lvgl.h>
#include <array>
-#include "Symbols.h"
-#include "Tile.h"
+#include "displayapp/screens/Symbols.h"
+#include "displayapp/screens/Tile.h"
#include "displayapp/Apps.h"
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h
index 103c38ae..f430a89e 100644
--- a/src/displayapp/screens/ApplicationList.h
+++ b/src/displayapp/screens/ApplicationList.h
@@ -2,8 +2,8 @@
#include <memory>
-#include "Screen.h"
-#include "ScreenList.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h"
#include "components/settings/Settings.h"
#include "components/battery/BatteryController.h"
diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp
index c67bcb23..08aaab70 100644
--- a/src/displayapp/screens/BatteryIcon.cpp
+++ b/src/displayapp/screens/BatteryIcon.cpp
@@ -1,6 +1,6 @@
+#include "displayapp/screens/BatteryIcon.h"
#include <cstdint>
-#include "BatteryIcon.h"
-#include "Symbols.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h
index b370b331..bec2e4e0 100644
--- a/src/displayapp/screens/BatteryIcon.h
+++ b/src/displayapp/screens/BatteryIcon.h
@@ -1,4 +1,5 @@
#pragma once
+#include <cstdint>
namespace Pinetime {
namespace Applications {
diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp
index 44ea7f51..e17de9ab 100644
--- a/src/displayapp/screens/BatteryInfo.cpp
+++ b/src/displayapp/screens/BatteryInfo.cpp
@@ -1,5 +1,5 @@
-#include "BatteryInfo.h"
-#include "../DisplayApp.h"
+#include "displayapp/screens/BatteryInfo.h"
+#include "displayapp/DisplayApp.h"
#include "components/battery/BatteryController.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/BatteryInfo.h b/src/displayapp/screens/BatteryInfo.h
index 63454a26..de34cdff 100644
--- a/src/displayapp/screens/BatteryInfo.h
+++ b/src/displayapp/screens/BatteryInfo.h
@@ -1,9 +1,7 @@
#pragma once
#include <cstdint>
-#include <FreeRTOS.h>
-#include <timers.h>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/lvgl.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp
index da3d15e7..5058f3eb 100644
--- a/src/displayapp/screens/BleIcon.cpp
+++ b/src/displayapp/screens/BleIcon.cpp
@@ -1,5 +1,5 @@
-#include "BleIcon.h"
-#include "Symbols.h"
+#include "displayapp/screens/BleIcon.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
const char* BleIcon::GetIcon(bool isConnected) {
diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp
index 1278cd62..d9901ae8 100644
--- a/src/displayapp/screens/Brightness.cpp
+++ b/src/displayapp/screens/Brightness.cpp
@@ -1,4 +1,4 @@
-#include "Brightness.h"
+#include "displayapp/screens/Brightness.h"
#include <lvgl/lvgl.h>
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h
index 14e48592..693570c7 100644
--- a/src/displayapp/screens/Brightness.h
+++ b/src/displayapp/screens/Brightness.h
@@ -2,7 +2,7 @@
#include <lvgl/src/lv_core/lv_obj.h>
#include <cstdint>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/brightness/BrightnessController.h"
namespace Pinetime {
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index 5a5cd18b..71f01b93 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -1,4 +1,4 @@
-#include "Clock.h"
+#include "displayapp/screens/Clock.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
@@ -6,10 +6,10 @@
#include "components/motion/MotionController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
-#include "../DisplayApp.h"
-#include "WatchFaceDigital.h"
-#include "WatchFaceAnalog.h"
-#include "PineTimeStyle.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/WatchFaceDigital.h"
+#include "displayapp/screens/WatchFaceAnalog.h"
+#include "displayapp/screens/PineTimeStyle.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h
index 648f72da..2fad1e21 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -5,7 +5,7 @@
#include <cstdint>
#include <memory>
#include <components/heartrate/HeartRateController.h>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h"
namespace Pinetime {
diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp
index 9043c20d..cf239a2f 100644
--- a/src/displayapp/screens/DropDownDemo.cpp
+++ b/src/displayapp/screens/DropDownDemo.cpp
@@ -1,7 +1,7 @@
-#include "DropDownDemo.h"
+#include "displayapp/screens/DropDownDemo.h"
#include <lvgl/lvgl.h>
#include <libraries/log/nrf_log.h>
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h
index ff388c57..bcf0f45c 100644
--- a/src/displayapp/screens/DropDownDemo.h
+++ b/src/displayapp/screens/DropDownDemo.h
@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/src/lv_core/lv_obj.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/Error.cpp b/src/displayapp/screens/Error.cpp
index 75946aba..1dbc3447 100644
--- a/src/displayapp/screens/Error.cpp
+++ b/src/displayapp/screens/Error.cpp
@@ -1,4 +1,4 @@
-#include "Error.h"
+#include "displayapp/screens/Error.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Error.h b/src/displayapp/screens/Error.h
index 20dde7ee..23167545 100644
--- a/src/displayapp/screens/Error.h
+++ b/src/displayapp/screens/Error.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "BootErrors.h"
#include <lvgl/lvgl.h>
diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp
index 79bda0ba..373fcae4 100644
--- a/src/displayapp/screens/FirmwareUpdate.cpp
+++ b/src/displayapp/screens/FirmwareUpdate.cpp
@@ -1,7 +1,7 @@
-#include "FirmwareUpdate.h"
+#include "displayapp/screens/FirmwareUpdate.h"
#include <lvgl/lvgl.h>
#include "components/ble/BleController.h"
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h
index 8fc86d8c..a61178ce 100644
--- a/src/displayapp/screens/FirmwareUpdate.h
+++ b/src/displayapp/screens/FirmwareUpdate.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/src/lv_core/lv_obj.h>
#include "FreeRTOS.h"
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp
index eef8f919..ea417135 100644
--- a/src/displayapp/screens/FirmwareValidation.cpp
+++ b/src/displayapp/screens/FirmwareValidation.cpp
@@ -1,8 +1,8 @@
-#include "FirmwareValidation.h"
+#include "displayapp/screens/FirmwareValidation.h"
#include <lvgl/lvgl.h>
#include "Version.h"
#include "components/firmwarevalidator/FirmwareValidator.h"
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h
index bfdb096d..278c4adf 100644
--- a/src/displayapp/screens/FirmwareValidation.h
+++ b/src/displayapp/screens/FirmwareValidation.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/src/lv_core/lv_obj.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index dcb31a7f..c4d02643 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -1,6 +1,6 @@
-#include "FlashLight.h"
-#include "../DisplayApp.h"
-#include "Symbols.h"
+#include "displayapp/screens/FlashLight.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h
index f2c65bbe..e91a1032 100644
--- a/src/displayapp/screens/FlashLight.h
+++ b/src/displayapp/screens/FlashLight.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/brightness/BrightnessController.h"
#include "systemtask/SystemTask.h"
#include <cstdint>
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index b6ece27f..513c40bf 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -1,8 +1,8 @@
-#include <libs/lvgl/lvgl.h>
-#include "HeartRate.h"
+#include "displayapp/screens/HeartRate.h"
+#include <lvgl/lvgl.h>
#include <components/heartrate/HeartRateController.h>
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h
index 7f7d3ad3..baa0ccdd 100644
--- a/src/displayapp/screens/HeartRate.h
+++ b/src/displayapp/screens/HeartRate.h
@@ -2,11 +2,11 @@
#include <cstdint>
#include <chrono>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <bits/unique_ptr.h>
#include "systemtask/SystemTask.h"
-#include <libs/lvgl/src/lv_core/lv_style.h>
-#include <libs/lvgl/src/lv_core/lv_obj.h>
+#include <lvgl/src/lv_core/lv_style.h>
+#include <lvgl/src/lv_core/lv_obj.h>
namespace Pinetime {
namespace Controllers {
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp
index 85a5e826..00d224e6 100644
--- a/src/displayapp/screens/InfiniPaint.cpp
+++ b/src/displayapp/screens/InfiniPaint.cpp
@@ -1,6 +1,6 @@
-#include "InfiniPaint.h"
-#include "../DisplayApp.h"
-#include "../LittleVgl.h"
+#include "displayapp/screens/InfiniPaint.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/LittleVgl.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h
index 0a70e033..bc0bca24 100644
--- a/src/displayapp/screens/InfiniPaint.h
+++ b/src/displayapp/screens/InfiniPaint.h
@@ -2,7 +2,8 @@
#include <lvgl/lvgl.h>
#include <cstdint>
-#include "Screen.h"
+#include <algorithm> // std::fill
+#include "displayapp/screens/Screen.h"
namespace Pinetime {
namespace Components {
diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp
index 1761a7b5..62ec1f0a 100644
--- a/src/displayapp/screens/Label.cpp
+++ b/src/displayapp/screens/Label.cpp
@@ -1,4 +1,4 @@
-#include "Label.h"
+#include "displayapp/screens/Label.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h
index f1e49079..3fe5111f 100644
--- a/src/displayapp/screens/Label.h
+++ b/src/displayapp/screens/Label.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/lvgl.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp
index 064b47a6..af3f30f6 100644
--- a/src/displayapp/screens/List.cpp
+++ b/src/displayapp/screens/List.cpp
@@ -1,6 +1,6 @@
-#include "List.h"
-#include "../DisplayApp.h"
-#include "Symbols.h"
+#include "displayapp/screens/List.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h
index d9f61f29..023de3aa 100644
--- a/src/displayapp/screens/List.h
+++ b/src/displayapp/screens/List.h
@@ -3,8 +3,8 @@
#include <lvgl/lvgl.h>
#include <cstdint>
#include <memory>
-#include "Screen.h"
-#include "../Apps.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/Apps.h"
#include "components/settings/Settings.h"
#define MAXLISTITEMS 4
diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp
index 57cde9cf..9c853109 100644
--- a/src/displayapp/screens/Meter.cpp
+++ b/src/displayapp/screens/Meter.cpp
@@ -1,6 +1,6 @@
-#include "Meter.h"
+#include "displayapp/screens/Meter.h"
#include <lvgl/lvgl.h>
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h
index 9b3d1d48..50d9f83c 100644
--- a/src/displayapp/screens/Meter.h
+++ b/src/displayapp/screens/Meter.h
@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <lvgl/src/lv_core/lv_style.h>
#include <lvgl/src/lv_core/lv_obj.h>
diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp
index 52cb8519..8347e1bb 100644
--- a/src/displayapp/screens/Metronome.cpp
+++ b/src/displayapp/screens/Metronome.cpp
@@ -1,5 +1,5 @@
-#include "Metronome.h"
-#include "Symbols.h"
+#include "displayapp/screens/Metronome.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index 2f1f7c21..23eb2765 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -1,6 +1,6 @@
-#include <libs/lvgl/lvgl.h>
-#include "Motion.h"
-#include "../DisplayApp.h"
+#include "displayapp/screens/Motion.h"
+#include <lvgl/lvgl.h>
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h
index 20a18d02..d6997409 100644
--- a/src/displayapp/screens/Motion.h
+++ b/src/displayapp/screens/Motion.h
@@ -2,10 +2,10 @@
#include <cstdint>
#include <chrono>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <bits/unique_ptr.h>
-#include <libs/lvgl/src/lv_core/lv_style.h>
-#include <libs/lvgl/src/lv_core/lv_obj.h>
+#include <lvgl/src/lv_core/lv_style.h>
+#include <lvgl/src/lv_core/lv_obj.h>
#include <components/motion/MotionController.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp
index 47ddb655..8a01a6fe 100644
--- a/src/displayapp/screens/Music.cpp
+++ b/src/displayapp/screens/Music.cpp
@@ -15,10 +15,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "Music.h"
-#include "Symbols.h"
+#include "displayapp/screens/Music.h"
+#include "displayapp/screens/Symbols.h"
#include <cstdint>
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
#include "components/ble/MusicService.h"
#include "displayapp/icons/music/disc.cpp"
#include "displayapp/icons/music/disc_f_1.cpp"
diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h
index 6f2d80a0..f9b4eaab 100644
--- a/src/displayapp/screens/Music.h
+++ b/src/displayapp/screens/Music.h
@@ -20,7 +20,7 @@
#include <FreeRTOS.h>
#include <lvgl/src/lv_core/lv_obj.h>
#include <string>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
namespace Pinetime {
namespace Controllers {
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index d437cc6d..674362a6 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -15,9 +15,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "Navigation.h"
+#include "displayapp/screens/Navigation.h"
#include <cstdint>
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
#include "components/ble/NavigationService.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h
index 48f00a76..07674ef1 100644
--- a/src/displayapp/screens/Navigation.h
+++ b/src/displayapp/screens/Navigation.h
@@ -20,7 +20,7 @@
#include <FreeRTOS.h>
#include <lvgl/src/lv_core/lv_obj.h>
#include <string>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <array>
namespace Pinetime {
diff --git a/src/displayapp/screens/NotificationIcon.cpp b/src/displayapp/screens/NotificationIcon.cpp
index d8792f9d..0e913ae7 100644
--- a/src/displayapp/screens/NotificationIcon.cpp
+++ b/src/displayapp/screens/NotificationIcon.cpp
@@ -1,5 +1,5 @@
-#include "NotificationIcon.h"
-#include "Symbols.h"
+#include "displayapp/screens/NotificationIcon.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 4f475813..569c422b 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -1,8 +1,8 @@
-#include "Notifications.h"
-#include <displayapp/DisplayApp.h>
+#include "displayapp/screens/Notifications.h"
+#include "displayapp/DisplayApp.h"
#include "components/ble/MusicService.h"
#include "components/ble/AlertNotificationService.h"
-#include "Symbols.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed;
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index 0b5271e7..cbb7af6c 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -3,7 +3,7 @@
#include <lvgl/lvgl.h>
#include <cstdint>
#include <memory>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/ble/NotificationManager.h"
#include "components/motor/MotorController.h"
diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp
index 26c2368b..aa3420dc 100644
--- a/src/displayapp/screens/Paddle.cpp
+++ b/src/displayapp/screens/Paddle.cpp
@@ -1,6 +1,6 @@
-#include "Paddle.h"
-#include "../DisplayApp.h"
-#include "../LittleVgl.h"
+#include "displayapp/screens/Paddle.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/LittleVgl.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h
index fc2131a1..3a30eee6 100644
--- a/src/displayapp/screens/Paddle.h
+++ b/src/displayapp/screens/Paddle.h
@@ -2,7 +2,7 @@
#include <lvgl/lvgl.h>
#include <cstdint>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
namespace Pinetime {
namespace Components {
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp
index fa88d459..781a359c 100644
--- a/src/displayapp/screens/PineTimeStyle.cpp
+++ b/src/displayapp/screens/PineTimeStyle.cpp
@@ -19,21 +19,21 @@
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
*/
-#include "PineTimeStyle.h"
+#include "displayapp/screens/PineTimeStyle.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
#include <displayapp/Colors.h>
-#include "BatteryIcon.h"
-#include "BleIcon.h"
-#include "NotificationIcon.h"
-#include "Symbols.h"
+#include "displayapp/screens/BatteryIcon.h"
+#include "displayapp/screens/BleIcon.h"
+#include "displayapp/screens/NotificationIcon.h"
+#include "displayapp/screens/Symbols.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/motion/MotionController.h"
#include "components/settings/Settings.h"
-#include "../DisplayApp.h"
+#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h
index ba473806..f8c7c8b4 100644
--- a/src/displayapp/screens/PineTimeStyle.h
+++ b/src/displayapp/screens/PineTimeStyle.h
@@ -4,8 +4,8 @@
#include <chrono>
#include <cstdint>
#include <memory>
-#include "Screen.h"
-#include "ScreenList.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h"
namespace Pinetime {
diff --git a/src/displayapp/screens/Screen.cpp b/src/displayapp/screens/Screen.cpp
index 6ae5b7bb..bc4cc438 100644
--- a/src/displayapp/screens/Screen.cpp
+++ b/src/displayapp/screens/Screen.cpp
@@ -1,4 +1,4 @@
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
using namespace Pinetime::Applications::Screens;
void Screen::RefreshTaskCallback(lv_task_t* task) {
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index ce5741b2..04bb152c 100644
--- a/src/displayapp/screens/Screen.h
+++ b/src/displayapp/screens/Screen.h
@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
-#include "../TouchEvents.h"
+#include "displayapp/TouchEvents.h"
#include <lvgl/lvgl.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h
index a9d747aa..e316e360 100644
--- a/src/displayapp/screens/ScreenList.h
+++ b/src/displayapp/screens/ScreenList.h
@@ -3,8 +3,8 @@
#include <array>
#include <functional>
#include <memory>
-#include "Screen.h"
-#include "../DisplayApp.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/DisplayApp.h"
namespace Pinetime {
namespace Applications {
diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp
index c41163ab..916138ed 100644
--- a/src/displayapp/screens/Steps.cpp
+++ b/src/displayapp/screens/Steps.cpp
@@ -1,7 +1,7 @@
-#include "Steps.h"
+#include "displayapp/screens/Steps.h"
#include <lvgl/lvgl.h>
-#include "../DisplayApp.h"
-#include "Symbols.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h
index d7cf31e1..68daf16d 100644
--- a/src/displayapp/screens/Steps.h
+++ b/src/displayapp/screens/Steps.h
@@ -2,7 +2,7 @@
#include <cstdint>
#include <lvgl/lvgl.h>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include <components/motion/MotionController.h>
namespace Pinetime {
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp
index 9b27a89d..a260d293 100644
--- a/src/displayapp/screens/StopWatch.cpp
+++ b/src/displayapp/screens/StopWatch.cpp
@@ -1,8 +1,8 @@
#include "StopWatch.h"
-#include "Screen.h"
-#include "Symbols.h"
-#include "lvgl/lvgl.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/Symbols.h"
+#include <lvgl/lvgl.h>
#include "projdefs.h"
#include "FreeRTOSConfig.h"
#include "task.h"
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index 25634e92..0720a586 100644
--- a/src/displayapp/screens/StopWatch.h
+++ b/src/displayapp/screens/StopWatch.h
@@ -1,8 +1,8 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h"
-#include "../LittleVgl.h"
+#include "displayapp/LittleVgl.h"
#include "FreeRTOS.h"
#include "portmacro_cmsis.h"
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index 343b72bf..350c15cf 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -1,7 +1,7 @@
-#include "SystemInfo.h"
+#include "displayapp/screens/SystemInfo.h"
#include <lvgl/lvgl.h>
-#include "../DisplayApp.h"
-#include "Label.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/Label.h"
#include "Version.h"
#include "BootloaderVersion.h"
#include "components/battery/BatteryController.h"
@@ -209,7 +209,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
static constexpr uint8_t maxTaskCount = 9;
TaskStatus_t tasksStatus[maxTaskCount];
- lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
+ lv_obj_t* infoTask = lv_table_create(lv_scr_act(), nullptr);
lv_table_set_col_cnt(infoTask, 4);
lv_table_set_row_cnt(infoTask, maxTaskCount + 1);
lv_obj_set_style_local_pad_all(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, 0);
@@ -227,35 +227,37 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
auto nb = uxTaskGetSystemState(tasksStatus, maxTaskCount, nullptr);
std::sort(tasksStatus, tasksStatus + nb, sortById);
for (uint8_t i = 0; i < nb && i < maxTaskCount; i++) {
+ char buffer[7] = {0};
- lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
- char state[2] = {0};
+ sprintf(buffer, "%lu", tasksStatus[i].xTaskNumber);
+ lv_table_set_cell_value(infoTask, i + 1, 0, buffer);
switch (tasksStatus[i].eCurrentState) {
case eReady:
case eRunning:
- state[0] = 'R';
+ buffer[0] = 'R';
break;
case eBlocked:
- state[0] = 'B';
+ buffer[0] = 'B';
break;
case eSuspended:
- state[0] = 'S';
+ buffer[0] = 'S';
break;
case eDeleted:
- state[0] = 'D';
+ buffer[0] = 'D';
break;
default:
- state[0] = 'I'; // Invalid
+ buffer[0] = 'I'; // Invalid
break;
}
- lv_table_set_cell_value(infoTask, i + 1, 1, state);
+ buffer[1] = '\0';
+ lv_table_set_cell_value(infoTask, i + 1, 1, buffer);
lv_table_set_cell_value(infoTask, i + 1, 2, tasksStatus[i].pcTaskName);
if (tasksStatus[i].usStackHighWaterMark < 20) {
- std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low";
- lv_table_set_cell_value(infoTask, i + 1, 3, str1.c_str());
+ sprintf(buffer, "%d low", tasksStatus[i].usStackHighWaterMark);
} else {
- lv_table_set_cell_value(infoTask, i + 1, 3, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
+ sprintf(buffer, "%d", tasksStatus[i].usStackHighWaterMark);
}
+ lv_table_set_cell_value(infoTask, i + 1, 3, buffer);
}
return std::make_unique<Screens::Label>(3, 5, app, infoTask);
}
diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h
index bfcc3aa4..a382ed8f 100644
--- a/src/displayapp/screens/SystemInfo.h
+++ b/src/displayapp/screens/SystemInfo.h
@@ -1,8 +1,8 @@
#pragma once
#include <memory>
-#include "Screen.h"
-#include "ScreenList.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
namespace Pinetime {
namespace Controllers {
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index 1d4f0d0e..ba764a2e 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -1,6 +1,6 @@
-#include "Tile.h"
-#include "../DisplayApp.h"
-#include "BatteryIcon.h"
+#include "displayapp/screens/Tile.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/BatteryIcon.h"
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h
index 83d3fdf5..4869fef9 100644
--- a/src/displayapp/screens/Tile.h
+++ b/src/displayapp/screens/Tile.h
@@ -3,8 +3,8 @@
#include <lvgl/lvgl.h>
#include <cstdint>
#include <memory>
-#include "Screen.h"
-#include "../Apps.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/Apps.h"
#include "components/datetime/DateTimeController.h"
#include "components/settings/Settings.h"
#include "components/datetime/DateTimeController.h"
diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp
index ff3099d5..a5e40195 100644
--- a/src/displayapp/screens/Timer.cpp
+++ b/src/displayapp/screens/Timer.cpp
@@ -1,8 +1,8 @@
-#include "Timer.h"
+#include "displayapp/screens/Timer.h"
-#include "Screen.h"
-#include "Symbols.h"
-#include "lvgl/lvgl.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/Symbols.h"
+#include <lvgl/lvgl.h>
using namespace Pinetime::Applications::Screens;
diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h
index d0fc8ed1..23c87345 100644
--- a/src/displayapp/screens/Timer.h
+++ b/src/displayapp/screens/Timer.h
@@ -1,9 +1,9 @@
#pragma once
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h"
#include "systemtask/SystemTask.h"
-#include "../LittleVgl.h"
+#include "displayapp/LittleVgl.h"
#include "components/timer/TimerController.h"
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index 4201d501..a1f0ba25 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -1,10 +1,10 @@
-#include "Twos.h"
-#include <lvgl/lvgl.h>
-#include <string>
-#include <charconv>
+#include "displayapp/screens/Twos.h"
#include <array>
-#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <lvgl/lvgl.h>
#include <utility>
+#include <vector>
using namespace Pinetime::Applications::Screens;
@@ -265,7 +265,9 @@ void Twos::updateGridDisplay(Tile grid[][4]) {
for (int row = 0; row < 4; row++) {
for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
- lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
+ char buffer[7];
+ sprintf(buffer, "%d", grid[row][col].value);
+ lv_table_set_cell_value(gridDisplay, row, col, buffer);
} else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h
index 6d85cff6..48ea0794 100644
--- a/src/displayapp/screens/Twos.h
+++ b/src/displayapp/screens/Twos.h
@@ -1,7 +1,7 @@
#pragma once
#include <lvgl/src/lv_core/lv_obj.h>
-#include "Screen.h"
+#include "displayapp/screens/Screen.h"
namespace Pinetime {
namespace Applications {
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 53e7faf7..4540c1a8 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -1,9 +1,9 @@
-#include <libs/lvgl/lvgl.h>
-#include "WatchFaceAnalog.h"
-#include "BatteryIcon.h"
-#include "BleIcon.h"
-#include "Symbols.h"
-#include "NotificationIcon.h"
+#include "displayapp/screens/WatchFaceAnalog.h"
+#include <lvgl/lvgl.h>
+#include "displayapp/screens/BatteryIcon.h"
+#include "displayapp/screens/BleIcon.h"
+#include "displayapp/screens/Symbols.h"
+#include "displayapp/screens/NotificationIcon.h"
LV_IMG_DECLARE(bg_clock);
diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h
index 001414a6..ca0462a6 100644
--- a/src/displayapp/screens/WatchFaceAnalog.h
+++ b/src/displayapp/screens/WatchFaceAnalog.h
@@ -4,8 +4,8 @@
#include <chrono>
#include <cstdint>
#include <memory>
-#include "Screen.h"
-#include "ScreenList.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 2ecab609..2894812c 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -1,12 +1,12 @@
-#include "WatchFaceDigital.h"
+#include "displayapp/screens/WatchFaceDigital.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
-#include "BatteryIcon.h"
-#include "BleIcon.h"
-#include "NotificationIcon.h"
-#include "Symbols.h"
+#include "displayapp/screens/BatteryIcon.h"
+#include "displayapp/screens/BleIcon.h"
+#include "displayapp/screens/NotificationIcon.h"
+#include "displayapp/screens/Symbols.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h
index e27545f3..7134efb6 100644
--- a/src/displayapp/screens/WatchFaceDigital.h
+++ b/src/displayapp/screens/WatchFaceDigital.h
@@ -4,8 +4,8 @@
#include <chrono>
#include <cstdint>
#include <memory>
-#include "Screen.h"
-#include "ScreenList.h"
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h"
namespace Pinetime {
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index dd626072..5d3a9834 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -1,4 +1,4 @@
-#include "QuickSettings.h"
+#include "displayapp/screens/settings/QuickSettings.h"
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/BatteryIcon.h"
diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp
index d8d6c767..666dfb80 100644
--- a/src/displayapp/screens/settings/SettingDisplay.cpp
+++ b/src/displayapp/screens/settings/SettingDisplay.cpp
@@ -1,4 +1,4 @@
-#include "SettingDisplay.h"
+#include "displayapp/screens/settings/SettingDisplay.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/Messages.h"
diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
index c9af19b6..f38ec3bd 100644
--- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
+++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
@@ -1,4 +1,4 @@
-#include "SettingPineTimeStyle.h"
+#include "displayapp/screens/settings/SettingPineTimeStyle.h"
#include <lvgl/lvgl.h>
#include <displayapp/Colors.h>
#include "displayapp/DisplayApp.h"
diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp
index ba3413ef..8bfded34 100644
--- a/src/displayapp/screens/settings/SettingSetDate.cpp
+++ b/src/displayapp/screens/settings/SettingSetDate.cpp
@@ -1,4 +1,4 @@
-#include "SettingSetDate.h"
+#include "displayapp/screens/settings/SettingSetDate.h"
#include <lvgl/lvgl.h>
#include <hal/nrf_rtc.h>
#include <nrf_log.h>
diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp
index 194bf5eb..5351adeb 100644
--- a/src/displayapp/screens/settings/SettingSetTime.cpp
+++ b/src/displayapp/screens/settings/SettingSetTime.cpp
@@ -1,4 +1,4 @@
-#include "SettingSetTime.h"
+#include "displayapp/screens/settings/SettingSetTime.h"
#include <lvgl/lvgl.h>
#include <hal/nrf_rtc.h>
#include <nrf_log.h>
diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp
index bec7972b..149840df 100644
--- a/src/displayapp/screens/settings/SettingSteps.cpp
+++ b/src/displayapp/screens/settings/SettingSteps.cpp
@@ -1,4 +1,4 @@
-#include "SettingSteps.h"
+#include "displayapp/screens/settings/SettingSteps.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h"
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp
index c99e3a0e..c6bdf401 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.cpp
+++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp
@@ -1,4 +1,4 @@
-#include "SettingTimeFormat.h"
+#include "displayapp/screens/settings/SettingTimeFormat.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Screen.h"
diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp
index d999004b..8339d9ad 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.cpp
+++ b/src/displayapp/screens/settings/SettingWakeUp.cpp
@@ -1,4 +1,4 @@
-#include "SettingWakeUp.h"
+#include "displayapp/screens/settings/SettingWakeUp.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Screen.h"
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index cdec704c..8e6e7cf4 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -1,4 +1,4 @@
-#include "SettingWatchFace.h"
+#include "displayapp/screens/settings/SettingWatchFace.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Screen.h"
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index 1daf311e..392c12e0 100644
--- a/src/displayapp/screens/settings/Settings.cpp
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -1,4 +1,4 @@
-#include "Settings.h"
+#include "displayapp/screens/settings/Settings.h"
#include <lvgl/lvgl.h>
#include <array>
#include "displayapp/screens/List.h"
diff --git a/src/drivers/Bma421.cpp b/src/drivers/Bma421.cpp
index dd284000..2f60f42f 100644
--- a/src/drivers/Bma421.cpp
+++ b/src/drivers/Bma421.cpp
@@ -1,7 +1,7 @@
+#include "drivers/Bma421.h"
#include <libraries/delay/nrf_delay.h>
#include <libraries/log/nrf_log.h>
-#include "Bma421.h"
-#include "TwiMaster.h"
+#include "drivers/TwiMaster.h"
#include <drivers/Bma421_C/bma423.h>
using namespace Pinetime::Drivers;
diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp
index 7fc8eca4..e9573df1 100644
--- a/src/drivers/Cst816s.cpp
+++ b/src/drivers/Cst816s.cpp
@@ -1,4 +1,4 @@
-#include "Cst816s.h"
+#include "drivers/Cst816s.h"
#include <FreeRTOS.h>
#include <legacy/nrf_drv_gpiote.h>
#include <nrfx_log.h>
@@ -32,6 +32,12 @@ bool Cst816S::Init() {
twiMaster.Read(twiAddress, 0xa7, &dummy, 1);
vTaskDelay(5);
+ // TODO This function check that the device IDs from the controller are equal to the ones
+ // we expect. However, it seems to return false positive (probably in case of communication issue).
+ // Also, it seems that some users have pinetimes that works correctly but that report different device IDs
+ // Until we know more about this, we'll just read the IDs but not take any action in case they are not 'valid'
+ CheckDeviceIds();
+
/*
[2] EnConLR - Continuous operation can slide around
[1] EnConUD - Slide up and down to enable continuous operation
@@ -50,21 +56,7 @@ bool Cst816S::Init() {
static constexpr uint8_t irqCtl = 0b01110000;
twiMaster.Write(twiAddress, 0xFA, &irqCtl, 1);
- // There's mixed information about which register contains which information
- if (twiMaster.Read(twiAddress, 0xA7, &chipId, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
- chipId = 0xFF;
- return false;
- }
- if (twiMaster.Read(twiAddress, 0xA8, &vendorId, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
- vendorId = 0xFF;
- return false;
- }
- if (twiMaster.Read(twiAddress, 0xA9, &fwVersion, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
- fwVersion = 0xFF;
- return false;
- }
-
- return chipId == 0xb4 && vendorId == 0 && fwVersion == 1;
+ return true;
}
Cst816S::TouchInfos Cst816S::GetTouchInfo() {
@@ -79,18 +71,33 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
// This can only be 0 or 1
uint8_t nbTouchPoints = touchData[touchPointNumIndex] & 0x0f;
-
uint8_t xHigh = touchData[touchXHighIndex] & 0x0f;
uint8_t xLow = touchData[touchXLowIndex];
- info.x = (xHigh << 8) | xLow;
-
+ uint16_t x = (xHigh << 8) | xLow;
uint8_t yHigh = touchData[touchYHighIndex] & 0x0f;
uint8_t yLow = touchData[touchYLowIndex];
- info.y = (yHigh << 8) | yLow;
+ uint16_t y = (yHigh << 8) | yLow;
+ Gestures gesture = static_cast<Gestures>(touchData[gestureIndex]);
+
+ // Validity check
+ if(x >= maxX || y >= maxY ||
+ (gesture != Gestures::None &&
+ gesture != Gestures::SlideDown &&
+ gesture != Gestures::SlideUp &&
+ gesture != Gestures::SlideLeft &&
+ gesture != Gestures::SlideRight &&
+ gesture != Gestures::SingleTap &&
+ gesture != Gestures::DoubleTap &&
+ gesture != Gestures::LongPress)) {
+ info.isValid = false;
+ return info;
+ }
+ info.x = x;
+ info.y = y;
info.touching = (nbTouchPoints > 0);
- info.gesture = static_cast<Gestures>(touchData[gestureIndex]);
-
+ info.gesture = gesture;
+ info.isValid = true;
return info;
}
@@ -108,3 +115,21 @@ void Cst816S::Wakeup() {
Init();
NRF_LOG_INFO("[TOUCHPANEL] Wakeup");
}
+
+bool Cst816S::CheckDeviceIds() {
+ // There's mixed information about which register contains which information
+ if (twiMaster.Read(twiAddress, 0xA7, &chipId, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
+ chipId = 0xFF;
+ return false;
+ }
+ if (twiMaster.Read(twiAddress, 0xA8, &vendorId, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
+ vendorId = 0xFF;
+ return false;
+ }
+ if (twiMaster.Read(twiAddress, 0xA9, &fwVersion, 1) == TwiMaster::ErrorCodes::TransactionFailed) {
+ fwVersion = 0xFF;
+ return false;
+ }
+
+ return chipId == 0xb4 && vendorId == 0 && fwVersion == 1;
+}
diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h
index 0fec8419..4a548d45 100644
--- a/src/drivers/Cst816s.h
+++ b/src/drivers/Cst816s.h
@@ -1,6 +1,6 @@
#pragma once
-#include "TwiMaster.h"
+#include "drivers/TwiMaster.h"
namespace Pinetime {
namespace Drivers {
@@ -21,7 +21,7 @@ namespace Pinetime {
uint16_t y = 0;
Gestures gesture = Gestures::None;
bool touching = false;
- bool isValid = true;
+ bool isValid = false;
};
Cst816S(TwiMaster& twiMaster, uint8_t twiAddress);
@@ -45,6 +45,8 @@ namespace Pinetime {
return fwVersion;
}
private:
+ bool CheckDeviceIds();
+
// Unused/Unavailable commented out
static constexpr uint8_t gestureIndex = 1;
static constexpr uint8_t touchPointNumIndex = 2;
@@ -58,6 +60,9 @@ namespace Pinetime {
//static constexpr uint8_t touchXYIndex = 7;
//static constexpr uint8_t touchMiscIndex = 8;
+ static constexpr uint8_t maxX = 240;
+ static constexpr uint8_t maxY = 240;
+
TwiMaster& twiMaster;
uint8_t twiAddress;
diff --git a/src/drivers/DebugPins.cpp b/src/drivers/DebugPins.cpp
index 56fd1458..92091280 100644
--- a/src/drivers/DebugPins.cpp
+++ b/src/drivers/DebugPins.cpp
@@ -1,4 +1,4 @@
-#include "DebugPins.h"
+#include "drivers/DebugPins.h"
#include <hal/nrf_gpio.h>
#ifdef USE_DEBUG_PINS
diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp
index edb9e81d..c14fe7aa 100644
--- a/src/drivers/Hrs3300.cpp
+++ b/src/drivers/Hrs3300.cpp
@@ -4,9 +4,9 @@
C++ port Copyright (C) 2021 Jean-François Milants
*/
+#include "drivers/Hrs3300.h"
#include <algorithm>
#include <nrf_gpio.h>
-#include "Hrs3300.h"
#include <FreeRTOS.h>
#include <task.h>
diff --git a/src/drivers/Hrs3300.h b/src/drivers/Hrs3300.h
index c4f28900..01310c62 100644
--- a/src/drivers/Hrs3300.h
+++ b/src/drivers/Hrs3300.h
@@ -1,6 +1,6 @@
#pragma once
-#include "TwiMaster.h"
+#include "drivers/TwiMaster.h"
namespace Pinetime {
namespace Drivers {
diff --git a/src/drivers/InternalFlash.cpp b/src/drivers/InternalFlash.cpp
index 0840c6e5..ec5885d5 100644
--- a/src/drivers/InternalFlash.cpp
+++ b/src/drivers/InternalFlash.cpp
@@ -1,4 +1,4 @@
-#include "InternalFlash.h"
+#include "drivers/InternalFlash.h"
#include <mdk/nrf.h>
using namespace Pinetime::Drivers;
diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h
index 57964020..579bf38a 100644
--- a/src/drivers/PinMap.h
+++ b/src/drivers/PinMap.h
@@ -1,4 +1,5 @@
#pragma once
+#include <cstdint>
namespace Pinetime {
namespace PinMap {
diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp
index a55d2888..e477622b 100644
--- a/src/drivers/Spi.cpp
+++ b/src/drivers/Spi.cpp
@@ -1,4 +1,4 @@
-#include "Spi.h"
+#include "drivers/Spi.h"
#include <hal/nrf_gpio.h>
#include <nrfx_log.h>
diff --git a/src/drivers/Spi.h b/src/drivers/Spi.h
index 6875710d..9b6a30f4 100644
--- a/src/drivers/Spi.h
+++ b/src/drivers/Spi.h
@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
-#include "SpiMaster.h"
+#include "drivers/SpiMaster.h"
namespace Pinetime {
namespace Drivers {
diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp
index c45e1294..747dbc84 100644
--- a/src/drivers/SpiMaster.cpp
+++ b/src/drivers/SpiMaster.cpp
@@ -1,4 +1,4 @@
-#include "SpiMaster.h"
+#include "drivers/SpiMaster.h"
#include <hal/nrf_gpio.h>
#include <hal/nrf_spim.h>
#include <nrfx_log.h>
diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp
index 068d1d02..ebe3174c 100644
--- a/src/drivers/SpiNorFlash.cpp
+++ b/src/drivers/SpiNorFlash.cpp
@@ -1,8 +1,8 @@
-#include "SpiNorFlash.h"
+#include "drivers/SpiNorFlash.h"
#include <hal/nrf_gpio.h>
#include <libraries/delay/nrf_delay.h>
#include <libraries/log/nrf_log.h>
-#include "Spi.h"
+#include "drivers/Spi.h"
using namespace Pinetime::Drivers;
diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp
index 4d81cf27..fd1366f8 100644
--- a/src/drivers/St7789.cpp
+++ b/src/drivers/St7789.cpp
@@ -1,8 +1,8 @@
-#include "St7789.h"
+#include "drivers/St7789.h"
#include <hal/nrf_gpio.h>
#include <libraries/delay/nrf_delay.h>
#include <nrfx_log.h>
-#include "Spi.h"
+#include "drivers/Spi.h"
using namespace Pinetime::Drivers;
diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp
index 76009278..9b456d5f 100644
--- a/src/drivers/TwiMaster.cpp
+++ b/src/drivers/TwiMaster.cpp
@@ -1,4 +1,4 @@
-#include "TwiMaster.h"
+#include "drivers/TwiMaster.h"
#include <cstring>
#include <hal/nrf_gpio.h>
#include <nrfx_log.h>
diff --git a/src/drivers/Watchdog.cpp b/src/drivers/Watchdog.cpp
index a6ad263a..d0907a65 100644
--- a/src/drivers/Watchdog.cpp
+++ b/src/drivers/Watchdog.cpp
@@ -1,4 +1,4 @@
-#include "Watchdog.h"
+#include "drivers/Watchdog.h"
#include <mdk/nrf.h>
using namespace Pinetime::Drivers;
diff --git a/src/heartratetask/HeartRateTask.cpp b/src/heartratetask/HeartRateTask.cpp
index fddc05d7..213ab4a7 100644
--- a/src/heartratetask/HeartRateTask.cpp
+++ b/src/heartratetask/HeartRateTask.cpp
@@ -1,4 +1,4 @@
-#include "HeartRateTask.h"
+#include "heartratetask/HeartRateTask.h"
#include <drivers/Hrs3300.h>
#include <components/heartrate/HeartRateController.h>
#include <nrf_log.h>
diff --git a/src/logging/DummyLogger.h b/src/logging/DummyLogger.h
index 8732dff5..1b050b37 100644
--- a/src/logging/DummyLogger.h
+++ b/src/logging/DummyLogger.h
@@ -1,5 +1,5 @@
#pragma once
-#include "Logger.h"
+#include "logging/Logger.h"
namespace Pinetime {
namespace Logging {
diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp
index 1c048f2c..ab54afe9 100644
--- a/src/logging/NrfLogger.cpp
+++ b/src/logging/NrfLogger.cpp
@@ -1,4 +1,4 @@
-#include "NrfLogger.h"
+#include "logging/NrfLogger.h"
#include <libraries/log/nrf_log.h>
#include <libraries/log/nrf_log_ctrl.h>
diff --git a/src/logging/NrfLogger.h b/src/logging/NrfLogger.h
index 060c4e76..21183a3d 100644
--- a/src/logging/NrfLogger.h
+++ b/src/logging/NrfLogger.h
@@ -1,5 +1,5 @@
#pragma once
-#include "Logger.h"
+#include "logging/Logger.h"
#include <FreeRTOS.h>
#include <task.h>
diff --git a/src/main.cpp b/src/main.cpp
index fc772355..53f78ce8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -47,6 +47,7 @@
#include "systemtask/SystemTask.h"
#include "drivers/PinMap.h"
#include "touchhandler/TouchHandler.h"
+#include "buttonhandler/ButtonHandler.h"
#if NRF_LOG_ENABLED
#include "logging/NrfLogger.h"
@@ -96,8 +97,6 @@ TimerHandle_t debounceTimer;
TimerHandle_t debounceChargeTimer;
Pinetime::Controllers::Battery batteryController;
Pinetime::Controllers::Ble bleController;
-static constexpr uint8_t pinTouchIrq = Pinetime::PinMap::Cst816sIrq;
-static constexpr uint8_t pinPowerPresentIrq = Pinetime::PinMap::PowerPresent;
Pinetime::Controllers::HeartRateController heartRateController;
Pinetime::Applications::HeartRateTask heartRateApp(heartRateSensor, heartRateController);
@@ -110,6 +109,7 @@ Pinetime::Controllers::MotionController motionController;
Pinetime::Controllers::TimerController timerController;
Pinetime::Controllers::AlarmController alarmController {dateTimeController};
Pinetime::Controllers::TouchHandler touchHandler(touchPanel, lvgl);
+Pinetime::Controllers::ButtonHandler buttonHandler;
Pinetime::Controllers::FS fs {spiNorFlash};
Pinetime::Controllers::Settings settingsController {fs};
@@ -153,7 +153,8 @@ Pinetime::System::SystemTask systemTask(spi,
displayApp,
heartRateApp,
fs,
- touchHandler);
+ touchHandler,
+ buttonHandler);
/* Variable Declarations for variables in noinit SRAM
Increment NoInit_MagicValue upon adding variables to this area
@@ -176,11 +177,10 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
if (pin == Pinetime::PinMap::PowerPresent and action == NRF_GPIOTE_POLARITY_TOGGLE) {
xTimerStartFromISR(debounceChargeTimer, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
- return;
+ } else if (pin == Pinetime::PinMap::Button) {
+ xTimerStartFromISR(debounceTimer, &xHigherPriorityTaskWoken);
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
-
- xTimerStartFromISR(debounceTimer, &xHigherPriorityTaskWoken);
- portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
void DebounceTimerChargeCallback(TimerHandle_t xTimer) {
@@ -188,9 +188,8 @@ void DebounceTimerChargeCallback(TimerHandle_t xTimer) {
systemTask.PushMessage(Pinetime::System::Messages::OnChargingEvent);
}
-void DebounceTimerCallback(TimerHandle_t xTimer) {
- xTimerStop(xTimer, 0);
- systemTask.OnButtonPushed();
+void DebounceTimerCallback(TimerHandle_t /*unused*/) {
+ systemTask.PushMessage(Pinetime::System::Messages::HandleButtonEvent);
}
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) {
@@ -319,8 +318,8 @@ int main(void) {
}
nrf_gpio_cfg_default(Pinetime::PinMap::TwiScl);
- debounceTimer = xTimerCreate("debounceTimer", 200, pdFALSE, (void*) 0, DebounceTimerCallback);
- debounceChargeTimer = xTimerCreate("debounceTimerCharge", 200, pdFALSE, (void*) 0, DebounceTimerChargeCallback);
+ debounceTimer = xTimerCreate("debounceTimer", 10, pdFALSE, nullptr, DebounceTimerCallback);
+ debounceChargeTimer = xTimerCreate("debounceTimerCharge", 200, pdFALSE, nullptr, DebounceTimerChargeCallback);
// retrieve version stored by bootloader
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h
index 5aa218d2..b7142704 100644
--- a/src/systemtask/Messages.h
+++ b/src/systemtask/Messages.h
@@ -15,7 +15,8 @@ namespace Pinetime {
BleFirmwareUpdateStarted,
BleFirmwareUpdateFinished,
OnTouchEvent,
- OnButtonEvent,
+ HandleButtonEvent,
+ HandleButtonTimerEvent,
OnDisplayTaskSleeping,
EnableSleeping,
DisableSleeping,
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index e0a5907a..1120b80d 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -1,4 +1,4 @@
-#include "SystemTask.h"
+#include "systemtask/SystemTask.h"
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
@@ -25,7 +25,6 @@
#include "main.h"
#include "BootErrors.h"
-
#include <memory>
using namespace Pinetime::System;
@@ -77,7 +76,8 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
Pinetime::Applications::DisplayApp& displayApp,
Pinetime::Applications::HeartRateTask& heartRateApp,
Pinetime::Controllers::FS& fs,
- Pinetime::Controllers::TouchHandler& touchHandler)
+ Pinetime::Controllers::TouchHandler& touchHandler,
+ Pinetime::Controllers::ButtonHandler& buttonHandler)
: spi {spi},
lcd {lcd},
spiNorFlash {spiNorFlash},
@@ -101,8 +101,15 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
heartRateApp(heartRateApp),
fs {fs},
touchHandler {touchHandler},
- nimbleController(*this, bleController, dateTimeController, notificationManager,
- batteryController, spiNorFlash, heartRateController, motionController) {
+ buttonHandler {buttonHandler},
+ nimbleController(*this,
+ bleController,
+ dateTimeController,
+ notificationManager,
+ batteryController,
+ spiNorFlash,
+ heartRateController,
+ motionController) {
}
void SystemTask::Start() {
@@ -137,9 +144,15 @@ void SystemTask::Work() {
lcd.Init();
twiMaster.Init();
+ /*
+ * TODO We disable this warning message until we ensure it won't be displayed
+ * on legitimate PineTime equipped with a compatible touch controller.
+ * (some users reported false positive). See https://github.com/InfiniTimeOrg/InfiniTime/issues/763
if (!touchPanel.Init()) {
bootError = BootErrors::TouchController;
}
+ */
+ touchPanel.Init();
dateTimeController.Register(this);
batteryController.Register(this);
motorController.Init();
@@ -163,6 +176,8 @@ void SystemTask::Work() {
heartRateSensor.Disable();
heartRateApp.Start();
+ buttonHandler.Init(this);
+
// Button
nrf_gpio_cfg_output(15);
nrf_gpio_pin_set(15);
@@ -326,10 +341,25 @@ void SystemTask::Work() {
ReloadIdleTimer();
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
break;
- case Messages::OnButtonEvent:
- ReloadIdleTimer();
- displayApp.PushMessage(Pinetime::Applications::Display::Messages::ButtonPushed);
- break;
+ case Messages::HandleButtonEvent: {
+ Controllers::ButtonActions action;
+ if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) {
+ action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release);
+ } else {
+ action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press);
+ // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
+ if (IsSleeping()) {
+ fastWakeUpDone = true;
+ GoToRunning();
+ break;
+ }
+ }
+ HandleButtonAction(action);
+ } break;
+ case Messages::HandleButtonTimerEvent: {
+ auto action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Timer);
+ HandleButtonAction(action);
+ } break;
case Messages::OnDisplayTaskSleeping:
if (BootloaderVersion::IsValid()) {
// First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH
@@ -414,18 +444,36 @@ void SystemTask::UpdateMotion() {
}
}
-void SystemTask::OnButtonPushed() {
- if (isGoingToSleep)
+void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
+ if (IsSleeping()) {
return;
- if (!isSleeping) {
- NRF_LOG_INFO("[systemtask] Button pushed");
- PushMessage(Messages::OnButtonEvent);
- } else {
- if (!isWakingUp) {
- NRF_LOG_INFO("[systemtask] Button pushed, waking up");
- GoToRunning();
- }
}
+
+ ReloadIdleTimer();
+
+ using Actions = Controllers::ButtonActions;
+
+ switch (action) {
+ case Actions::Click:
+ // If the first action after fast wakeup is a click, it should be ignored.
+ if (!fastWakeUpDone && !isGoingToSleep) {
+ displayApp.PushMessage(Applications::Display::Messages::ButtonPushed);
+ }
+ break;
+ case Actions::DoubleClick:
+ displayApp.PushMessage(Applications::Display::Messages::ButtonDoubleClicked);
+ break;
+ case Actions::LongPress:
+ displayApp.PushMessage(Applications::Display::Messages::ButtonLongPressed);
+ break;
+ case Actions::LongerPress:
+ displayApp.PushMessage(Applications::Display::Messages::ButtonLongerPressed);
+ break;
+ default:
+ return;
+ }
+
+ fastWakeUpDone = false;
}
void SystemTask::GoToRunning() {
diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h
index 879c1be8..e2e6de7f 100644
--- a/src/systemtask/SystemTask.h
+++ b/src/systemtask/SystemTask.h
@@ -11,7 +11,7 @@
#include <drivers/PinMap.h>
#include <components/motion/MotionController.h>
-#include "SystemMonitor.h"
+#include "systemtask/SystemMonitor.h"
#include "components/battery/BatteryController.h"
#include "components/ble/NimbleController.h"
#include "components/ble/NotificationManager.h"
@@ -20,6 +20,8 @@
#include "components/alarm/AlarmController.h"
#include "components/fs/FS.h"
#include "touchhandler/TouchHandler.h"
+#include "buttonhandler/ButtonHandler.h"
+#include "buttonhandler/ButtonActions.h"
#ifdef PINETIME_IS_RECOVERY
#include "displayapp/DisplayAppRecovery.h"
@@ -31,7 +33,7 @@
#endif
#include "drivers/Watchdog.h"
-#include "Messages.h"
+#include "systemtask/Messages.h"
extern std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime;
namespace Pinetime {
@@ -45,6 +47,7 @@ namespace Pinetime {
}
namespace Controllers {
class TouchHandler;
+ class ButtonHandler;
}
namespace System {
class SystemTask {
@@ -71,12 +74,12 @@ namespace Pinetime {
Pinetime::Applications::DisplayApp& displayApp,
Pinetime::Applications::HeartRateTask& heartRateApp,
Pinetime::Controllers::FS& fs,
- Pinetime::Controllers::TouchHandler& touchHandler);
+ Pinetime::Controllers::TouchHandler& touchHandler,
+ Pinetime::Controllers::ButtonHandler& buttonHandler);
void Start();
void PushMessage(Messages msg);
- void OnButtonPushed();
void OnTouchEvent();
void OnIdle();
@@ -123,6 +126,7 @@ namespace Pinetime {
Pinetime::Applications::HeartRateTask& heartRateApp;
Pinetime::Controllers::FS& fs;
Pinetime::Controllers::TouchHandler& touchHandler;
+ Pinetime::Controllers::ButtonHandler& buttonHandler;
Pinetime::Controllers::NimbleController nimbleController;
static void Process(void* instance);
@@ -135,6 +139,9 @@ namespace Pinetime {
TimerHandle_t measureBatteryTimer;
bool doNotGoToSleep = false;
+ void HandleButtonAction(Controllers::ButtonActions action);
+ bool fastWakeUpDone = false;
+
void GoToRunning();
void UpdateMotion();
bool stepCounterMustBeReset = false;
diff --git a/src/touchhandler/TouchHandler.cpp b/src/touchhandler/TouchHandler.cpp
index 735b311a..0be33476 100644
--- a/src/touchhandler/TouchHandler.cpp
+++ b/src/touchhandler/TouchHandler.cpp
@@ -1,4 +1,4 @@
-#include "TouchHandler.h"
+#include "touchhandler/TouchHandler.h"
using namespace Pinetime::Controllers;