add vibration toggle
This commit is contained in:
parent
7ab153cd76
commit
1e2cc3ce91
4 changed files with 16 additions and 1 deletions
|
@ -71,6 +71,14 @@ bool NotificationManager::AreNewNotificationsAvailable() {
|
||||||
return newNotification;
|
return newNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NotificationManager::isVibrationEnabled() {
|
||||||
|
return vibrationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotificationManager::toggleVibrations() {
|
||||||
|
vibrationEnabled = !vibrationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
bool NotificationManager::ClearNewNotificationFlag() {
|
bool NotificationManager::ClearNewNotificationFlag() {
|
||||||
return newNotification.exchange(false);
|
return newNotification.exchange(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace Pinetime {
|
||||||
Notification GetPrevious(Notification::Id id);
|
Notification GetPrevious(Notification::Id id);
|
||||||
bool ClearNewNotificationFlag();
|
bool ClearNewNotificationFlag();
|
||||||
bool AreNewNotificationsAvailable();
|
bool AreNewNotificationsAvailable();
|
||||||
|
bool isVibrationEnabled();
|
||||||
|
void toggleVibrations();
|
||||||
|
|
||||||
static constexpr size_t MaximumMessageSize() { return MessageSize; };
|
static constexpr size_t MaximumMessageSize() { return MessageSize; };
|
||||||
size_t NbNotifications() const;
|
size_t NbNotifications() const;
|
||||||
|
@ -40,6 +42,7 @@ namespace Pinetime {
|
||||||
uint8_t writeIndex = 0;
|
uint8_t writeIndex = 0;
|
||||||
bool empty = true;
|
bool empty = true;
|
||||||
std::atomic<bool> newNotification{false};
|
std::atomic<bool> newNotification{false};
|
||||||
|
bool vibrationEnabled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -92,6 +92,10 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
currentItem.reset(new NotificationItem("\nNotification", nextNotification.message.data(), nextNotification.index, notificationManager.NbNotifications(), mode));
|
currentItem.reset(new NotificationItem("\nNotification", nextNotification.message.data(), nextNotification.index, notificationManager.NbNotifications(), mode));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case Pinetime::Applications::TouchEvents::LongTap: {
|
||||||
|
notificationManager.toggleVibrations();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void SystemTask::Work() {
|
||||||
break;
|
break;
|
||||||
case Messages::OnNewNotification:
|
case Messages::OnNewNotification:
|
||||||
if(isSleeping && !isWakingUp) GoToRunning();
|
if(isSleeping && !isWakingUp) GoToRunning();
|
||||||
motorController.SetDuration(35);
|
if(notificationManager.isVibrationEnabled()) motorController.SetDuration(35);
|
||||||
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
|
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
|
||||||
break;
|
break;
|
||||||
case Messages::BleConnected:
|
case Messages::BleConnected:
|
||||||
|
|
Loading…
Reference in a new issue