# HG changeset patch # User ideenmodellierer # Date 1568666974 -7200 # Node ID 0dbf550dc7432d8bd1616030fb4a65e41834c12c # Parent 834e087505ec645abeae18dd5b3ba55e2b286227 Added missing customerview selection In the previous version only 6 out of 10 custom views could be configurated => Added a second page for the dive menu system tab In case all views are deactivated the none / debug page will be set as default diff -r 834e087505ec -r 0dbf550dc743 Discovery/Inc/tHome.h --- a/Discovery/Inc/tHome.h Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Inc/tHome.h Mon Sep 16 22:49:34 2019 +0200 @@ -83,7 +83,7 @@ }; // for custom view switch on/off 161122 hw -extern const uint8_t cv_changelist[6]; +extern const uint8_t cv_changelist[]; #define CHECK_BIT_THOME(var,pos) (((var)>>(pos)) & 1) typedef struct diff -r 834e087505ec -r 0dbf550dc743 Discovery/Inc/tMenu.h --- a/Discovery/Inc/tMenu.h Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Inc/tMenu.h Mon Sep 16 22:49:34 2019 +0200 @@ -78,6 +78,7 @@ void tM_rebuild_menu_after_tComm(void); void tM_refresh(char *text, uint8_t *textPointer, uint8_t line, const char content[6]); +void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext); void block_diluent_page(void); void unblock_diluent_page(void); diff -r 834e087505ec -r 0dbf550dc743 Discovery/Inc/tMenuSystem.h --- a/Discovery/Inc/tMenuSystem.h Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Inc/tMenuSystem.h Mon Sep 16 22:49:34 2019 +0200 @@ -36,6 +36,8 @@ * @{ */ +void set_CustomsviewsSubpage(uint8_t page); + /* Exported variables --------------------------------------------------------*/ diff -r 834e087505ec -r 0dbf550dc743 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Src/t7.c Mon Sep 16 22:49:34 2019 +0200 @@ -1501,6 +1501,7 @@ uint8_t t7_GetEnabled_customviews() { + int8_t i; uint8_t *pViews; uint8_t increment = 1; @@ -1516,14 +1517,23 @@ { increment = 1; /* check if view is enabled */ - for(int i=0;i<6;i++) + i=0; + do { - if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(cv_config, (1 << cv_changelist[i]))) + if(*pViews == cv_changelist[i]) { - increment = 0; - break; + if(!CHECK_BIT_THOME(cv_config, cv_changelist[i])) + { + increment = 0; + } + break; } - } + i++; + } while(cv_changelist[i] != CVIEW_END); + if(cv_changelist[i] == CVIEW_END) + { + increment = 0; + } if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) && ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))) { @@ -1538,6 +1548,7 @@ void t7_change_customview(uint8_t action) { + int8_t i; uint8_t *pViews; uint8_t *pStartView,*pCurView, *pLastView; _Bool cv_disabled = 0; @@ -1585,13 +1596,15 @@ do { cv_disabled = 0; - for(int i=0;i<6;i++) + i=0; + while(cv_changelist[i] != CVIEW_END) { if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i])) { cv_disabled = 1; break; } + i++; } if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) && diff -r 834e087505ec -r 0dbf550dc743 Discovery/Src/tHome.c --- a/Discovery/Src/tHome.c Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Src/tHome.c Mon Sep 16 22:49:34 2019 +0200 @@ -57,7 +57,7 @@ static uint16_t tHome_tick_count_cview; static uint16_t tHome_tick_count_field; -const uint8_t cv_changelist[6] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist}; +const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist,CVIEW_sensors,CVIEW_sensors_mV, CVIEW_END}; /* Private function prototypes -----------------------------------------------*/ diff -r 834e087505ec -r 0dbf550dc743 Discovery/Src/tMenu.c --- a/Discovery/Src/tMenu.c Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Src/tMenu.c Mon Sep 16 22:49:34 2019 +0200 @@ -315,7 +315,7 @@ } -static void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) +void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) { uint8_t linesFound; uint16_t i; diff -r 834e087505ec -r 0dbf550dc743 Discovery/Src/tMenuEditSystem.c --- a/Discovery/Src/tMenuEditSystem.c Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Src/tMenuEditSystem.c Mon Sep 16 22:49:34 2019 +0200 @@ -35,11 +35,18 @@ #include "ostc.h" #include "settings.h" // for getLicence() #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() +#include "tMenu.h" #include "tMenuEdit.h" +#include "tMenuSystem.h" #include "Motion.h" +#include "t7.h" + +#define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */ /* Private variables ---------------------------------------------------------*/ -uint8_t infoPage = 0; +static uint8_t infoPage = 0; + + /* Private function prototypes -----------------------------------------------*/ void openEdit_DateTime(void); @@ -150,13 +157,38 @@ void openEdit_CustomviewDivemode(uint8_t line) { + static uint8_t customviewsSubpage = 0; SSettings *pSettings = settingsGetPointer(); extern _Bool WriteSettings; + char text[MAX_PAGE_TEXTSIZE]; + uint16_t tabPosition; + uint32_t id; - pSettings->cv_configuration ^= 1 << (cv_changelist[line-1]); - WriteSettings = 1; - InitMotionDetection(); /* consider new view setup for view selection by motion */ - exitMenuEdit_to_Menu_with_Menu_Update(); + + if((line == 6) || (cv_changelist[customviewsSubpage * 5 + line-1] == CVIEW_END)) /* select next set of views */ + { + customviewsSubpage++; + if(customviewsSubpage == CV_SUBPAGE_MAX) + { + customviewsSubpage = 0; + } + set_CustomsviewsSubpage(customviewsSubpage); + /* rebuild the selection page with the next set of customer views */ + id = tMSystem_refresh(0, text, &tabPosition, NULL); + tM_build_page(id, text, tabPosition, NULL); + openMenu(0); + } + else + { + pSettings->cv_configuration ^= 1 << (cv_changelist[customviewsSubpage * 5 + line-1]); + if(t7_GetEnabled_customviews() == 0) + { + pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug); + } + WriteSettings = 1; + InitMotionDetection(); /* consider new view setup for view selection by motion */ + exitMenuEdit_to_Menu_with_Menu_Update(); + } } diff -r 834e087505ec -r 0dbf550dc743 Discovery/Src/tMenuSystem.c --- a/Discovery/Src/tMenuSystem.c Mon Sep 16 22:46:24 2019 +0200 +++ b/Discovery/Src/tMenuSystem.c Mon Sep 16 22:49:34 2019 +0200 @@ -31,14 +31,22 @@ #include "tMenuSystem.h" #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() +static uint8_t customviewsSubpage = 0; + /* Private function prototypes -----------------------------------------------*/ char customview_TXT2BYTE_helper(uint8_t customViewId); +void set_CustomsviewsSubpage(uint8_t page) +{ + customviewsSubpage = page; +} + /* Exported functions --------------------------------------------------------*/ uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) { SSettings *data; + int i; uint8_t textPointer; uint8_t dateFormat; uint8_t RTEhigh, RTElow; @@ -56,18 +64,33 @@ { uint8_t id; - for(int i=0; i<6;i++) + for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ { - id = cv_changelist[i]; - text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); - text[textPointer++] = ' '; - textPointer += snprintf(&text[textPointer], 60, - "%c%c\n\r", - TXT_2BYTE, customview_TXT2BYTE_helper(id) - ); + id = cv_changelist[customviewsSubpage * 5 + i]; + if(id == CVIEW_END) /* last list item? */ + { + break; + } + else + { + text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); + text[textPointer++] = ' '; + textPointer += snprintf(&text[textPointer], 60, + "%c%c\n\r", + TXT_2BYTE, customview_TXT2BYTE_helper(id)); + } } + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ButtonNext; text[textPointer] = 0; + for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ + { + text[textPointer++]='\n'; + text[textPointer++]='\r'; + text[textPointer] = 0; + } + return StMSYS; } @@ -300,6 +323,7 @@ text = TXT2BYTE_Summary; break; case CVIEW_noneOrDebug: + text = TXT2BYTE_DispNoneDbg; break; default: break;