Compare commits
4 Commits
rr/fuzzy-c
...
wb/fuzzy-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
628ae886c5
|
||
|
|
d7955498ff
|
||
|
|
9729047f1f
|
||
|
|
104e750a75
|
@@ -64,6 +64,7 @@ CmakeGenerate() {
|
|||||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||||
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
|
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
|
||||||
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
|
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
|
||||||
|
-DBUILD_RESOURCES=0
|
||||||
"$SOURCES_DIR"
|
"$SOURCES_DIR"
|
||||||
cmake -L -N .
|
cmake -L -N .
|
||||||
}
|
}
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -3,7 +3,7 @@ name: CI
|
|||||||
# Run this workflow whenever the build may be affected
|
# Run this workflow whenever the build may be affected
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main, wb/fuzzy-clock ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'doc/**'
|
- 'doc/**'
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|||||||
@@ -427,6 +427,8 @@ list(APPEND SOURCE_FILES
|
|||||||
## Watch faces
|
## Watch faces
|
||||||
displayapp/screens/WatchFaceAnalog.cpp
|
displayapp/screens/WatchFaceAnalog.cpp
|
||||||
displayapp/screens/WatchFaceDigital.cpp
|
displayapp/screens/WatchFaceDigital.cpp
|
||||||
|
displayapp/screens/WatchFaceInfineat.cpp
|
||||||
|
displayapp/screens/WatchFacePineTimeStyle.cpp
|
||||||
displayapp/screens/WatchFaceCasioStyleG7710.cpp
|
displayapp/screens/WatchFaceCasioStyleG7710.cpp
|
||||||
displayapp/screens/WatchFaceFuzzy.cpp
|
displayapp/screens/WatchFaceFuzzy.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ namespace Pinetime {
|
|||||||
enum class WatchFace : uint8_t {
|
enum class WatchFace : uint8_t {
|
||||||
Digital = 0,
|
Digital = 0,
|
||||||
Analog = 1,
|
Analog = 1,
|
||||||
CasioStyleG7710 = 2,
|
PineTimeStyle = 2,
|
||||||
Fuzzy = 3,
|
Infineat = 3,
|
||||||
|
CasioStyleG7710 = 4,
|
||||||
|
Fuzzy = 5,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
#include "components/settings/Settings.h"
|
#include "components/settings/Settings.h"
|
||||||
#include "displayapp/DisplayApp.h"
|
#include "displayapp/DisplayApp.h"
|
||||||
#include "displayapp/screens/WatchFaceDigital.h"
|
#include "displayapp/screens/WatchFaceDigital.h"
|
||||||
|
#include "displayapp/screens/WatchFaceInfineat.h"
|
||||||
#include "displayapp/screens/WatchFaceAnalog.h"
|
#include "displayapp/screens/WatchFaceAnalog.h"
|
||||||
#include "displayapp/screens/WatchFaceFuzzy.h"
|
#include "displayapp/screens/WatchFaceFuzzy.h"
|
||||||
|
#include "displayapp/screens/WatchFacePineTimeStyle.h"
|
||||||
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
||||||
|
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
@@ -41,6 +43,15 @@ Clock::Clock(Controllers::DateTime& dateTimeController,
|
|||||||
case WatchFace::Analog:
|
case WatchFace::Analog:
|
||||||
return WatchFaceAnalogScreen();
|
return WatchFaceAnalogScreen();
|
||||||
break;
|
break;
|
||||||
|
case WatchFace::PineTimeStyle:
|
||||||
|
return WatchFacePineTimeStyleScreen();
|
||||||
|
break;
|
||||||
|
case WatchFace::Terminal:
|
||||||
|
return WatchFaceTerminalScreen();
|
||||||
|
break;
|
||||||
|
case WatchFace::Infineat:
|
||||||
|
return WatchFaceInfineatScreen();
|
||||||
|
break;
|
||||||
case WatchFace::CasioStyleG7710:
|
case WatchFace::CasioStyleG7710:
|
||||||
return WatchFaceCasioStyleG7710();
|
return WatchFaceCasioStyleG7710();
|
||||||
break;
|
break;
|
||||||
@@ -83,6 +94,36 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
|||||||
settingsController);
|
settingsController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
|
||||||
|
return std::make_unique<Screens::WatchFacePineTimeStyle>(dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
bleController,
|
||||||
|
notificationManager,
|
||||||
|
settingsController,
|
||||||
|
motionController,
|
||||||
|
weatherService);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {
|
||||||
|
return std::make_unique<Screens::WatchFaceTerminal>(dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
bleController,
|
||||||
|
notificationManager,
|
||||||
|
settingsController,
|
||||||
|
heartRateController,
|
||||||
|
motionController);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Screen> Clock::WatchFaceInfineatScreen() {
|
||||||
|
return std::make_unique<Screens::WatchFaceInfineat>(dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
bleController,
|
||||||
|
notificationManager,
|
||||||
|
settingsController,
|
||||||
|
motionController,
|
||||||
|
filesystem);
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceCasioStyleG7710() {
|
std::unique_ptr<Screen> Clock::WatchFaceCasioStyleG7710() {
|
||||||
return std::make_unique<Screens::WatchFaceCasioStyleG7710>(dateTimeController,
|
return std::make_unique<Screens::WatchFaceCasioStyleG7710>(dateTimeController,
|
||||||
batteryController,
|
batteryController,
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
#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(Controllers::DateTime& dateTimeController,
|
|
||||||
const Controllers::Battery& batteryController,
|
|
||||||
const Controllers::Ble& bleController,
|
|
||||||
Controllers::NotificationManager& notificationManager,
|
|
||||||
Controllers::Settings& settingsController,
|
|
||||||
Controllers::HeartRateController& heartRateController,
|
|
||||||
Controllers::MotionController& motionController)
|
|
||||||
: currentDateTime {{}},
|
|
||||||
dateTimeController {dateTimeController},
|
|
||||||
batteryController {batteryController},
|
|
||||||
bleController {bleController},
|
|
||||||
notificationManager {notificationManager},
|
|
||||||
settingsController {settingsController},
|
|
||||||
heartRateController {heartRateController},
|
|
||||||
motionController {motionController} {
|
|
||||||
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_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
|
||||||
|
|
||||||
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
|
|
||||||
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100);
|
|
||||||
|
|
||||||
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_static(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_static(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);
|
|
||||||
|
|
||||||
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
|
|
||||||
lv_label_set_recolor(heartbeatValue, true);
|
|
||||||
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_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();
|
|
||||||
batteryPercentRemaining = batteryController.PercentRemaining();
|
|
||||||
if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) {
|
|
||||||
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%%", batteryPercentRemaining.Get());
|
|
||||||
if (batteryController.IsPowerPresent()) {
|
|
||||||
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bleState = bleController.IsConnected();
|
|
||||||
bleRadioEnabled = bleController.IsRadioEnabled();
|
|
||||||
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
|
|
||||||
if (!bleRadioEnabled.Get()) {
|
|
||||||
lv_label_set_text_static(connectState, "[STAT]#0082fc Disabled#");
|
|
||||||
} else {
|
|
||||||
if (bleState.Get()) {
|
|
||||||
lv_label_set_text_static(connectState, "[STAT]#0082fc Connected#");
|
|
||||||
} else {
|
|
||||||
lv_label_set_text_static(connectState, "[STAT]#0082fc Disconnected#");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notificationState = notificationManager.AreNewNotificationsAvailable();
|
|
||||||
if (notificationState.IsUpdated()) {
|
|
||||||
if (notificationState.Get()) {
|
|
||||||
lv_label_set_text_static(notificationIcon, "You have mail.");
|
|
||||||
} else {
|
|
||||||
lv_label_set_text_static(notificationIcon, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentDateTime = std::chrono::time_point_cast<std::chrono::seconds>(dateTimeController.CurrentDateTime());
|
|
||||||
if (currentDateTime.IsUpdated()) {
|
|
||||||
uint8_t hour = dateTimeController.Hours();
|
|
||||||
uint8_t minute = dateTimeController.Minutes();
|
|
||||||
uint8_t second = dateTimeController.Seconds();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
|
|
||||||
if (currentDate.IsUpdated()) {
|
|
||||||
uint16_t year = dateTimeController.Year();
|
|
||||||
Controllers::DateTime::Months month = dateTimeController.Month();
|
|
||||||
uint8_t day = dateTimeController.Day();
|
|
||||||
lv_label_set_text_fmt(label_date, "[DATE]#007fff %04d-%02d-%02d#", short(year), char(month), char(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();
|
|
||||||
if (stepCount.IsUpdated()) {
|
|
||||||
lv_label_set_text_fmt(stepValue, "[STEP]#ee3377 %lu steps#", stepCount.Get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#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"
|
|
||||||
#include "utility/DirtyValue.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(Controllers::DateTime& dateTimeController,
|
|
||||||
const Controllers::Battery& batteryController,
|
|
||||||
const Controllers::Ble& bleController,
|
|
||||||
Controllers::NotificationManager& notificationManager,
|
|
||||||
Controllers::Settings& settingsController,
|
|
||||||
Controllers::HeartRateController& heartRateController,
|
|
||||||
Controllers::MotionController& motionController);
|
|
||||||
~WatchFaceTerminal() override;
|
|
||||||
|
|
||||||
void Refresh() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Utility::DirtyValue<int> batteryPercentRemaining {};
|
|
||||||
Utility::DirtyValue<bool> powerPresent {};
|
|
||||||
Utility::DirtyValue<bool> bleState {};
|
|
||||||
Utility::DirtyValue<bool> bleRadioEnabled {};
|
|
||||||
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> currentDateTime {};
|
|
||||||
Utility::DirtyValue<uint32_t> stepCount {};
|
|
||||||
Utility::DirtyValue<uint8_t> heartbeat {};
|
|
||||||
Utility::DirtyValue<bool> heartbeatRunning {};
|
|
||||||
Utility::DirtyValue<bool> notificationState {};
|
|
||||||
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
|
|
||||||
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
|
|
||||||
|
|
||||||
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* batteryValue;
|
|
||||||
lv_obj_t* heartbeatValue;
|
|
||||||
lv_obj_t* stepValue;
|
|
||||||
lv_obj_t* notificationIcon;
|
|
||||||
lv_obj_t* connectState;
|
|
||||||
|
|
||||||
Controllers::DateTime& dateTimeController;
|
|
||||||
const Controllers::Battery& batteryController;
|
|
||||||
const Controllers::Ble& bleController;
|
|
||||||
Controllers::NotificationManager& notificationManager;
|
|
||||||
Controllers::Settings& settingsController;
|
|
||||||
Controllers::HeartRateController& heartRateController;
|
|
||||||
Controllers::MotionController& motionController;
|
|
||||||
|
|
||||||
lv_task_t* taskRefresh;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "displayapp/screens/Screen.h"
|
#include "displayapp/screens/Screen.h"
|
||||||
#include "displayapp/screens/Symbols.h"
|
#include "displayapp/screens/Symbols.h"
|
||||||
#include "displayapp/screens/CheckboxList.h"
|
#include "displayapp/screens/CheckboxList.h"
|
||||||
|
#include "displayapp/screens/WatchFaceInfineat.h"
|
||||||
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
||||||
#include "displayapp/screens/WatchFaceFuzzy.h"
|
#include "displayapp/screens/WatchFaceFuzzy.h"
|
||||||
|
|
||||||
@@ -43,6 +44,8 @@ namespace Pinetime {
|
|||||||
std::array<Screens::CheckboxList::Item, settingsPerScreen * nScreens> watchfaces {
|
std::array<Screens::CheckboxList::Item, settingsPerScreen * nScreens> watchfaces {
|
||||||
{{"Digital face", true},
|
{{"Digital face", true},
|
||||||
{"Analog face", true},
|
{"Analog face", true},
|
||||||
|
{"PineTimeStyle", true},
|
||||||
|
{"Infineat face", Applications::Screens::WatchFaceInfineat::IsAvailable(filesystem)},
|
||||||
{"Casio G7710", Applications::Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem)},
|
{"Casio G7710", Applications::Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem)},
|
||||||
{"Fuzzy Clock", true},
|
{"Fuzzy Clock", true},
|
||||||
{"", false}}};
|
{"", false}}};
|
||||||
|
|||||||
Reference in New Issue
Block a user