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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ list(APPEND SOURCE_FILES
displayapp/widgets/PageIndicator.cpp
displayapp/widgets/DotIndicator.cpp
displayapp/widgets/StatusIcons.cpp
displayapp/widgets/PopupMessage.cpp

## Settings
displayapp/screens/settings/QuickSettings.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES (3)
#define configMINIMAL_STACK_SIZE (120)
#define configTOTAL_HEAP_SIZE (1024 * 40)
#define configTOTAL_HEAP_SIZE (1024 * 35)
#define configMAX_TASK_NAME_LEN (4)
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
Expand Down
13 changes: 10 additions & 3 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ namespace Pinetime {
enum class WeatherFormat : uint8_t { Metric, Imperial };
enum class Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
enum class WakeUpMode : uint8_t {
SingleTap = 0,
DoubleTap = 1,
RaiseWrist = 2,
Shake = 3,
LowerWrist = 4,
ButtonUnlocks = 5,
};
enum class Colors : uint8_t {
White,
Silver,
Expand Down Expand Up @@ -260,7 +267,7 @@ namespace Pinetime {
}
};

std::bitset<5> getWakeUpModes() const {
std::bitset<6> getWakeUpModes() const {
return settings.wakeUpMode;
}

Expand Down Expand Up @@ -321,7 +328,7 @@ namespace Pinetime {

WatchFaceInfineat watchFaceInfineat;

std::bitset<5> wakeUpMode {0};
std::bitset<6> wakeUpMode {0};
uint16_t shakeWakeThreshold = 150;

Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
Expand Down
10 changes: 9 additions & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "displayapp/screens/Weather.h"
#include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h"
#include "displayapp/screens/Symbols.h"

#include "drivers/Cst816s.h"
#include "drivers/St7789.h"
Expand Down Expand Up @@ -101,6 +102,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
spiNorFlash {spiNorFlash},
lvgl {lcd, filesystem},
timer(this, TimerCallback),
popupMessage {Screens::Symbols::lock, 90, 90},
controllers {batteryController,
bleController,
dateTimeController,
Expand Down Expand Up @@ -461,6 +463,12 @@ void DisplayApp::Refresh() {
RestoreBrightness();
motorController.RunForDuration(15);
break;
case Messages::ShowIgnoreTouchPopup:
popupMessage.SetHidden(false);
break;
case Messages::HideIgnoreTouchPopup:
popupMessage.SetHidden(true);
break;
}
}

Expand Down Expand Up @@ -584,7 +592,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::SettingWeatherFormat>(settingsController);
break;
case Apps::SettingWakeUp:
currentScreen = std::make_unique<Screens::SettingWakeUp>(settingsController);
currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController);
break;
case Apps::SettingDisplay:
currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController);
Expand Down
3 changes: 3 additions & 0 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "components/timer/Timer.h"
#include "components/alarm/AlarmController.h"
#include "touchhandler/TouchHandler.h"
#include "displayapp/widgets/PopupMessage.h"

#include "displayapp/Messages.h"
#include "BootErrors.h"
Expand Down Expand Up @@ -103,6 +104,8 @@ namespace Pinetime {
Pinetime::Components::LittleVgl lvgl;
Pinetime::Controllers::Timer timer;

Pinetime::Applications::Widgets::PopupMessage popupMessage;

AppControllers controllers;
TaskHandle_t taskHandle;

Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace Pinetime {
Chime,
BleRadioEnableToggle,
OnChargingEvent,
ShowIgnoreTouchPopup,
HideIgnoreTouchPopup
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/fonts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
jetbrains_mono_extrabold_compressed lv_font_sys_48
jetbrains_mono_extrabold_compressed lv_font_sys_48 lv_font_sys_80
open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
Expand Down
10 changes: 10 additions & 0 deletions src/displayapp/fonts/fonts.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
"bpp": 1,
"size": 48
},
"lv_font_sys_80": {
"sources": [
{
"file": "material-design-icons/MaterialIcons-Regular.ttf",
"range": "0xe897"
}
],
"bpp": 1,
"size": 80
},
"fontawesome_weathericons": {
"sources": [
{
Expand Down
29 changes: 29 additions & 0 deletions src/displayapp/screens/Page.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include <cstdint>
#include <lvgl/lvgl.h>
#include "displayapp/screens/Screen.h"
#include "displayapp/widgets/PageIndicator.h"

namespace Pinetime {

namespace Applications {
namespace Screens {

class Page : public Screen {
public:
Page(uint8_t screenID, uint8_t numScreens, lv_obj_t* contentObj) : contentObj {contentObj}, pageIndicator(screenID, numScreens) {
pageIndicator.Create();
}

~Page() override {
lv_obj_clean(lv_scr_act());
}

private:
lv_obj_t* contentObj = nullptr;
Widgets::PageIndicator pageIndicator;
};
}
}
}
3 changes: 3 additions & 0 deletions src/displayapp/screens/Symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace Pinetime {

static constexpr const char* flashlight = "\xEF\x80\x8B";
static constexpr const char* paintbrushLg = "\xEE\x90\x8A";

// wake-up screenlock icon, from material icons
static constexpr const char* lock = "\xEE\xA2\x97";
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/displayapp/screens/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {

extern int mallocFailedCount;
extern int stackOverflowCount;

std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
Expand Down
10 changes: 9 additions & 1 deletion src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,15 @@ void WatchFaceAnalog::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();

if (notificationState.IsUpdated()) {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
if (notificationState.Get()) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else if (notificationManager.NbNotifications() > 0) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
}
}

currentDateTime = dateTimeController.CurrentDateTime();
Expand Down
10 changes: 9 additions & 1 deletion src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,15 @@ void WatchFaceCasioStyleG7710::Refresh() {

notificationState = notificatioManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
if (notificationState.Get()) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else if (notificatioManager.NbNotifications() > 0) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
}
}

currentDateTime = std::chrono::time_point_cast<std::chrono::minutes>(dateTimeController.CurrentDateTime());
Expand Down
10 changes: 9 additions & 1 deletion src/displayapp/screens/WatchFaceDigital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ void WatchFaceDigital::Refresh() {

notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
if (notificationState.Get()) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else if (notificationManager.NbNotifications() > 0) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
}
}

currentDateTime = std::chrono::time_point_cast<std::chrono::minutes>(dateTimeController.CurrentDateTime());
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceInfineat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
void WatchFaceInfineat::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
lv_obj_set_hidden(notificationIcon, !notificationState.Get());
lv_obj_set_hidden(notificationIcon, !(notificationState.Get() || (notificationManager.NbNotifications() > 0)));
lv_obj_align(notificationIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
}

Expand Down
16 changes: 15 additions & 1 deletion src/displayapp/screens/WatchFacePineTimeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,21 @@ void WatchFacePineTimeStyle::Refresh() {

notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
if (notificationState.Get()) {
lv_obj_set_style_local_text_color(notificationIcon,
LV_LABEL_PART_MAIN,
LV_STATE_DEFAULT,
Convert(settingsController.GetPTSColorTime()));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else if (notificationManager.NbNotifications() > 0) {
lv_obj_set_style_local_text_color(notificationIcon,
LV_LABEL_PART_MAIN,
LV_STATE_DEFAULT,
Convert(settingsController.GetPTSColorTime()));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
} else {
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
}
}

currentDateTime = dateTimeController.CurrentDateTime();
Expand Down
4 changes: 4 additions & 0 deletions src/displayapp/screens/WatchFaceTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void WatchFaceTerminal::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
if (notificationState.Get()) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text_static(notificationIcon, "You have mail.");
} else if (notificationManager.NbNotifications() > 0) {
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_label_set_text_static(notificationIcon, "You have mail.");
} else {
lv_label_set_text_static(notificationIcon, "");
Expand Down
46 changes: 38 additions & 8 deletions src/displayapp/screens/settings/SettingWakeUp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@

using namespace Pinetime::Applications::Screens;

constexpr std::array<SettingWakeUp::Option, 5> SettingWakeUp::options;
constexpr std::array<SettingWakeUp::Option, SettingWakeUp::numOptions> SettingWakeUp::options;

auto SettingWakeUp::CreateScreenList() {
std::array<std::function<std::unique_ptr<Screen>()>, nScreens> screens;
for (size_t i = 0; i < screens.size(); i++) {
screens[i] = [this, i]() -> std::unique_ptr<Screen> {
return CreateScreen(i);
};
}
return screens;
}

namespace {
void event_handler(lv_obj_t* obj, lv_event_t event) {
Expand All @@ -19,7 +29,16 @@ namespace {
}
}

SettingWakeUp::SettingWakeUp(Pinetime::Controllers::Settings& settingsController) : settingsController {settingsController} {
SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: settingsController {settingsController}, screens {app, 0, CreateScreenList(), Screens::ScreenListModes::UpDown} {
}

SettingWakeUp::~SettingWakeUp() {
lv_obj_clean(lv_scr_act());
settingsController.SaveSettings();
}

std::unique_ptr<Screen> SettingWakeUp::CreateScreen(size_t screenNum) {
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);

lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
Expand All @@ -43,20 +62,29 @@ SettingWakeUp::SettingWakeUp(Pinetime::Controllers::Settings& settingsController
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);

for (unsigned int i = 0; i < options.size(); i++) {
// cleanup any old pointers
cbOption.fill(nullptr);

// only loop as far as the list size aĺlows
unsigned int loopMax = screenNum * optionsPerScreen + optionsPerScreen;
if (loopMax > options.size()) {
loopMax = options.size();
}

for (unsigned int i = screenNum * optionsPerScreen; i < loopMax; i++) {
cbOption[i] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text(cbOption[i], options[i].name);
if (settingsController.isWakeUpModeOn(static_cast<Controllers::Settings::WakeUpMode>(i))) {
if (settingsController.isWakeUpModeOn(options[i].wakeUpMode)) {
lv_checkbox_set_checked(cbOption[i], true);
}
cbOption[i]->user_data = this;
lv_obj_set_event_cb(cbOption[i], event_handler);
}
return std::make_unique<Screens::Page>(screenNum, nScreens, container1);
}

SettingWakeUp::~SettingWakeUp() {
lv_obj_clean(lv_scr_act());
settingsController.SaveSettings();
bool SettingWakeUp::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}

void SettingWakeUp::UpdateSelected(lv_obj_t* object) {
Expand All @@ -74,6 +102,8 @@ void SettingWakeUp::UpdateSelected(lv_obj_t* object) {
// for example, when setting SingleTap, DoubleTap is unset and vice versa.
auto modes = settingsController.getWakeUpModes();
for (size_t i = 0; i < options.size(); ++i) {
lv_checkbox_set_checked(cbOption[i], modes[i]);
if (cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], modes[i]);
}
}
}
Loading