Increase max size of notification message to 100 char.

Fix bug in message handling that would ignore the last character of the notification.
This commit is contained in:
JF 2020-10-21 17:31:56 +02:00
parent ef5670c7e0
commit 440ae412b9
6 changed files with 30 additions and 41 deletions

View file

@ -4,10 +4,13 @@
using namespace Pinetime::Controllers;
constexpr uint8_t NotificationManager::MessageSize;
void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category,
const char *message, uint8_t currentMessageSize) {
// TODO handle edge cases on read/write index
auto checkedSize = std::min(currentMessageSize, uint8_t{18});
auto checkedSize = std::min(currentMessageSize, MessageSize);
auto& notif = notifications[writeIndex];
std::memcpy(notif.message.data(), message, checkedSize);
notif.message[checkedSize] = '\0';