Mercurial > public > ostc4
diff Discovery/Src/base.c @ 361:b111fc4250e9 MotionDetection
Pass action to customer vie update function.
By intoducing shakes the reason for calling an update may not only be the middle button. To be able to handle positiv and negativ shake events the action is now provided to the update function
author | Ideenmodellierer |
---|---|
date | Tue, 11 Jun 2019 05:30:09 +0200 |
parents | fc5e9fdcb156 |
children | 3014a698f46d |
line wrap: on
line diff
--- a/Discovery/Src/base.c Fri May 24 22:01:46 2019 +0200 +++ b/Discovery/Src/base.c Tue Jun 11 05:30:09 2019 +0200 @@ -238,6 +238,7 @@ static void TIM_DEMO_init(void); #endif + //#include "lodepng.h" //#include <stdlib.h> // for malloc and free @@ -519,7 +520,11 @@ if(DETECT_NEG_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch)) { - StoreButtonAction((uint8_t)ACTION_BUTTON_ENTER); + StoreButtonAction((uint8_t)ACTION_SHAKE_NEG); + } + if(DETECT_POS_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch)) + { + StoreButtonAction((uint8_t)ACTION_SHAKE_POS); } // Enable this to make the simulator write a logbook entry @@ -910,14 +915,16 @@ set_globalState(StD); } else tHome_change_field_button_pressed(); - } else if (action == ACTION_BUTTON_ENTER) { - if ((status.page == PageDive) && (status.line == 0)) - tHome_change_customview_button_pressed(); - else if (status.page == PageSurface) - tHome_change_customview_button_pressed(); - else - tHomeDiveMenuControl(action); - } + } else if ((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_NEG) || (action == ACTION_SHAKE_POS)) + { + + if ((status.page == PageDive) && (status.line == 0)) + tHome_change_customview_button_pressed(action); + else if (status.page == PageSurface) + tHome_change_customview_button_pressed(action); + else + tHomeDiveMenuControl(action); + } break; case BaseMenu: