Skip to content

Commit

Permalink
Merge branch 'ghoelian' into casio-weather
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghoelian authored Dec 2, 2024
2 parents 2d180c8 + d38b435 commit 5728a4b
Show file tree
Hide file tree
Showing 18 changed files with 400 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
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
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down Expand Up @@ -326,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;

Expand Down Expand Up @@ -355,6 +378,9 @@ namespace Pinetime {
uint16_t shakeWakeThreshold = 150;

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

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

SettingsData settings;
Expand Down
16 changes: 13 additions & 3 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -562,6 +564,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
notificationManager,
systemTask->nimble().alertService(),
motorController,
settingsController,
*systemTask,
Screens::Notifications::Modes::Normal);
break;
Expand All @@ -570,6 +573,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
notificationManager,
systemTask->nimble().alertService(),
motorController,
settingsController,
*systemTask,
Screens::Notifications::Modes::Preview);
break;
Expand Down Expand Up @@ -621,6 +625,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;
Expand Down
3 changes: 3 additions & 0 deletions src/displayapp/apps/Apps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ namespace Pinetime {
SettingChimes,
SettingShakeThreshold,
SettingBluetooth,
SettingNotifVibration,
SettingChimeVibration,
Error
};

Expand All @@ -50,6 +52,7 @@ namespace Pinetime {
Analog,
PineTimeStyle,
Terminal,
Json,
Infineat,
CasioStyleG7710
};
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 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")
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 @@ -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": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/screens/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/displayapp/screens/Notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Pinetime {
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController,
System::SystemTask& systemTask,
Modes mode);
~Notifications() override;
Expand Down
Loading

0 comments on commit 5728a4b

Please sign in to comment.