Skip to content

Commit 5728a4b

Browse files
authored
Merge branch 'ghoelian' into casio-weather
2 parents 2d180c8 + d38b435 commit 5728a4b

18 files changed

+400
-9
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: CI
33
# Run this workflow whenever the build may be affected
44
on:
55
push:
6-
branches: [ main ]
6+
branches: [ main, ghoelian ]
77
paths-ignore:
88
- 'doc/**'
99
- '**.md'
1010
pull_request:
11-
branches: [ main ]
11+
branches: [ main, ghoelian ]
1212
paths-ignore:
1313
- 'doc/**'
1414
- '**.md'

build.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
mkdir -p build
4+
cd build
5+
6+
echo "Configuring build..."
7+
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" ..
8+
echo "Finished configuring build"
9+
10+
echo "Building..."
11+
make -j4 pinetime-mcuboot-app
12+
echo "Finished building"

package-lock.json

+119
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"lv_font_conv": "^1.5.3"
4+
}
5+
}

src/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ list(APPEND SOURCE_FILES
418418
displayapp/screens/settings/SettingChimes.cpp
419419
displayapp/screens/settings/SettingShakeThreshold.cpp
420420
displayapp/screens/settings/SettingBluetooth.cpp
421+
displayapp/screens/settings/SettingNotifVibration.cpp
422+
displayapp/screens/settings/SettingChimeVibration.cpp
421423

422424
## Watch faces
423425
displayapp/screens/WatchFaceAnalog.cpp

src/components/settings/Settings.h

+26
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace Pinetime {
3434
Orange,
3535
Pink
3636
};
37+
enum class VibrationStrength : uint8_t { Weak = 15, Normal = 35, Strong = 75 };
3738
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
3839
enum class PTSWeather : uint8_t { On, Off };
3940

@@ -326,6 +327,28 @@ namespace Pinetime {
326327
return bleRadioEnabled;
327328
};
328329

330+
void SetNotifVibration(VibrationStrength strength) {
331+
if (strength != settings.notifVibration) {
332+
settingsChanged = true;
333+
}
334+
settings.notifVibration = strength;
335+
};
336+
337+
VibrationStrength GetNotifVibration() const {
338+
return settings.notifVibration;
339+
}
340+
341+
void SetChimeVibration(VibrationStrength strength) {
342+
if (strength != settings.chimeVibration) {
343+
settingsChanged = true;
344+
}
345+
settings.chimeVibration = strength;
346+
};
347+
348+
VibrationStrength GetChimeVibration() const {
349+
return settings.chimeVibration;
350+
}
351+
329352
private:
330353
Pinetime::Controllers::FS& fs;
331354

@@ -355,6 +378,9 @@ namespace Pinetime {
355378
uint16_t shakeWakeThreshold = 150;
356379

357380
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
381+
382+
VibrationStrength notifVibration = VibrationStrength::Normal;
383+
VibrationStrength chimeVibration = VibrationStrength::Normal;
358384
};
359385

360386
SettingsData settings;

src/displayapp/DisplayApp.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
#include "displayapp/screens/settings/SettingChimes.h"
5050
#include "displayapp/screens/settings/SettingShakeThreshold.h"
5151
#include "displayapp/screens/settings/SettingBluetooth.h"
52+
#include "displayapp/screens/settings/SettingNotifVibration.h"
53+
#include "displayapp/screens/settings/SettingChimeVibration.h"
5254

5355
#include "libs/lv_conf.h"
5456
#include "UserApps.h"
@@ -372,7 +374,7 @@ void DisplayApp::Refresh() {
372374
} else {
373375
LoadNewScreen(Apps::Timer, DisplayApp::FullRefreshDirections::Up);
374376
}
375-
motorController.RunForDuration(35);
377+
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
376378
break;
377379
case Messages::AlarmTriggered:
378380
if (currentApp == Apps::Alarm) {
@@ -384,7 +386,7 @@ void DisplayApp::Refresh() {
384386
break;
385387
case Messages::ShowPairingKey:
386388
LoadNewScreen(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
387-
motorController.RunForDuration(35);
389+
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
388390
break;
389391
case Messages::TouchEvent: {
390392
if (state != States::Running) {
@@ -473,7 +475,7 @@ void DisplayApp::Refresh() {
473475
break;
474476
case Messages::Chime:
475477
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
476-
motorController.RunForDuration(35);
478+
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetChimeVibration()));
477479
break;
478480
case Messages::OnChargingEvent:
479481
motorController.RunForDuration(15);
@@ -562,6 +564,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
562564
notificationManager,
563565
systemTask->nimble().alertService(),
564566
motorController,
567+
settingsController,
565568
*systemTask,
566569
Screens::Notifications::Modes::Normal);
567570
break;
@@ -570,6 +573,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
570573
notificationManager,
571574
systemTask->nimble().alertService(),
572575
motorController,
576+
settingsController,
573577
*systemTask,
574578
Screens::Notifications::Modes::Preview);
575579
break;
@@ -621,6 +625,12 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
621625
case Apps::SettingBluetooth:
622626
currentScreen = std::make_unique<Screens::SettingBluetooth>(this, settingsController);
623627
break;
628+
case Apps::SettingNotifVibration:
629+
currentScreen = std::make_unique<Screens::SettingNotifVibration>(settingsController, motorController);
630+
break;
631+
case Apps::SettingChimeVibration:
632+
currentScreen = std::make_unique<Screens::SettingChimeVibration>(settingsController, motorController);
633+
break;
624634
case Apps::BatteryInfo:
625635
currentScreen = std::make_unique<Screens::BatteryInfo>(batteryController);
626636
break;

src/displayapp/apps/Apps.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ namespace Pinetime {
4242
SettingChimes,
4343
SettingShakeThreshold,
4444
SettingBluetooth,
45+
SettingNotifVibration,
46+
SettingChimeVibration,
4547
Error
4648
};
4749

@@ -50,6 +52,7 @@ namespace Pinetime {
5052
Analog,
5153
PineTimeStyle,
5254
Terminal,
55+
Json,
5356
Infineat,
5457
CasioStyleG7710
5558
};

src/displayapp/fonts/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
2-
jetbrains_mono_extrabold_compressed lv_font_sys_48
2+
jetbrains_mono_extrabold_compressed jetbrains_mono_16 lv_font_sys_48
33
open_sans_light fontawesome_weathericons)
44
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
55
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")

src/displayapp/fonts/fonts.json

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
"size": 20,
1515
"patches": ["jetbrains_mono_bold_20.c_zero.patch", "jetbrains_mono_bold_20.c_M.patch"]
1616
},
17+
"jetbrains_mono_16": {
18+
"sources": [
19+
{
20+
"file": "JetBrainsMono-Regular.ttf",
21+
"range": "0x20-0x7e, 0x410-0x44f, 0xB0"
22+
}
23+
],
24+
"bpp": 1,
25+
"size": 16
26+
},
1727
"jetbrains_mono_42": {
1828
"sources": [
1929
{

src/displayapp/screens/Notifications.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Notifications::Notifications(DisplayApp* app,
1414
Pinetime::Controllers::NotificationManager& notificationManager,
1515
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
1616
Pinetime::Controllers::MotorController& motorController,
17+
Pinetime::Controllers::Settings& settingsController,
1718
System::SystemTask& systemTask,
1819
Modes mode)
1920
: app {app},
@@ -44,7 +45,7 @@ Notifications::Notifications(DisplayApp* app,
4445
if (notification.category == Controllers::NotificationManager::Categories::IncomingCall) {
4546
motorController.StartRinging();
4647
} else {
47-
motorController.RunForDuration(35);
48+
motorController.RunForDuration(static_cast<uint8_t>(settingsController.GetNotifVibration()));
4849
}
4950

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

src/displayapp/screens/Notifications.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Pinetime {
2525
Pinetime::Controllers::NotificationManager& notificationManager,
2626
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
2727
Pinetime::Controllers::MotorController& motorController,
28+
Pinetime::Controllers::Settings& settingsController,
2829
System::SystemTask& systemTask,
2930
Modes mode);
3031
~Notifications() override;

0 commit comments

Comments
 (0)