comparison 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
comparison
equal deleted inserted replaced
360:fc5e9fdcb156 361:b111fc4250e9
236 #ifdef DEMOMODE 236 #ifdef DEMOMODE
237 #include "demo.h" 237 #include "demo.h"
238 static void TIM_DEMO_init(void); 238 static void TIM_DEMO_init(void);
239 #endif 239 #endif
240 240
241
241 //#include "lodepng.h" 242 //#include "lodepng.h"
242 //#include <stdlib.h> // for malloc and free 243 //#include <stdlib.h> // for malloc and free
243 244
244 /** @addtogroup OSTC 4 245 /** @addtogroup OSTC 4
245 * @{ 246 * @{
517 DoDisplayRefresh = 0; 518 DoDisplayRefresh = 0;
518 RefreshDisplay(); 519 RefreshDisplay();
519 520
520 if(DETECT_NEG_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch)) 521 if(DETECT_NEG_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch))
521 { 522 {
522 StoreButtonAction((uint8_t)ACTION_BUTTON_ENTER); 523 StoreButtonAction((uint8_t)ACTION_SHAKE_NEG);
524 }
525 if(DETECT_POS_SHAKE == detectShake(stateRealGetPointer()->lifeData.compass_pitch))
526 {
527 StoreButtonAction((uint8_t)ACTION_SHAKE_POS);
523 } 528 }
524 529
525 // Enable this to make the simulator write a logbook entry 530 // Enable this to make the simulator write a logbook entry
526 // #define SIM_WRITES_LOGBOOK 1 531 // #define SIM_WRITES_LOGBOOK 1
527 532
908 settingsGetPointer()->design = 4; 913 settingsGetPointer()->design = 4;
909 914
910 set_globalState(StD); 915 set_globalState(StD);
911 } else 916 } else
912 tHome_change_field_button_pressed(); 917 tHome_change_field_button_pressed();
913 } else if (action == ACTION_BUTTON_ENTER) { 918 } else if ((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_NEG) || (action == ACTION_SHAKE_POS))
914 if ((status.page == PageDive) && (status.line == 0)) 919 {
915 tHome_change_customview_button_pressed(); 920
916 else if (status.page == PageSurface) 921 if ((status.page == PageDive) && (status.line == 0))
917 tHome_change_customview_button_pressed(); 922 tHome_change_customview_button_pressed(action);
918 else 923 else if (status.page == PageSurface)
919 tHomeDiveMenuControl(action); 924 tHome_change_customview_button_pressed(action);
920 } 925 else
926 tHomeDiveMenuControl(action);
927 }
921 break; 928 break;
922 929
923 case BaseMenu: 930 case BaseMenu:
924 if (status.line == 0) 931 if (status.line == 0)
925 sendActionToMenu(action); 932 sendActionToMenu(action);