aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2021-08-01 14:48:07 -0400
committerConfuSomu2021-08-01 14:48:07 -0400
commitee583a19695b1f2b097276552cf6bb0c6adaaf6b (patch)
treeed37a2d42549048d054786b55d56ed2c40b5dc9a
parent4c0bb26d6624cfa658a3f257cfd35d5853ed9581 (diff)
downloadpico-watch-ee583a19695b1f2b097276552cf6bb0c6adaaf6b.tar
pico-watch-ee583a19695b1f2b097276552cf6bb0c6adaaf6b.tar.gz
pico-watch-ee583a19695b1f2b097276552cf6bb0c6adaaf6b.zip
Clean up app_manager and correctly clear the OLED
when switching app.
-rw-r--r--app_manager.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/app_manager.cpp b/app_manager.cpp
index c5f6d6b..d6f6e1d 100644
--- a/app_manager.cpp
+++ b/app_manager.cpp
@@ -3,16 +3,17 @@
#include "app_manager.hpp"
#include "api.hpp"
#include "globals.hpp"
+
+// App classes following:
#include "apps/main_clock/main.hpp"
#include "apps/home_menu/main.hpp"
#include "apps/settings/main.hpp"
-
#define NUMBER_OF_APPS 3
+
// From pico-watch.c:
extern Api app_api;
std::vector<BaseApp*> open_apps;
-int APPS_DESTROY_ON_EXIT[NUMBER_OF_APPS] = {0, 1, 1};
// Check if the specified app (via app_id) is already running.
// \return If app is init, pointer to app, else nullptr (more or less 0).
@@ -39,7 +40,6 @@ BaseApp* app_create(int app_id) {
BaseApp* app_init(int app_id) {
BaseApp* new_app;
- app_api.display_fill(0,1); // Clear OLED
app_api.performance_render_interval_set(500); // Reset interval
if (app_id > NUMBER_OF_APPS-1 or app_id < 0) {
@@ -91,6 +91,8 @@ void app_switch_request(int to_appid) {
void app_switch(BaseApp* app, int new_appid) {
g_s.app_ready = false;
+ app_api.display_fill(0,1); // Clear OLED
+
if (app->app_get_attributes().destroy_on_exit)
app_destroy(app);