changeset 541:6fbf7cd391cb

Added default view selection and auto return to view to t3 visualization: In previous version the ostc tried to applied the t7 default view selection to t3 view. As t3 has different views than t3, a new selection menu has been added to the custom view menu enabling the selection of the big font default view. In parallel the auto return function has been adapted to use the new parameter.
author Ideenmodellierer
date Sat, 10 Oct 2020 18:34:10 +0200
parents ffd01ead2c80
children 6960df7ddb09
files Discovery/Inc/t3.h Discovery/Inc/tStructure.h Discovery/Src/settings.c Discovery/Src/t3.c Discovery/Src/tHome.c Discovery/Src/tMenuEditCustom.c
diffstat 6 files changed, 73 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/t3.h	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Inc/t3.h	Sat Oct 10 18:34:10 2020 +0200
@@ -38,5 +38,6 @@
 void t3_change_customview(uint8_t action);
 uint8_t t3_GetEnabled_customviews(void);
 uint8_t t3_getCustomView(void);
+void t3_set_customview_to_primary(void);
 
 #endif /* T3_H */
--- a/Discovery/Inc/tStructure.h	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Inc/tStructure.h	Sat Oct 10 18:34:10 2020 +0200
@@ -307,10 +307,9 @@
 
 #define StMCustom1_CViewTimeout		_MB(2,9,1,1,0)
 #define StMCustom1_CViewStandard	_MB(2,9,1,2,0)
-#define StMCustom1_CornerTimeout	_MB(2,9,1,3,0)
-#define StMCustom1_CornerStandard	_MB(2,9,1,4,0)
-#define StMCustom1_ExtraDisplay		_MB(2,9,1,5,0)
-#define StMCustom1_MotionCtrl		_MB(2,9,1,6,0)
+#define StMCustom1_CViewStandardBF	_MB(2,9,1,3,0)
+#define StMCustom1_CornerTimeout	_MB(2,9,1,4,0)
+#define StMCustom1_CornerStandard	_MB(2,9,1,5,0)
 
 #define StMCustom2_BFSelection		_MB(2,9,2,1,0)
 
--- a/Discovery/Src/settings.c	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Src/settings.c	Sat Oct 10 18:34:10 2020 +0200
@@ -313,6 +313,7 @@
 	.MotionDetection = MOTION_DETECT_OFF,
 	.cv_config_BigScreen = 0xFFFFFFFF,
 	.compassInertia = 0,
+	.tX_customViewPrimaryBF = CVIEW_T3_Decostop,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -467,7 +468,8 @@
         pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData;
         // no break
     case 0xFFFF001B:
-    	pSettings->compassInertia = 0; 	/* no inertia */
+    	pSettings->compassInertia = 0; 			/* no inertia */
+    	pSettings->tX_customViewPrimaryBF = CVIEW_T3_Decostop;
         // no break
     default:
         pSettings->header = pStandard->header;
@@ -1387,6 +1389,11 @@
     	Settings.compassInertia = 0;
 	    corrections++;
    	}
+    if(Settings.tX_customViewPrimaryBF > CVIEW_T3_END)
+    {
+    	Settings.tX_customViewPrimaryBF = CVIEW_T3_Decostop;
+    	corrections++;
+    }
 
     if(corrections > 255)
         return 255;
--- a/Discovery/Src/t3.c	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Src/t3.c	Sat Oct 10 18:34:10 2020 +0200
@@ -72,6 +72,7 @@
 	CVIEW_T3_GasList,
 	CVIEW_T3_Navigation,
 	CVIEW_T3_DepthData,
+	CVIEW_noneOrDebug,
     CVIEW_T3_END
 };
 
@@ -179,7 +180,7 @@
     if(status.base != BaseHome)
         return;
 
-    if(last_mode != MODE_DIVE)			/* Select customview */
+    if(last_mode != MODE_DIVE)			/* Select custom view */
     {
     	if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo))
     	{
@@ -187,7 +188,7 @@
     	}
     	else
     	{
-    		t3_selection_customview = settingsGetPointer()->tX_customViewPrimary;
+    		t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF;
     	}
     	t3_change_customview(ACTION_END);
     }
@@ -198,6 +199,13 @@
     last_mode = stateUsed->mode;
 }
 
+void t3_set_customview_to_primary(void)
+{
+    if(stateUsed->mode == MODE_DIVE)
+    {
+    	t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF;
+    }
+}
 
 /* Private functions ---------------------------------------------------------*/
 
--- a/Discovery/Src/tHome.c	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Src/tHome.c	Sat Oct 10 18:34:10 2020 +0200
@@ -434,6 +434,10 @@
             {
                 t7_set_customview_to_primary();
             }
+            if(settingsGetPointer()->design == 3)
+            {
+                t3_set_customview_to_primary();
+            }
         }
     }
 }
--- a/Discovery/Src/tMenuEditCustom.c	Sat Oct 10 18:30:13 2020 +0200
+++ b/Discovery/Src/tMenuEditCustom.c	Sat Oct 10 18:34:10 2020 +0200
@@ -53,9 +53,11 @@
 void openEdit_BigScreen(void);
 void openEdit_MotionCtrl(void);
 void refresh_Customviews(void);
+char customview_TXT2BYTE_helper(uint8_t customViewId);
 /* Announced function prototypes -----------------------------------------------*/
 uint8_t OnAction_CViewTimeout  (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 /* Exported functions --------------------------------------------------------*/
@@ -82,11 +84,13 @@
     textpointer += snprintf(&text[textpointer],11,"  %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds);
     write_label_var(  30, 700, ME_Y_LINE1, &FontT48, text);
 
-    // custom view center  primary
+    // custom view center primary
     text[0] = TXT_2BYTE;
     text[1] = TXT2BYTE_CViewStandard;
     text[2] = ' ';
     text[3] = ' ';
+
+#if 0
     switch(settingsGetPointer()->tX_customViewPrimary)
     {
     case CVIEW_sensors:
@@ -133,16 +137,28 @@
         snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary);
     break;
     }
+#endif
+    text[4] = TXT_2BYTE;
+    text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimary);
     text[6] = 0;
     write_label_var(  30, 700, ME_Y_LINE2, &FontT48, text);
 
+    // custom view big font
+    text[0] = TXT_2BYTE;
+    text[1] = TXT2BYTE_ExtraDisplay;
+    text[2] = ' ';
+    text[3] = ' ';
+    text[4] = TXT_2BYTE;
+    text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimaryBF);
+    text[6] = 0;
+    write_label_var(  30, 700, ME_Y_LINE3, &FontT48, text);
 
     // field corner  return
     textpointer = 0;
     text[textpointer++] = TXT_2BYTE;
     text[textpointer++] = TXT2BYTE_CornerTimeout;
     textpointer += snprintf(&text[textpointer],11,"  %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds);
-    write_label_var(  30, 700, ME_Y_LINE3, &FontT48, text);
+    write_label_var(  30, 700, ME_Y_LINE5, &FontT48, text);
 
     // field corner  primary
     text[0] = TXT_2BYTE;
@@ -196,7 +212,7 @@
     break;
     }
     text[5] = 0;
-    write_label_var(  30, 700, ME_Y_LINE4, &FontT48, text);
+    write_label_var(  30, 700, ME_Y_LINE6, &FontT48, text);
 
     write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
 }
@@ -229,15 +245,17 @@
 
     write_field_button(StMCustom1_CViewTimeout,		400, 700, ME_Y_LINE1,  &FontT48, "");
     write_field_button(StMCustom1_CViewStandard,	400, 700, ME_Y_LINE2,  &FontT48, "");
+    write_field_button(StMCustom1_CViewStandardBF,	400, 700, ME_Y_LINE3,  &FontT48, "");
 
-    write_field_button(StMCustom1_CornerTimeout,	400, 700, ME_Y_LINE3,  &FontT48, "");
-    write_field_button(StMCustom1_CornerStandard,	400, 700, ME_Y_LINE4,  &FontT48, "");
+    write_field_button(StMCustom1_CornerTimeout,	400, 700, ME_Y_LINE5,  &FontT48, "");
+    write_field_button(StMCustom1_CornerStandard,	400, 700, ME_Y_LINE6,  &FontT48, "");
 
     setEvent(StMCustom1_CViewTimeout,		(uint32_t)OnAction_CViewTimeout);
     setEvent(StMCustom1_CViewStandard,		(uint32_t)OnAction_CViewStandard);
+    setEvent(StMCustom1_CViewStandardBF,	(uint32_t)OnAction_CViewStandardBF);
 
     setEvent(StMCustom1_CornerTimeout,		(uint32_t)OnAction_CornerTimeout);
-    setEvent(StMCustom1_CornerStandard,	(uint32_t)OnAction_CornerStandard);
+    setEvent(StMCustom1_CornerStandard,		(uint32_t)OnAction_CornerStandard);
 }
 
 void openEdit_BigScreen(void)
@@ -419,6 +437,29 @@
     return UPDATE_DIVESETTINGS;
 }
 
+uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+{
+	uint8_t index = 0;
+    uint8_t newValue;
+
+	/* list contains all views which may be selected => get index of current setting */
+	while((settingsGetPointer()->tX_customViewPrimaryBF != cv_changelist_BS[index])	 || (cv_changelist_BS[index] == CVIEW_T3_END))
+	{
+		index++;
+	}
+	if((cv_changelist_BS[index] == CVIEW_T3_END) || (cv_changelist_BS[index+1] == CVIEW_T3_END)) 	/* invalid or last setting */
+	{
+		newValue = cv_changelist_BS[0];
+	}
+	else
+	{
+		newValue = cv_changelist_BS[index + 1];
+	}
+
+    settingsGetPointer()->tX_customViewPrimaryBF = newValue;
+    return UPDATE_DIVESETTINGS;
+}
+
 
 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {