summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-09-23 20:13:42 +0200
committerGitHub <noreply@github.com>2021-09-23 20:13:42 +0200
commit8a2b86dc8376d915b664a301465f7a5ef675b66f (patch)
treee9e5efad34e3ab0ed7e3651364ab09985b5c9bcb /src/components
parent1c3c3c8db919c703bbd3f1be4ce9c6833237ea6f (diff)
parent93d240a23b1071efd0ac4ecba986f98bc1dae2a4 (diff)
Merge pull request #664 from Riksu9000/disable_notif_only
Toggle notifications only, keep vibrations.
Diffstat (limited to 'src/components')
-rw-r--r--src/components/ble/NotificationManager.cpp8
-rw-r--r--src/components/ble/NotificationManager.h5
-rw-r--r--src/components/motor/MotorController.cpp10
-rw-r--r--src/components/motor/MotorController.h5
-rw-r--r--src/components/settings/Settings.h14
5 files changed, 10 insertions, 32 deletions
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp
index b1b0e6b2..7ffed300 100644
--- a/src/components/ble/NotificationManager.cpp
+++ b/src/components/ble/NotificationManager.cpp
@@ -79,14 +79,6 @@ bool NotificationManager::AreNewNotificationsAvailable() {
return newNotification;
}
-bool NotificationManager::IsVibrationEnabled() {
- return vibrationEnabled;
-}
-
-void NotificationManager::ToggleVibrations() {
- vibrationEnabled = !vibrationEnabled;
-}
-
bool NotificationManager::ClearNewNotificationFlag() {
return newNotification.exchange(false);
}
diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h
index d4072cc2..40f174ea 100644
--- a/src/components/ble/NotificationManager.h
+++ b/src/components/ble/NotificationManager.h
@@ -44,8 +44,6 @@ namespace Pinetime {
Notification GetPrevious(Notification::Id id);
bool ClearNewNotificationFlag();
bool AreNewNotificationsAvailable();
- bool IsVibrationEnabled();
- void ToggleVibrations();
static constexpr size_t MaximumMessageSize() {
return MessageSize;
@@ -60,7 +58,6 @@ namespace Pinetime {
uint8_t writeIndex = 0;
bool empty = true;
std::atomic<bool> newNotification {false};
- bool vibrationEnabled = true;
};
}
-} \ No newline at end of file
+}
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp
index 42057a86..f596c718 100644
--- a/src/components/motor/MotorController.cpp
+++ b/src/components/motor/MotorController.cpp
@@ -9,9 +9,6 @@ APP_TIMER_DEF(longVibTimer);
using namespace Pinetime::Controllers;
-MotorController::MotorController(Controllers::Settings& settingsController) : settingsController {settingsController} {
-}
-
void MotorController::Init() {
nrf_gpio_cfg_output(PinMap::Motor);
nrf_gpio_pin_set(PinMap::Motor);
@@ -27,18 +24,11 @@ void MotorController::Ring(void* p_context) {
}
void MotorController::RunForDuration(uint8_t motorDuration) {
- if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) {
- return;
- }
-
nrf_gpio_pin_clear(PinMap::Motor);
app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), nullptr);
}
void MotorController::StartRinging() {
- if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) {
- return;
- }
Ring(this);
app_timer_start(longVibTimer, APP_TIMER_TICKS(1000), this);
}
diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h
index cf78088e..c9326d57 100644
--- a/src/components/motor/MotorController.h
+++ b/src/components/motor/MotorController.h
@@ -1,14 +1,14 @@
#pragma once
#include <cstdint>
-#include "components/settings/Settings.h"
namespace Pinetime {
namespace Controllers {
class MotorController {
public:
- MotorController(Controllers::Settings& settingsController);
+ MotorController() = default;
+
void Init();
void RunForDuration(uint8_t motorDuration);
void StartRinging();
@@ -16,7 +16,6 @@ namespace Pinetime {
private:
static void Ring(void* p_context);
- Controllers::Settings& settingsController;
static void StopMotor(void* p_context);
};
}
diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h
index a54ba976..871ff3b6 100644
--- a/src/components/settings/Settings.h
+++ b/src/components/settings/Settings.h
@@ -11,7 +11,7 @@ namespace Pinetime {
class Settings {
public:
enum class ClockType : uint8_t { H24, H12 };
- enum class Vibration : uint8_t { ON, OFF };
+ enum class Notification : uint8_t { ON, OFF };
enum class WakeUpMode : uint8_t {
SingleTap = 0,
DoubleTap = 1,
@@ -93,14 +93,14 @@ namespace Pinetime {
return settings.clockType;
};
- void SetVibrationStatus(Vibration status) {
- if (status != settings.vibrationStatus) {
+ void SetNotificationStatus(Notification status) {
+ if (status != settings.notificationStatus) {
settingsChanged = true;
}
- settings.vibrationStatus = status;
+ settings.notificationStatus = status;
};
- Vibration GetVibrationStatus() const {
- return settings.vibrationStatus;
+ Notification GetNotificationStatus() const {
+ return settings.notificationStatus;
};
void SetScreenTimeOut(uint32_t timeout) {
@@ -170,7 +170,7 @@ namespace Pinetime {
uint32_t screenTimeOut = 15000;
ClockType clockType = ClockType::H24;
- Vibration vibrationStatus = Vibration::ON;
+ Notification notificationStatus = Notification::ON;
uint8_t clockFace = 0;