From b2e2690adfbc13cbf4e0778a428baa6b11b35fba Mon Sep 17 00:00:00 2001 From: Davis Mosenkovs Date: Sun, 30 Jun 2024 19:16:04 +0300 Subject: [PATCH] Expose SystemTask dependency controllers Expose NotificationManager and Settings for use by the feature in next commit. This is a memory efficient way for accessing SystemTask dependencies from controllers that have SystemTask injected as a dependency. Looks like each direct dependency injection uses 4 bytes RAM. As InfiniTime is close to running out of RAM (using 16 more bytes causes build to fail with "ld: region RAM overflowed with stack") it might be helpful to use this approach more. --- src/systemtask/SystemTask.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 79f1cf44..8714ed78 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -90,6 +90,14 @@ namespace Pinetime { return nimbleController; }; + Pinetime::Controllers::NotificationManager& GetNotificationManager() { + return notificationManager; + }; + + Pinetime::Controllers::Settings& GetSettings() { + return settingsController; + }; + bool IsSleeping() const { return state == SystemTaskState::Sleeping || state == SystemTaskState::WakingUp; }