Author: Max Friedrich <minacode@users.noreply.github.com>
Update src/systemtask/SystemTask.cpp Co-authored-by: JF <JF002@users.noreply.github.com>
src/systemtask/SystemTask.cpp | 8 ++++----
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 2f5fd214decceaa5d8fc078da4736e97eccb9eec..687c90a5650722e26763a9cda1e774b0ca08c28d 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -426,10 +426,10 @@ nimbleController.NotifyBatteryLevel(batteryController.PercentRemaining()); break; case Messages::LowBattery: { Pinetime::Controllers::NotificationManager::Notification notif; - std::array<char, Pinetime::Controllers::NotificationManager::MessageSize + 1> message { - "Low Battery\0Charge your watch to prevent data loss.\0"}; - notif.message = std::move(message); - notif.size = 53; + constexpr char message[] = "Low Battery\0Charge your watch to prevent data loss.\0"; + constexpr size_t messageSize = std::min(sizeof(message), Pinetime::Controllers::NotificationManager::MaximumMessageSize()); + std::memcpy(notif.message.data(), message, messageSize); + notif.size = messageSize; notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; notificationManager.Push(std::move(notif)); PushMessage(Messages::OnNewNotification);