Update src/systemtask/SystemTask.cpp

Co-authored-by: JF <JF002@users.noreply.github.com>
This commit is contained in:
Max Friedrich 2022-12-26 23:34:29 +01:00 committed by JF
parent dbbbbfd1ac
commit fdc89f1a20

View File

@ -426,10 +426,10 @@ void SystemTask::Work() {
break; break;
case Messages::LowBattery: { case Messages::LowBattery: {
Pinetime::Controllers::NotificationManager::Notification notif; Pinetime::Controllers::NotificationManager::Notification notif;
std::array<char, Pinetime::Controllers::NotificationManager::MessageSize + 1> message { constexpr char message[] = "Low Battery\0Charge your watch to prevent data loss.\0";
"Low Battery\0Charge your watch to prevent data loss.\0"}; constexpr size_t messageSize = std::min(sizeof(message), Pinetime::Controllers::NotificationManager::MaximumMessageSize());
notif.message = std::move(message); std::memcpy(notif.message.data(), message, messageSize);
notif.size = 53; notif.size = messageSize;
notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert;
notificationManager.Push(std::move(notif)); notificationManager.Push(std::move(notif));
PushMessage(Messages::OnNewNotification); PushMessage(Messages::OnNewNotification);