summaryrefslogtreecommitdiffstats
path: root/buttons.cpp
diff options
context:
space:
mode:
authorConfuSomu2021-04-22 10:29:48 -0400
committerConfuSomu2021-04-22 10:29:48 -0400
commit5bb9681e84eae15dc5fe05b8a7f653ef99905e7f (patch)
tree61edb5a996c7a6703f89e6641741aacfc8166e3f /buttons.cpp
parentccadff8be2f1570d3ecd3b5438249f1932f6d5e1 (diff)
downloadpico-watch-5bb9681e84eae15dc5fe05b8a7f653ef99905e7f.tar
pico-watch-5bb9681e84eae15dc5fe05b8a7f653ef99905e7f.tar.gz
pico-watch-5bb9681e84eae15dc5fe05b8a7f653ef99905e7f.zip
Ignore home button press when in Api popup
This avoids quitting the app when an Api popup is displayed, causing problems. The variable resposable for this has been renamed to better reflect its use.
Diffstat (limited to 'buttons.cpp')
-rw-r--r--buttons.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/buttons.cpp b/buttons.cpp
index 7ecc8a4..b86ac5d 100644
--- a/buttons.cpp
+++ b/buttons.cpp
@@ -18,10 +18,14 @@ const int button_delay_time = 50; // 50ms worked fine for me .... change it to y
void gpio_interrupt_cb(uint gpio, uint32_t events) {
if ((to_ms_since_boot(get_absolute_time())-button_last_pressed_time)>button_delay_time) {
- if (gpio == BUTTON_HOME && (current_app != 0)) // Home app
- app_switch(current_app, 0);
- else
- app_btnpressed(current_app, gpio);
+
+ if (app_api.m_interpret_button_press) {
+ if (gpio == BUTTON_HOME && (current_app != 0)) // Home app
+ app_switch(current_app, 0);
+ else
+ app_btnpressed(current_app, gpio);
+ }
+
app_api.button_last_set(gpio);
button_last_pressed_time = to_ms_since_boot(get_absolute_time());
}