Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds vibration strength settings #2231

Closed
wants to merge 44 commits into from
Closed
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
90bc1f6
feat: add version of casio watchface with weather
Ghoelian Aug 3, 2024
adef8e8
fix: align weather temperature with date
Ghoelian Aug 3, 2024
7e75680
fix: add degrees symbol and C/F to 7 segment 40 point font
Ghoelian Aug 3, 2024
ff352f4
chore: ignore node_modules
Ghoelian Aug 3, 2024
ffff67a
feat: add notification and chime vibration settings
Ghoelian Aug 3, 2024
cfe11ef
Merge branch 'vibration-settings' into ghoelian
Ghoelian Aug 3, 2024
d57ae5c
feat: make weather a setting
Ghoelian Aug 4, 2024
756b4f9
fix: flipped the hiding around
Ghoelian Aug 4, 2024
c22a9df
feat: reaset timeout tick on tap
Ghoelian Aug 4, 2024
4746a3f
Merge branch 'casio-weather' into ghoelian
Ghoelian Aug 4, 2024
93f1002
feat: add json style watchface
Ghoelian Aug 5, 2024
123c4ed
Merge branch 'json-watchface' into ghoelian
Ghoelian Aug 5, 2024
279bf77
chore: also run workflows on my branch
Ghoelian Aug 28, 2024
950ac01
feat: don't wake screen on chime
Ghoelian Aug 28, 2024
41d2ccd
Revert "feat: don't wake screen on chime"
Ghoelian Aug 28, 2024
6cc9662
Merge branch 'main' into casio-weather
Ghoelian Aug 29, 2024
a3f7dc1
Merge https://github.com/InfiniTimeOrg/InfiniTime into ghoelian
Ghoelian Nov 17, 2024
28c6958
Merge branch 'ghoelian' of github.com:Ghoelian/InfiniTime into ghoelian
Ghoelian Nov 21, 2024
b691d8d
chore: remove json watchface
Ghoelian Nov 21, 2024
884a508
chore: add node packages
Ghoelian Nov 21, 2024
569c3a2
chore: add build.sh
Ghoelian Nov 21, 2024
e75735b
chore: remove json watchface
Ghoelian Nov 21, 2024
1bade4b
Merge branch 'InfiniTimeOrg:main' into casio-weather
Ghoelian Nov 21, 2024
76da8d5
fix: update casio watchface to use new SimpleWeatherService attributes
Ghoelian Nov 21, 2024
e33750c
Merge branch 'casio-weather' into ghoelian
Ghoelian Nov 21, 2024
d38b435
fix: remove temperature rounding
Ghoelian Nov 21, 2024
db9e91a
fix: remove temperature rounding
Ghoelian Nov 21, 2024
eb6c362
feat: add option to switch which segment gets replaced with weather
Ghoelian Nov 25, 2024
2d180c8
Merge branch 'InfiniTimeOrg:main' into casio-weather
Ghoelian Nov 25, 2024
5728a4b
Merge branch 'ghoelian' into casio-weather
Ghoelian Dec 2, 2024
26a1fcb
Merge pull request #1 from Ghoelian/casio-weather
Ghoelian Dec 2, 2024
1ebce84
Merge branch 'main' into casio-weather
Ghoelian Jan 21, 2025
ecc44e8
Merge pull request #2 from Ghoelian/casio-weather
Ghoelian Jan 21, 2025
9262b85
chore: ignore node_modules
Ghoelian Aug 3, 2024
87a38d4
feat: add notification and chime vibration settings
Ghoelian Aug 3, 2024
2d7e7d9
chore: add tachometer icon for now
Ghoelian Jan 21, 2025
107e0cc
chore: fix formatting
Ghoelian Jan 23, 2025
61390ec
Merge branch 'main' into casio-weather
Ghoelian Jan 24, 2025
34731a2
fix: fix alignment of weather segments
Ghoelian Jan 26, 2025
3b81510
Merge branch 'casio-weather' of github.com:Ghoelian/InfiniTime into c…
Ghoelian Jan 26, 2025
52fe3a6
fix: also fix alignment of other weather segment
Ghoelian Jan 26, 2025
0682ec5
Merge branch 'InfiniTimeOrg:main' into ghoelian
Ghoelian Jan 26, 2025
b645d58
Merge pull request #3 from Ghoelian/casio-weather
Ghoelian Jan 26, 2025
242b3e0
Merge branch 'ghoelian' into vibration-settings
Ghoelian Jan 26, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@ name: CI
# Run this workflow whenever the build may be affected
on:
push:
branches: [ main ]
branches: [ main, ghoelian ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, ghoelian ]
paths-ignore:
- 'doc/**'
- '**.md'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -50,3 +50,5 @@ src/arm-none-eabi

# clangd
.cache/

node_modules/
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

mkdir -p build
cd build

echo "Configuring build..."
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH="/workspaces/infinitime/gcc-arm" -DNRF5_SDK_PATH="/workspaces/infinitime/nRF5_SDK" -DCMAKE_BUILD_TYPE="Release" -DBUILD_DFU=1 -DBUILD_RESOURCES=1 -DTARGET_DEVICE="PINETIME" ..
echo "Finished configuring build"

echo "Building..."
make -j4 pinetime-mcuboot-app
echo "Finished building"
119 changes: 119 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"lv_font_conv": "^1.5.3"
}
}
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -418,6 +418,8 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingChimes.cpp
displayapp/screens/settings/SettingShakeThreshold.cpp
displayapp/screens/settings/SettingBluetooth.cpp
displayapp/screens/settings/SettingNotifVibration.cpp
displayapp/screens/settings/SettingChimeVibration.cpp

## Watch faces
displayapp/screens/WatchFaceAnalog.cpp
56 changes: 56 additions & 0 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ namespace Pinetime {
Orange,
Pink
};
enum class VibrationStrength : uint8_t { Weak = 15, Normal = 35, Strong = 75 };
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
enum class PTSWeather : uint8_t { On, Off };

@@ -45,6 +46,13 @@ namespace Pinetime {
PTSWeather weatherEnable = PTSWeather::Off;
};

enum class CasioWeatherSegment : uint8_t { WeekNumber, DayCounter, DayOfWeek };

struct CasioStyleG7710 {
PTSWeather weatherEnable = PTSWeather::Off;
CasioWeatherSegment weatherSegment = CasioWeatherSegment::DayCounter;
};

struct WatchFaceInfineat {
bool showSideCover = true;
int colorIndex = 0;
@@ -154,6 +162,27 @@ namespace Pinetime {
return settings.PTS.weatherEnable;
};

void SetCasioWeather(PTSWeather weatherEnable) {
if (weatherEnable != settings.casio.weatherEnable)
settingsChanged = true;
settings.casio.weatherEnable = weatherEnable;
}

PTSWeather GetCasioWeather() const {
return settings.casio.weatherEnable;
}

void SetCasioWeatherSegment(CasioWeatherSegment weatherSegment) {
if (weatherSegment != settings.casio.weatherSegment)
settingsChanged = true;

settings.casio.weatherSegment = weatherSegment;
}

CasioWeatherSegment GetCasioWeatherSegment() const {
return settings.casio.weatherSegment;
}

void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
@@ -298,6 +327,28 @@ namespace Pinetime {
return bleRadioEnabled;
};

void SetNotifVibration(VibrationStrength strength) {
if (strength != settings.notifVibration) {
settingsChanged = true;
}
settings.notifVibration = strength;
};

VibrationStrength GetNotifVibration() const {
return settings.notifVibration;
}

void SetChimeVibration(VibrationStrength strength) {
if (strength != settings.chimeVibration) {
settingsChanged = true;
}
settings.chimeVibration = strength;
};

VibrationStrength GetChimeVibration() const {
return settings.chimeVibration;
}

private:
Pinetime::Controllers::FS& fs;

@@ -319,12 +370,17 @@ namespace Pinetime {

PineTimeStyle PTS;

CasioStyleG7710 casio;

WatchFaceInfineat watchFaceInfineat;

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

Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;

VibrationStrength notifVibration = VibrationStrength::Normal;
VibrationStrength chimeVibration = VibrationStrength::Normal;
};

SettingsData settings;
16 changes: 13 additions & 3 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@
#include "displayapp/screens/settings/SettingChimes.h"
#include "displayapp/screens/settings/SettingShakeThreshold.h"
#include "displayapp/screens/settings/SettingBluetooth.h"
#include "displayapp/screens/settings/SettingNotifVibration.h"
#include "displayapp/screens/settings/SettingChimeVibration.h"

#include "libs/lv_conf.h"
#include "UserApps.h"
@@ -372,7 +374,7 @@ void DisplayApp::Refresh() {
} else {
LoadNewScreen(Apps::Timer, DisplayApp::FullRefreshDirections::Up);
}
motorController.RunForDuration(35);
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
break;
case Messages::AlarmTriggered:
if (currentApp == Apps::Alarm) {
@@ -384,7 +386,7 @@ void DisplayApp::Refresh() {
break;
case Messages::ShowPairingKey:
LoadNewScreen(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
motorController.RunForDuration(35);
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
break;
case Messages::TouchEvent: {
if (state != States::Running) {
@@ -473,7 +475,7 @@ void DisplayApp::Refresh() {
break;
case Messages::Chime:
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
motorController.RunForDuration(35);
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetChimeVibration()));
break;
case Messages::OnChargingEvent:
motorController.RunForDuration(15);
@@ -563,6 +565,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
notificationManager,
systemTask->nimble().alertService(),
motorController,
settingsController,
*systemTask,
Screens::Notifications::Modes::Normal);
break;
@@ -571,6 +574,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
notificationManager,
systemTask->nimble().alertService(),
motorController,
settingsController,
*systemTask,
Screens::Notifications::Modes::Preview);
break;
@@ -623,6 +627,12 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
case Apps::SettingBluetooth:
currentScreen = std::make_unique<Screens::SettingBluetooth>(this, settingsController);
break;
case Apps::SettingNotifVibration:
currentScreen = std::make_unique<Screens::SettingNotifVibration>(settingsController, motorController);
break;
case Apps::SettingChimeVibration:
currentScreen = std::make_unique<Screens::SettingChimeVibration>(settingsController, motorController);
break;
case Apps::BatteryInfo:
currentScreen = std::make_unique<Screens::BatteryInfo>(batteryController);
break;
5 changes: 4 additions & 1 deletion src/displayapp/apps/Apps.h.in
Original file line number Diff line number Diff line change
@@ -42,6 +42,8 @@ namespace Pinetime {
SettingChimes,
SettingShakeThreshold,
SettingBluetooth,
SettingNotifVibration,
SettingChimeVibration,
Error
};

@@ -50,8 +52,9 @@ namespace Pinetime {
Analog,
PineTimeStyle,
Terminal,
Json,
Infineat,
CasioStyleG7710,
CasioStyleG7710
};

template <Apps>
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 jetbrains_mono_16 lv_font_sys_48
open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
10 changes: 10 additions & 0 deletions src/displayapp/fonts/fonts.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,16 @@
"size": 20,
"patches": ["jetbrains_mono_bold_20.c_zero.patch", "jetbrains_mono_bold_20.c_M.patch"]
},
"jetbrains_mono_16": {
"sources": [
{
"file": "JetBrainsMono-Regular.ttf",
"range": "0x20-0x7e, 0x410-0x44f, 0xB0"
}
],
"bpp": 1,
"size": 16
},
"jetbrains_mono_42": {
"sources": [
{
3 changes: 2 additions & 1 deletion src/displayapp/screens/Notifications.cpp
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ Notifications::Notifications(DisplayApp* app,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController,
System::SystemTask& systemTask,
Modes mode)
: app {app},
@@ -44,7 +45,7 @@ Notifications::Notifications(DisplayApp* app,
if (notification.category == Controllers::NotificationManager::Categories::IncomingCall) {
motorController.StartRinging();
} else {
motorController.RunForDuration(35);
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
}

timeoutLine = lv_line_create(lv_scr_act(), nullptr);
Loading