aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api.cpp4
-rw-r--r--api.hpp10
-rw-r--r--apps/home_menu.cpp1
-rw-r--r--apps/main_clock.cpp1
4 files changed, 16 insertions, 0 deletions
diff --git a/api.cpp b/api.cpp
index 7279f19..1200f16 100644
--- a/api.cpp
+++ b/api.cpp
@@ -126,6 +126,10 @@ bool Api::gui_header_text(std::string text, int offset_x, int offset_row, int in
oledWriteString(&m_oled, 0,offset_x,0+offset_row, &text[0], font, invert, 1);
}
+bool Api::performance_set(int perf) {
+ return false;
+}
+
bool Api::datetime_get(datetime_t *t) {
return rtc_get_datetime(t);
}
diff --git a/api.hpp b/api.hpp
index 7e2a3e9..f5de57e 100644
--- a/api.hpp
+++ b/api.hpp
@@ -16,6 +16,11 @@ class Api {
void init_display();
public:
bool m_send_button_press_to_app = true;
+ enum perf_modes {
+ LOW_POWER,
+ NORMAL_PERF,
+ HIGH_PERF
+ };
void init();
int display_write_string(int iScrollX, int x, int y, char *szMsg, int iSize, int bInvert, int bRender);
void display_fill(unsigned char ucData, int bRender);
@@ -44,6 +49,11 @@ class Api {
// \param offset_row Render text lines lower. For example, one text line lower with `offset_row = 1`.
// \param invert Invert text and background color.
bool gui_header_text(std::string text, int offset_x = 0, int offset_row = 0, int invert = 0);
+ // Set performance mode.
+ // FIXME: function currently does nothing!
+ // An app should choose the lowest performance that can make it function. Set in init(). Only when required, higher performance should be used.
+ // \param perf See Api::perf_modes enum for possible values
+ bool performance_set(int perf);
bool datetime_get(datetime_t *t);
// Get last button pressed, see buttons.hpp for values
uint button_last_get();
diff --git a/apps/home_menu.cpp b/apps/home_menu.cpp
index 658d911..910ebac 100644
--- a/apps/home_menu.cpp
+++ b/apps/home_menu.cpp
@@ -76,6 +76,7 @@ namespace app_home_menu {
// Initlisation of the app.
int init(Api *app_api) {
+ app_api->performance_set(Api::perf_modes::LOW_POWER);
pressed_button = new char; *pressed_button = '*';
selected_app = new int; *selected_app = 0; // Make sure to init the values to something known!
return 0; // return 1 when function not implemented
diff --git a/apps/main_clock.cpp b/apps/main_clock.cpp
index 21c9e5d..895a7b9 100644
--- a/apps/main_clock.cpp
+++ b/apps/main_clock.cpp
@@ -64,6 +64,7 @@ namespace app_main_clock {
// Initlisation of the app.
int init(Api *app_api) {
+ app_api->performance_set(Api::perf_modes::LOW_POWER);
return 1; // return 1 when function not implemented
}