diff options
-rw-r--r-- | api.cpp | 10 | ||||
-rw-r--r-- | api.hpp | 6 | ||||
-rw-r--r-- | app_manager.cpp | 2 | ||||
-rw-r--r-- | apps/settings/main.cpp | 1 | ||||
-rw-r--r-- | pico-watch.cpp | 14 |
5 files changed, 7 insertions, 26 deletions
@@ -320,16 +320,6 @@ bool Api::datetime_set(datetime_t *t) { return rtc_set_datetime(t); } -int Api::performance_render_interval_get() { - return m_app_render_interval; -} - -void Api::performance_render_interval_set(int interval) { - if (interval < 10) - interval = 10; - m_app_render_interval = interval; -} - uint Api::button_last_get() { return m_button_last_pressed; } @@ -108,12 +108,6 @@ class Api { // \param t Pointer to the datetime structure // \return true if the call to the SDK was successful, else false. bool datetime_set(datetime_t *t); - // Get app's current render interval - // \return Value in millisec - int performance_render_interval_get(); - // Same spirit as performance_set, the app should use the smallest value possible that does not cause a lack of responsiveness in the app's UI. - // \param interval Time to wait in millisec between calls of the app's render function. - void performance_render_interval_set(int interval); // Get last button pressed, see buttons.hpp for values // \return Last button pressed uint button_last_get(); diff --git a/app_manager.cpp b/app_manager.cpp index 173cd60..68aa3b9 100644 --- a/app_manager.cpp +++ b/app_manager.cpp @@ -68,7 +68,6 @@ BaseApp* app_mgr::app_create(int app_id) { BaseApp* app_mgr::app_init(int app_id) { BaseApp* new_app; - app_api.performance_render_interval_set(500); // Reset interval if (app_id > NUMBER_OF_APPS-1 or app_id < 0) { printf("Tried to init app %d", app_id); @@ -140,7 +139,6 @@ void app_mgr::app_switch_request(int to_appid) { if (!g_s.app_switch_requested) g_s.app_switch_to_app = to_appid; g_s.app_switch_requested = true; - app_api.performance_render_interval_set(0); // This will be reset on new app init } void app_mgr::app_switch(BaseApp* app, int new_appid) { diff --git a/apps/settings/main.cpp b/apps/settings/main.cpp index d4c910a..4917128 100644 --- a/apps/settings/main.cpp +++ b/apps/settings/main.cpp @@ -162,7 +162,6 @@ BaseApp::AppReturnValues app_settings::btnpressed(Api *app_api, uint gpio, unsig app_settings::app_settings(Api *app_api) { app_api->performance_set(Api::perf_modes::LOW_POWER); - app_api->performance_render_interval_set(100); selected_setting = 0; selected = false; snprintf(display_setting_name, SIZE_SETTING_NAME, "%s", MAIN_SET_NAMES[0]); diff --git a/pico-watch.cpp b/pico-watch.cpp index 9bf45e0..4bca42c 100644 --- a/pico-watch.cpp +++ b/pico-watch.cpp @@ -45,18 +45,18 @@ int main() { g_s.foreground_app = app_mgr::app_init(0); while (1) { - if (g_s.app_switch_requested) { - app_mgr::app_switch(g_s.foreground_app, g_s.app_switch_to_app); - g_s.app_switch_requested = false; - } - if (g_s.app_ready && !g_s.is_sleeping) { app_mgr::app_render(g_s.foreground_app); app_api.display_write_backbuffer(); } - if (g_s.is_sleeping) __wfi(); - else sleep_ms(g_s.foreground_app->app_get_attributes().render_interval); + if (g_s.is_sleeping) + __wfi(); + else if (g_s.app_switch_requested) { + app_mgr::app_switch(g_s.foreground_app, g_s.app_switch_to_app); + g_s.app_switch_requested = false; + } else + sleep_ms(g_s.foreground_app->app_get_attributes().render_interval); } return 0; } |