comparison Discovery/Src/base.c @ 586:bb5ce239741f

Motion control: Jump back to primary view if focus is lost: The modes sector and scroll are tipically used to have a short look at other information pages (e.g. compass). By automatically jumping back to the primary view, there is no longer the need to select the preferred view when leaving focus mode
author Ideenmodellierer
date Sun, 13 Dec 2020 18:31:40 +0100
parents e581425c7e3e
children 132e7e3d13a7
comparison
equal deleted inserted replaced
585:4dfdf230d8ba 586:bb5ce239741f
230 #include "timer.h" 230 #include "timer.h"
231 #include "logbook_miniLive.h" 231 #include "logbook_miniLive.h"
232 #include "test_vpm.h" 232 #include "test_vpm.h"
233 #include "tDebug.h" 233 #include "tDebug.h"
234 #include "motion.h" 234 #include "motion.h"
235 #include "t7.h"
236 #include "t3.h"
235 237
236 #ifdef DEMOMODE 238 #ifdef DEMOMODE
237 #include "demo.h" 239 #include "demo.h"
238 static void TIM_DEMO_init(void); 240 static void TIM_DEMO_init(void);
239 #endif 241 #endif
345 // =============================================================================== 347 // ===============================================================================
346 int main(void) 348 int main(void)
347 { 349 {
348 uint32_t pLayerInvisible; 350 uint32_t pLayerInvisible;
349 uint16_t totalDiveCounterFound; 351 uint16_t totalDiveCounterFound;
352 uint8_t wasInFocus = 0;
350 353
351 SStateList status; 354 SStateList status;
352 #ifdef ENABLE_MOTION_CONTROL 355 #ifdef ENABLE_MOTION_CONTROL
353 detectionState_t pitchstate; 356 detectionState_t pitchstate;
354 #endif 357 #endif
510 evaluateMotionDelta(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); 513 evaluateMotionDelta(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading);
511 checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); 514 checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading);
512 515
513 if(viewInFocus()) 516 if(viewInFocus())
514 { 517 {
518 wasInFocus = 1;
515 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03); 519 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03);
516 switch(settingsGetPointer()->MotionDetection) 520 switch(settingsGetPointer()->MotionDetection)
517 { 521 {
518 case MOTION_DETECT_MOVE: pitchstate = detectPitch(stateRealGetPointer()->lifeData.compass_pitch); 522 case MOTION_DETECT_MOVE: pitchstate = detectPitch(stateRealGetPointer()->lifeData.compass_pitch);
519 break; 523 break;
534 StoreButtonAction((uint8_t)ACTION_PITCH_POS); 538 StoreButtonAction((uint8_t)ACTION_PITCH_POS);
535 } 539 }
536 } 540 }
537 else 541 else
538 { 542 {
543 if(wasInFocus)
544 {
545 wasInFocus = 0;
546 if(settingsGetPointer()->design == 7)
547 {
548 t7_set_customview_to_primary();
549 }
550 else
551 {
552 t3_set_customview_to_primary();
553 }
554 }
555
539 set_Backlight_Boost(0); 556 set_Backlight_Boost(0);
540 } 557 }
541 } 558 }
542 #endif 559 #endif
543 560
770 set_globalState(StD); 787 set_globalState(StD);
771 } 788 }
772 else /* return to t7 view */ 789 else /* return to t7 view */
773 { 790 {
774 settingsGetPointer()->design = 7; 791 settingsGetPointer()->design = 7;
792 if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR)
793 {
794 DefinePitchSectors(settingsGetPointer()->viewPitch,CUSTOMER_DEFINED_VIEWS);
795 }
775 } 796 }
776 } 797 }
777 else 798 else
778 { 799 {
779 settingsGetPointer()->design = 7; // auto switch to 9 if necessary 800 settingsGetPointer()->design = 7; // auto switch to 9 if necessary
783 if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT) 804 if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT)
784 { 805 {
785 settingsGetPointer()->design = 3; 806 settingsGetPointer()->design = 3;
786 if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR) 807 if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR)
787 { 808 {
788 DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS); 809 DefinePitchSectors(settingsGetPointer()->viewPitch,CUSTOMER_DEFINED_VIEWS);
789 } 810 }
790 } 811 }
791 else if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_DECOGAME) 812 else if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_DECOGAME)
792 settingsGetPointer()->design = 4; 813 settingsGetPointer()->design = 4;
793 set_globalState(StD); 814 set_globalState(StD);