# HG changeset patch # User ideenmodellierer # Date 1558728106 -7200 # Node ID fc5e9fdcb15604dddc21009cc1b652b467de8cee # Parent 4258ea9b67fa9b50f2343dd5869b1edf8a6f14b2 Added trigger of middle button action in case of a detected shake diff -r 4258ea9b67fa -r fc5e9fdcb156 Discovery/Src/base.c --- a/Discovery/Src/base.c Fri May 24 22:00:38 2019 +0200 +++ b/Discovery/Src/base.c Fri May 24 22:01:46 2019 +0200 @@ -231,6 +231,7 @@ #include "logbook_miniLive.h" #include "test_vpm.h" #include "tDebug.h" +#include "motion.h" #ifdef DEMOMODE #include "demo.h" @@ -339,6 +340,14 @@ #define MEASURECNT 60 /* number of measuremets to be stored */ static uint32_t loopcnt[MEASURECNT]; #endif + +static uint8_t ButtonAction = ACTION_END; + +static void StoreButtonAction(uint8_t action) +{ + ButtonAction = action; +} + // =============================================================================== // main /// @brief This function makes initializations and has the nonIRQ endless loop @@ -508,6 +517,11 @@ DoDisplayRefresh = 0; RefreshDisplay(); + if(DETECT_NEG_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch)) + { + StoreButtonAction((uint8_t)ACTION_BUTTON_ENTER); + } + // Enable this to make the simulator write a logbook entry // #define SIM_WRITES_LOGBOOK 1 @@ -542,6 +556,9 @@ } } + + + // =============================================================================== // timer IRQ /// @brief this is called periodically @@ -849,12 +866,7 @@ break; } } -static uint8_t ButtonAction = ACTION_END; -static void StoreButtonAction(uint8_t action) -{ - ButtonAction = action; -} static void TriggerButtonAction() {