# HG changeset patch # User ideenmodellierer # Date 1565723537 -7200 # Node ID 210bffc496a3700cf689aa66ccab5ea1173f47c0 # Parent 50ea68c7a15338f8c7557941ac96aafea30d2d49 Added a function to count the active custom views. diff -r 50ea68c7a153 -r 210bffc496a3 Discovery/Inc/t7.h --- a/Discovery/Inc/t7.h Tue Aug 13 21:10:46 2019 +0200 +++ b/Discovery/Inc/t7.h Tue Aug 13 21:12:17 2019 +0200 @@ -47,6 +47,8 @@ void init_t7_compass(void); +uint8_t t7_GetEnabled_customviews(); + /* void t7c_refresh(uint32_t FramebufferStartAddress); */ diff -r 50ea68c7a153 -r 210bffc496a3 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Tue Aug 13 21:10:46 2019 +0200 +++ b/Discovery/Src/t7.c Tue Aug 13 21:12:17 2019 +0200 @@ -38,6 +38,7 @@ #include "simulation.h" #include "timer.h" #include "unit.h" +#include "motion.h" /* Private function prototypes -----------------------------------------------*/ @@ -567,6 +568,8 @@ selection_customview = CVIEW_noneOrDebug; else selection_customview = settingsGetPointer()->tX_customViewPrimary; + + InitMotionDetection(); } if(status.page == PageSurface) @@ -597,6 +600,7 @@ { last_mode = MODE_SURFACE; selection_customview = customviewsSurface[0]; + InitMotionDetection(); } if(status.page == PageDive) set_globalState(StS); @@ -1479,6 +1483,43 @@ selection_customview = settingsGetPointer()->tX_customViewPrimary; } +uint8_t t7_GetEnabled_customviews() +{ + uint8_t *pViews; + uint8_t increment = 1; + + uint8_t enabledViewCnt = 0; + uint32_t cv_config = settingsGetPointer()->cv_configuration; + + if(stateUsed->mode == MODE_DIVE) + pViews = customviewsDive; + else + pViews = customviewsSurface; + + while((*pViews != CVIEW_END)) + { + increment = 1; + /* check if view is enabled */ + for(int i=0;i<6;i++) + { + if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(cv_config, (1 << cv_changelist[i]))) + { + increment = 0; + break; + } + } + if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) && + ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))) + { + increment = 0; + } + + pViews++; + enabledViewCnt += increment; + } + return enabledViewCnt; +} + void t7_change_customview(uint8_t action) { uint8_t *pViews; @@ -1503,7 +1544,7 @@ pLastView = pViews; pViews = pCurView; - if((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_POS)) + if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS)) { if(*pViews < CVIEW_END) pViews++; @@ -1545,7 +1586,7 @@ if(cv_disabled) /* view is disabled => jump to next view */ { - if((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_POS)) + if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS)) { pViews++; if(*pViews == CVIEW_END)