mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-12-27 03:32:37 +03:00
Manual squash merge of PR #932 (https://github.com/InfiniTimeOrg/InfiniTime/pull/932) from 13werwolf13 (https://github.com/13werwolf13). This PR adds a new Terminal watchface to InfiniTime!
Squashed commit of the following: commit 23ea840b059c69667c8711265cecaf992791acb6 Author: Jean-François Milants <jf@codingfield.com> Date: Sun Feb 20 13:14:27 2022 +0100 Terminal watch face : fix includes and a few code cleaning. commit 3c244def25e3ad8e1f56d708fb0864c122059948 Merge:40790868
138a6552
Author: Jean-François Milants <jf@codingfield.com> Date: Sun Feb 20 12:45:54 2022 +0100 Merge branch 'develop' of https://github.com/13werwolf13/InfiniTime into 13werwolf13-develop commit138a65528a
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:13:00 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit35156166b2
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:43 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit757ca2dd43
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:30 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit60b6b4e582
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:20 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit6959d8c043
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:11:46 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit4d850281be
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:11:17 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commitaf483bee33
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:10:57 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit6bc6c1a637
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:10:40 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit25fdafc6ab
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:06:10 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit12e1b0f8c0
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:44 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commite6c0f32056
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:22 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit342ce8cd11
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:06 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit265fec5eec
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:04:06 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commitb4669be38b
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:03:29 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit471a843909
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:03:10 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commit6853166cf5
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:02:51 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commitbba34f69bf
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 22 12:32:41 2022 +0500 some fixes commit74eea9f580
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 22 12:32:17 2022 +0500 some fixes commit1e4a6763d7
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Fri Jan 21 08:59:44 2022 +0500 no errors, no warnings, no work.. commiteb8bd4dc4e
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 23:50:04 2022 +0500 add ble state text output commitfda1c088be
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 22:25:35 2022 +0500 add ble state text output commit68d3d9b343
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 22:22:20 2022 +0500 add ble state text output commit0ed45a9916
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Tue Jan 18 15:48:15 2022 +0500 typo fix commit477a3a7f27
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Tue Jan 18 10:36:19 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commitd6849888ea
Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Tue Jan 18 10:36:09 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner <pyro4hell@gmail.com> commite2f7e31829
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Mon Jan 17 13:34:05 2022 +0500 typo fix commitfc246beb01
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 15 15:26:25 2022 +0500 typo fix commitebbb31abf1
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Fri Jan 14 10:08:29 2022 +0500 typo fix commit3afedcaa28
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:34:39 2022 +0500 time format commit471a4c942f
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:27:10 2022 +0500 time format commitd3fd348de4
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:26:49 2022 +0500 time format commite540d103e3
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 11:28:31 2022 +0500 add patch commit728830178f
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 22:08:07 2022 +0500 add menue item commit4c5847669f
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 21:42:22 2022 +0500 typo fix commit79273fe24f
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 20:48:06 2022 +0500 typo fix commit1808a78ad9
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 20:17:15 2022 +0500 typo fix commit6dfa141dca
Author: Дмитрий Марков <markov@promobit.ru> Date: Wed Jan 12 20:12:09 2022 +0500 typo fix commit88f0190232
Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 14:50:54 2022 +0500 add terminal watchface
This commit is contained in:
parent
407908686a
commit
69e4ab6be1
@ -454,6 +454,7 @@ list(APPEND SOURCE_FILES
|
||||
displayapp/icons/bg_clock.c
|
||||
displayapp/screens/WatchFaceAnalog.cpp
|
||||
displayapp/screens/WatchFaceDigital.cpp
|
||||
displayapp/screens/WatchFaceTerminal.cpp
|
||||
displayapp/screens/PineTimeStyle.cpp
|
||||
|
||||
##
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include "components/heartrate/Biquad.h"
|
||||
#include "components/heartrate/Ptagc.h"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/WatchFaceDigital.h"
|
||||
#include "displayapp/screens/WatchFaceTerminal.h"
|
||||
#include "displayapp/screens/WatchFaceAnalog.h"
|
||||
#include "displayapp/screens/PineTimeStyle.h"
|
||||
|
||||
@ -41,6 +42,9 @@ Clock::Clock(DisplayApp* app,
|
||||
case 2:
|
||||
return PineTimeStyleScreen();
|
||||
break;
|
||||
case 3:
|
||||
return WatchFaceTerminalScreen();
|
||||
break;
|
||||
}
|
||||
return WatchFaceDigitalScreen();
|
||||
}()} {
|
||||
@ -76,11 +80,17 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
|
||||
return std::make_unique<Screens::PineTimeStyle>(app,
|
||||
dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificatioManager,
|
||||
settingsController,
|
||||
motionController);
|
||||
return std::make_unique<Screens::PineTimeStyle>(
|
||||
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {
|
||||
return std::make_unique<Screens::WatchFaceTerminal>(app,
|
||||
dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificatioManager,
|
||||
settingsController,
|
||||
heartRateController,
|
||||
motionController);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ namespace Pinetime {
|
||||
std::unique_ptr<Screen> WatchFaceDigitalScreen();
|
||||
std::unique_ptr<Screen> WatchFaceAnalogScreen();
|
||||
std::unique_ptr<Screen> PineTimeStyleScreen();
|
||||
std::unique_ptr<Screen> WatchFaceTerminalScreen();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
198
src/displayapp/screens/WatchFaceTerminal.cpp
Normal file
198
src/displayapp/screens/WatchFaceTerminal.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
#include <date/date.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/screens/WatchFaceTerminal.h"
|
||||
#include "displayapp/screens/BatteryIcon.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/heartrate/HeartRateController.h"
|
||||
#include "components/motion/MotionController.h"
|
||||
#include "components/settings/Settings.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::Battery& batteryController,
|
||||
Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificatioManager,
|
||||
Controllers::Settings& settingsController,
|
||||
Controllers::HeartRateController& heartRateController,
|
||||
Controllers::MotionController& motionController)
|
||||
: Screen(app),
|
||||
currentDateTime {{}},
|
||||
dateTimeController {dateTimeController},
|
||||
batteryController {batteryController},
|
||||
bleController {bleController},
|
||||
notificatioManager {notificatioManager},
|
||||
settingsController {settingsController},
|
||||
heartRateController {heartRateController},
|
||||
motionController {motionController} {
|
||||
settingsController.SetClockFace(3);
|
||||
|
||||
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryIcon, Symbols::batteryFull);
|
||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2);
|
||||
|
||||
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryPlug, Symbols::plug);
|
||||
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
batteryValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(batteryValue, true);
|
||||
lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
|
||||
|
||||
connectState = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(connectState, true);
|
||||
lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#");
|
||||
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
||||
|
||||
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0);
|
||||
|
||||
label_date = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label_date, true);
|
||||
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -40);
|
||||
|
||||
label_prompt_1 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80);
|
||||
lv_label_set_text(label_prompt_1, "user@watch:~ $ now");
|
||||
|
||||
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
|
||||
lv_label_set_text(label_prompt_2, "user@watch:~ $");
|
||||
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label_time, true);
|
||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -60);
|
||||
|
||||
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_click(backgroundLabel, true);
|
||||
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
||||
lv_obj_set_size(backgroundLabel, 240, 240);
|
||||
lv_obj_set_pos(backgroundLabel, 0, 0);
|
||||
lv_label_set_text(backgroundLabel, "");
|
||||
|
||||
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(heartbeatValue, true);
|
||||
lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#");
|
||||
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20);
|
||||
|
||||
stepValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(stepValue, true);
|
||||
lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#");
|
||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
|
||||
|
||||
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
WatchFaceTerminal::~WatchFaceTerminal() {
|
||||
lv_task_del(taskRefresh);
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
void WatchFaceTerminal::Refresh() {
|
||||
powerPresent = batteryController.IsPowerPresent();
|
||||
if (powerPresent.IsUpdated()) {
|
||||
lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get()));
|
||||
}
|
||||
|
||||
batteryPercentRemaining = batteryController.PercentRemaining();
|
||||
if (batteryPercentRemaining.IsUpdated()) {
|
||||
auto batteryPercent = batteryPercentRemaining.Get();
|
||||
if (batteryPercent == 100) {
|
||||
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
|
||||
} else {
|
||||
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
}
|
||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
||||
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent);
|
||||
}
|
||||
|
||||
bleState = bleController.IsConnected();
|
||||
if (bleState.IsUpdated()) {
|
||||
if (bleState.Get()) {
|
||||
lv_label_set_text_static(connectState, "[STAT]#387b54 Connected#");
|
||||
} else {
|
||||
lv_label_set_text_static(connectState, "[STAT]#387b54 Disconnected#");
|
||||
}
|
||||
}
|
||||
|
||||
notificationState = notificatioManager.AreNewNotificationsAvailable();
|
||||
if (notificationState.IsUpdated()) {
|
||||
if (notificationState.Get()) {
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
|
||||
} else {
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
}
|
||||
}
|
||||
|
||||
currentDateTime = dateTimeController.CurrentDateTime();
|
||||
|
||||
if (currentDateTime.IsUpdated()) {
|
||||
auto newDateTime = currentDateTime.Get();
|
||||
|
||||
auto dp = date::floor<date::days>(newDateTime);
|
||||
auto time = date::make_time(newDateTime - dp);
|
||||
auto yearMonthDay = date::year_month_day(dp);
|
||||
|
||||
auto year = static_cast<int>(yearMonthDay.year());
|
||||
auto month = static_cast<Pinetime::Controllers::DateTime::Months>(static_cast<unsigned>(yearMonthDay.month()));
|
||||
auto day = static_cast<unsigned>(yearMonthDay.day());
|
||||
auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
|
||||
|
||||
uint8_t hour = time.hours().count();
|
||||
uint8_t minute = time.minutes().count();
|
||||
uint8_t second = time.seconds().count();
|
||||
|
||||
if (displayedHour != hour || displayedMinute != minute || displayedSecond != second) {
|
||||
displayedHour = hour;
|
||||
displayedMinute = minute;
|
||||
displayedSecond = second;
|
||||
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||
char ampmChar[3] = "AM";
|
||||
if (hour == 0) {
|
||||
hour = 12;
|
||||
} else if (hour == 12) {
|
||||
ampmChar[0] = 'P';
|
||||
} else if (hour > 12) {
|
||||
hour = hour - 12;
|
||||
ampmChar[0] = 'P';
|
||||
}
|
||||
lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d %s#", hour, minute, second, ampmChar);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second);
|
||||
}
|
||||
}
|
||||
|
||||
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
||||
lv_label_set_text_fmt(label_date, "[DATE]#007fff %04d.%02d.%02d#", short(year), char(month), char(day));
|
||||
|
||||
currentYear = year;
|
||||
currentMonth = month;
|
||||
currentDayOfWeek = dayOfWeek;
|
||||
currentDay = day;
|
||||
}
|
||||
}
|
||||
|
||||
heartbeat = heartRateController.HeartRate();
|
||||
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
|
||||
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
|
||||
if (heartbeatRunning.Get()) {
|
||||
lv_label_set_text_fmt(heartbeatValue, "[L_HR]#ee3311 %d bpm#", heartbeat.Get());
|
||||
} else {
|
||||
lv_label_set_text_static(heartbeatValue, "[L_HR]#ee3311 ---#");
|
||||
}
|
||||
}
|
||||
|
||||
stepCount = motionController.NbSteps();
|
||||
motionSensorOk = motionController.IsSensorOk();
|
||||
if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
|
||||
lv_label_set_text_fmt(stepValue, "[STEP]#ee3377 %lu steps#", stepCount.Get());
|
||||
}
|
||||
}
|
82
src/displayapp/screens/WatchFaceTerminal.h
Normal file
82
src/displayapp/screens/WatchFaceTerminal.h
Normal file
@ -0,0 +1,82 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class Settings;
|
||||
class Battery;
|
||||
class Ble;
|
||||
class NotificationManager;
|
||||
class HeartRateController;
|
||||
class MotionController;
|
||||
}
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class WatchFaceTerminal : public Screen {
|
||||
public:
|
||||
WatchFaceTerminal(DisplayApp* app,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::Battery& batteryController,
|
||||
Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificatioManager,
|
||||
Controllers::Settings& settingsController,
|
||||
Controllers::HeartRateController& heartRateController,
|
||||
Controllers::MotionController& motionController);
|
||||
~WatchFaceTerminal() override;
|
||||
|
||||
void Refresh() override;
|
||||
|
||||
private:
|
||||
uint8_t displayedHour = -1;
|
||||
uint8_t displayedMinute = -1;
|
||||
uint8_t displayedSecond = -1;
|
||||
|
||||
uint16_t currentYear = 1970;
|
||||
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
||||
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
||||
uint8_t currentDay = 0;
|
||||
|
||||
DirtyValue<int> batteryPercentRemaining {};
|
||||
DirtyValue<bool> powerPresent {};
|
||||
DirtyValue<bool> bleState {};
|
||||
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
||||
DirtyValue<bool> motionSensorOk {};
|
||||
DirtyValue<uint32_t> stepCount {};
|
||||
DirtyValue<uint8_t> heartbeat {};
|
||||
DirtyValue<bool> heartbeatRunning {};
|
||||
DirtyValue<bool> notificationState {};
|
||||
|
||||
lv_obj_t* label_time;
|
||||
lv_obj_t* label_date;
|
||||
lv_obj_t* label_prompt_1;
|
||||
lv_obj_t* label_prompt_2;
|
||||
lv_obj_t* backgroundLabel;
|
||||
lv_obj_t* batteryIcon;
|
||||
lv_obj_t* batteryPlug;
|
||||
lv_obj_t* batteryValue;
|
||||
lv_obj_t* heartbeatValue;
|
||||
lv_obj_t* stepValue;
|
||||
lv_obj_t* notificationIcon;
|
||||
lv_obj_t* connectState;
|
||||
|
||||
Controllers::DateTime& dateTimeController;
|
||||
Controllers::Battery& batteryController;
|
||||
Controllers::Ble& bleController;
|
||||
Controllers::NotificationManager& notificatioManager;
|
||||
Controllers::Settings& settingsController;
|
||||
Controllers::HeartRateController& heartRateController;
|
||||
Controllers::MotionController& motionController;
|
||||
|
||||
lv_task_t* taskRefresh;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::array<const char*, 3> SettingWatchFace::options;
|
||||
constexpr std::array<const char*, 4> SettingWatchFace::options;
|
||||
|
||||
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
@ -20,7 +20,7 @@ namespace Pinetime {
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
static constexpr std::array<const char*, 3> options = {" Digital face", " Analog face", " PineTimeStyle"};
|
||||
static constexpr std::array<const char*, 4> options = {" Digital face", " Analog face", " PineTimeStyle", " Terminal"};
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
lv_obj_t* cbOption[options.size()];
|
||||
|
Loading…
Reference in New Issue
Block a user