# HG changeset patch # User ideenmodellierer # Date 1571346557 -7200 # Node ID 427ae9f8e28e36b9e4a91f965c95ea864151b4fb # Parent 49a02dea8ae3d96932112551018806f368328afc Consider number of available t3 views in sector handling: Before chande the number of sectors were taken from t7 view only causing t3 view to be shown inconsistent in case t7 view count were not 6. => added function to count views. diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Inc/t3.h --- a/Discovery/Inc/t3.h Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Inc/t3.h Thu Oct 17 23:09:17 2019 +0200 @@ -36,5 +36,6 @@ void t3_init(void); void t3_refresh(void); void t3_change_customview(void); +uint8_t t3_GetEnabled_customviews(); #endif /* T3_H */ diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Src/base.c --- a/Discovery/Src/base.c Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Src/base.c Thu Oct 17 23:09:17 2019 +0200 @@ -895,7 +895,13 @@ settingsGetPointer()->design = 7; // auto switch to 9 if necessary } else if ((status.page == PageDive) && (status.line != 0)) { if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT) + { settingsGetPointer()->design = 3; + if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR) + { + DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS); + } + } else if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_DECOGAME) settingsGetPointer()->design = 4; diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Src/motion.c --- a/Discovery/Src/motion.c Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Src/motion.c Thu Oct 17 23:09:17 2019 +0200 @@ -12,6 +12,7 @@ #include "motion.h" #include "data_central.h" #include "t7.h" +#include "t3.h" #include "settings.h" #define STABLE_STATE_COUNT 2 /* number of count to declare a state as stable (at the moment based on 100ms) */ @@ -62,7 +63,14 @@ { if(numOfSectors == CUSTOMER_DEFINED_VIEWS) { - sectorDetection.count = t7_GetEnabled_customviews(); + if(settingsGetPointer()->design == 3) /* Big font view ? */ + { + sectorDetection.count = t3_GetEnabled_customviews(); + } + else + { + sectorDetection.count = t7_GetEnabled_customviews(); + } if(sectorDetection.count > 7) { sectorDetection.count = 7; /* more views are hard to manually control */ diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Src/t3.c --- a/Discovery/Src/t3.c Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Src/t3.c Thu Oct 17 23:09:17 2019 +0200 @@ -58,6 +58,7 @@ /* Private types -------------------------------------------------------------*/ #define TEXTSIZE 16 +#define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */ const uint8_t t3_customviewsStandard[] = { @@ -1251,3 +1252,36 @@ GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); } + +uint8_t t3_GetEnabled_customviews() +{ + int8_t i; + uint8_t enabledViewCnt = 0; + uint32_t cv_config = settingsGetPointer()->cv_configuration; + + i=0; + do + { + if(cv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */ + { + if(!CHECK_BIT_THOME(cv_config, cv_changelist[i])) + { + enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ + } + else + { + enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */ + } + break; + } + i++; + } while(cv_changelist[i] != CVIEW_END); + if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)) + { + enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ + } + + return enabledViewCnt; +} + + diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Src/tHome.c --- a/Discovery/Src/tHome.c Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Src/tHome.c Thu Oct 17 23:09:17 2019 +0200 @@ -148,8 +148,13 @@ return; if(settingsGetPointer()->design == 3) + { settingsGetPointer()->design = 7; - + if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR) + { + DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS); + } + } switch(get_globalState()) { case StD: @@ -239,8 +244,14 @@ if(settingsGetPointer()->design == 4) return; - if(settingsGetPointer()->design == 3) + if(settingsGetPointer()->design == 3) /* switch back to t7 (standard) view */ + { settingsGetPointer()->design = 7; + if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR) + { + DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS); + } + } switch(get_globalState()) { diff -r 49a02dea8ae3 -r 427ae9f8e28e Discovery/Src/tMenuEditSystem.c --- a/Discovery/Src/tMenuEditSystem.c Thu Oct 17 21:15:42 2019 +0200 +++ b/Discovery/Src/tMenuEditSystem.c Thu Oct 17 23:09:17 2019 +0200 @@ -46,9 +46,6 @@ /*#define HAVE_DEBUG_VIEW */ static uint8_t infoPage = 0; - -static uint8_t infoPage = 0; - /* Private function prototypes -----------------------------------------------*/ void openEdit_DateTime(void); void openEdit_Language(void);