Optimize app message in/outbox sizes; truncate lastWatched before sending to watch (if needed)

This commit is contained in:
2026-05-10 01:17:24 -04:00
parent 1c1140246a
commit 1e884dd4a4
2 changed files with 6 additions and 2 deletions

View File

@@ -375,7 +375,7 @@ static void init() {
// initialize pkjs
app_message_register_inbox_received(inbox_received_handler);
app_message_open(1024, 1536);
app_message_open(1536, 64);
// get sleep time (UNIX timestamp)
time_t end = time(NULL);

View File

@@ -129,7 +129,11 @@ function callAPI(fullURL, apiKey, isJellyfin, trackedUser, sleepTimestamp) {
});
}
if (lastWatched != "") {
if (lastWatched.length <= 1536) {
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: lastWatched });
} else {
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: lastWatched.slice(0, 1536) });
}
} else {
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: "NO WATCH HISTORY FOUND FOR USER " + trackedUser });
}