# HG changeset patch
# User Ideenmodellierer
# Date 1599763668 -7200
# Node ID e221cf762f455a39adb2601d3eb136b52515546c
# Parent  970d8040c0e3c2540fddf1e915ed9e6dbed9106d
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Due to lag of space the two options were placed within the custom view sub menu. After introduction of new visualization tab the option may be accessed directly

diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Inc/tMenuEditCustom.h
--- a/Discovery/Inc/tMenuEditCustom.h	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Inc/tMenuEditCustom.h	Thu Sep 10 20:47:48 2020 +0200
@@ -35,7 +35,8 @@
 #include "data_central.h"
 
 void openEdit_Custom(uint8_t line);
-void openEdit_CustomviewDivemode2(const uint8_t* pcv_changelist);
-void CustomviewDivemode2_refresh();
+void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist);
+void openEdit_CustomviewDivemodeMenu(uint8_t line);
+void CustomviewDivemode_refresh();
 
 #endif /* TMENU_EDIT_CUSTOM_H */
diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Inc/tStructure.h
--- a/Discovery/Inc/tStructure.h	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Inc/tStructure.h	Thu Sep 10 20:47:48 2020 +0200
@@ -280,29 +280,21 @@
 #define StMSYS3_Colors	_MB(2,8,3,2,0)
 #define StMSYS3_Debug		_MB(2,8,3,3,0)
 
-#define StMSYS4_CViewTimeout		_MB(2,8,4,1,0)
-#define StMSYS4_CViewStandard		_MB(2,8,4,2,0)
-#define StMSYS4_CornerTimeout		_MB(2,8,4,3,0)
-#define StMSYS4_CornerStandard		_MB(2,8,4,4,0)
-#define StMSYS4_ExtraDisplay		_MB(2,8,4,5,0)
-#define StMSYS4_MotionCtrl			_MB(2,8,4,6,0)
-
-#define StMSYS5_Info		_MB(2,8,5,1,0)
-
+#define StMSYS4_Info		_MB(2,8,4,1,0)
 
-#define StMSYS6_Exit			_MB(2,8,6,1,0)
-#define StMSYS6_LogbookOffset	_MB(2,8,6,7,0)
-#define StMSYS6_ResetAll		_MB(2,8,6,2,0)
-#define StMSYS6_ResetDeco		_MB(2,8,6,3,0)
-#define StMSYS6_Reboot			_MB(2,8,6,4,0)
-#define StMSYS6_Maintenance		_MB(2,8,6,5,0)
-#define StMSYS6_ResetLogbook	_MB(2,8,6,6,0)
-#define StMSYS6_SetBattCharge	_MB(2,8,6,7,0)
-#define StMSYS6_RebootRTE		_MB(2,8,6,8,0)
-#define StMSYS6_RebootMainCPU	_MB(2,8,6,9,0)
-#define StMSYS6_ScreenTest		_MB(2,8,6,10,0)
-#define StMSYS6_SetFactoryBC	_MB(2,8,6,11,0)
-#define StMSYS6_SetSampleIndx   _MB(2,8,6,12,0)
+#define StMSYS5_Exit			_MB(2,8,5,1,0)
+#define StMSYS5_LogbookOffset	_MB(2,8,5,7,0)
+#define StMSYS5_ResetAll		_MB(2,8,5,2,0)
+#define StMSYS5_ResetDeco		_MB(2,8,5,3,0)
+#define StMSYS5_Reboot			_MB(2,8,5,4,0)
+#define StMSYS5_Maintenance		_MB(2,8,5,5,0)
+#define StMSYS5_ResetLogbook	_MB(2,8,5,6,0)
+#define StMSYS5_SetBattCharge	_MB(2,8,5,7,0)
+#define StMSYS5_RebootRTE		_MB(2,8,5,8,0)
+#define StMSYS5_RebootMainCPU	_MB(2,8,5,9,0)
+#define StMSYS5_ScreenTest		_MB(2,8,5,10,0)
+#define StMSYS5_SetFactoryBC	_MB(2,8,5,11,0)
+#define StMSYS5_SetSampleIndx   _MB(2,8,5,12,0)
 
  /* PAGE 9 */
 
@@ -315,18 +307,19 @@
 #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 StMCustom2_BFSelection		_MB(2,9,2,1,0)
 
-#define StMCustom2_CViewSelection1	_MB(2,9,2,1,0)
-#define StMCustom2_CViewSelection2	_MB(2,9,2,2,0)
-#define StMCustom2_CViewSelection3	_MB(2,9,2,3,0)
-#define StMCustom2_CViewSelection4	_MB(2,9,2,4,0)
-#define StMCustom2_CViewSelection5	_MB(2,9,2,5,0)
-#define StMCustom2_CViewSelection6	_MB(2,9,2,6,0)
+#define StMCustom3_CViewSelection1	_MB(2,9,3,1,0)
+#define StMCustom3_CViewSelection2	_MB(2,9,3,2,0)
+#define StMCustom3_CViewSelection3	_MB(2,9,3,3,0)
+#define StMCustom3_CViewSelection4	_MB(2,9,3,4,0)
+#define StMCustom3_CViewSelection5	_MB(2,9,3,5,0)
+#define StMCustom3_CViewSelection6	_MB(2,9,3,6,0)
 
 
-#define StMCustom2_BFSelection		_MB(2,9,3,1,0)
-
 /* PAGE 10 */
 #define StMPLAN		_MB(2,10,0,0,0)
 
diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Src/tMenu.c
--- a/Discovery/Src/tMenu.c	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Src/tMenu.c	Thu Sep 10 20:47:48 2020 +0200
@@ -51,7 +51,7 @@
 #include "tMenuCustom.h"
 
 /* Private types -------------------------------------------------------------*/
-#define MAXPAGES 		10
+#define MAXPAGES 		11
 #define CURSOR_HIGH 	25
 #define TAB_HEADER_HIGH	25
 #define TAB_BAR_HIGH	5
diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Src/tMenuCustom.c
--- a/Discovery/Src/tMenuCustom.c	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Src/tMenuCustom.c	Thu Sep 10 20:47:48 2020 +0200
@@ -30,10 +30,12 @@
 #include <stdio.h>
 #include <string.h>
 #include "tMenu.h"
+#include "tHome.h"
 #include "tStructure.h"
 #include "tMenuCustom.h"
 #include "text_multilanguage.h"
 #include "data_central.h"
+#include "motion.h"
 
 
 /* Exported functions --------------------------------------------------------*/
@@ -57,8 +59,31 @@
 
     if((line == 0) || (line == 2))
     {
-        text[textPointer++] = TXT_2BYTE;
-        text[textPointer++] = TXT2BYTE_SelectCustomviews;
+       text[textPointer++] = TXT_2BYTE;
+       text[textPointer++] = TXT2BYTE_ExtraDisplay;
+       text[textPointer++] = ' ';
+       text[textPointer++] = ' ';
+       text[textPointer++] = TXT_2BYTE;
+
+       switch(settingsGetPointer()->extraDisplay)
+       {
+		   /* BigFont */
+		   case EXTRADISPLAY_BIGFONT:
+			   text[textPointer++] = TXT2BYTE_ExtraBigFont;
+			   break;
+		   /* DecoGame */
+		   case EXTRADISPLAY_DECOGAME:
+			   text[textPointer++] = TXT2BYTE_ExtraDecoGame;
+			   break;
+		   /* none */
+		   case EXTRADISPLAY_none:
+			   text[textPointer++] = TXT2BYTE_ExtraNone;
+			   break;
+
+		   default:
+			   snprintf(&text[textPointer++],2,"%u",settingsGetPointer()->extraDisplay);
+       break;
+       }
     }
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
@@ -66,11 +91,52 @@
     if((line == 0) || (line == 3))
     {
         text[textPointer++] = TXT_2BYTE;
+        text[textPointer++] = TXT2BYTE_SelectCustomviews;
+    }
+    strcpy(&text[textPointer],"\n\r");
+    textPointer += 2;
+
+    if((line == 0) || (line == 4))
+    {
+        text[textPointer++] = TXT_2BYTE;
         text[textPointer++] = TXT2BYTE_SelectBigFont;
     }
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
 
+#ifdef ENABLE_MOTION_CONTROL
+    if((line == 0) || (line == 5))
+    {
+    /* MotionCtrl */
+		text[textPointer++] = TXT_2BYTE;
+		text[textPointer++] = TXT2BYTE_MotionCtrl;
+		text[textPointer++] = ' ';
+		text[textPointer++] = ' ';
+		text[textPointer++] = TXT_2BYTE;
+		switch(settingsGetPointer()->MotionDetection)
+		{
+			case MOTION_DETECT_OFF:
+				text[textPointer++] = TXT2BYTE_MoCtrlNone;
+				break;
+			case MOTION_DETECT_MOVE:
+				text[textPointer++] = TXT2BYTE_MoCtrlPitch;
+				break;
+			case MOTION_DETECT_SECTOR:
+				text[textPointer++] = TXT2BYTE_MoCtrlSector;
+				break;
+			case MOTION_DETECT_SCROLL:
+				text[textPointer++] = TXT2BYTE_MoCtrlScroll;
+						break;
+			default:
+				snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection);
+				textPointer++;
+			break;
+		}
+		strcpy(&text[textPointer],"\n\r");
+		textPointer += 2;
+    }
+#endif
+
     return StMCustom;
 }
 
diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Src/tMenuEdit.c
--- a/Discovery/Src/tMenuEdit.c	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Src/tMenuEdit.c	Thu Sep 10 20:47:48 2020 +0200
@@ -222,12 +222,12 @@
 	 	 	 break;
 	 	 case (StMCustom1_CViewTimeout & MaskFieldDigit):refreshFct = refresh_Customviews;
 	 	 	 break;
-	 	 case (StMCustom2_CViewSelection1 & MaskFieldDigit) :
-	 	 case StMCustom2_CViewSelection2:
-	 	 case StMCustom2_CViewSelection3:
-	 	 case StMCustom2_CViewSelection4:
-	 	 case StMCustom2_CViewSelection5:
-	 	 case StMCustom2_CViewSelection6:
+	 	 case (StMCustom3_CViewSelection1 & MaskFieldDigit) :
+	 	 case StMCustom3_CViewSelection2:
+	 	 case StMCustom3_CViewSelection3:
+	 	 case StMCustom3_CViewSelection4:
+	 	 case StMCustom3_CViewSelection5:
+	 	 case StMCustom3_CViewSelection6:
 	 	 case (StMCustom2_BFSelection & MaskFieldDigit) : refreshFct = CustomviewDivemode_refresh;
 	 	 	 break;
 	 	 default:	 /* no menu has been updated */
diff -r 970d8040c0e3 -r e221cf762f45 Discovery/Src/tMenuEditCustom.c
--- a/Discovery/Src/tMenuEditCustom.c	Tue Sep 08 21:24:14 2020 +0200
+++ b/Discovery/Src/tMenuEditCustom.c	Thu Sep 10 20:47:48 2020 +0200
@@ -38,6 +38,9 @@
 #include "t7.h"
 #include "data_exchange_main.h"
 #include "motion.h"
+#include "tMenu.h"
+#include "tMenuSystem.h"
+
 
 #define CV_PER_PAGE  (5u)			/* number of cv selections shown at one page */
 #define CV_SUBPAGE_MAX		(2u)	/* max number of customer view selection pages */
@@ -47,14 +50,14 @@
 static const uint8_t*	pcv_curchangelist;
 /* Private function prototypes -----------------------------------------------*/
 void openEdit_Customview(void);
+void openEdit_BigScreen(void);
+void openEdit_MotionCtrl(void);
 void refresh_Customviews(void);
 /* 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_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);
-uint8_t OnAction_ExtraDisplay	 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
-uint8_t OnAction_MotionCtrl	 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 /* Exported functions --------------------------------------------------------*/
 
 
@@ -195,62 +198,6 @@
     text[5] = 0;
     write_label_var(  30, 700, ME_Y_LINE4, &FontT48, text);
 
-
-    // extra display
-    text[0] = TXT_2BYTE;
-    text[1] = TXT2BYTE_ExtraDisplay;
-    text[2] = ' ';
-    text[3] = ' ';
-    text[4] = TXT_2BYTE;
-    switch(settingsGetPointer()->extraDisplay)
-    {
-    /* BigFont */
-    case EXTRADISPLAY_BIGFONT:
-        text[5] = TXT2BYTE_ExtraBigFont;
-        break;
-    /* DecoGame */
-    case EXTRADISPLAY_DECOGAME:
-        text[5] = TXT2BYTE_ExtraDecoGame;
-        break;
-    /* none */
-    case EXTRADISPLAY_none:
-        text[5] = TXT2BYTE_ExtraNone;
-        break;
-
-    default:
-        snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay);
-    break;
-    }
-    text[6] = 0;
-    write_label_var(  30, 700, ME_Y_LINE5, &FontT48, text);
-
-    /* MotionCtrl */
-    text[0] = TXT_2BYTE;
-    text[1] = TXT2BYTE_MotionCtrl;
-    text[2] = ' ';
-    text[3] = ' ';
-    text[4] = TXT_2BYTE;
-    switch(settingsGetPointer()->MotionDetection)
-    {
-		case MOTION_DETECT_OFF:
-			text[5] = TXT2BYTE_MoCtrlNone;
-			break;
-		case MOTION_DETECT_MOVE:
-			text[5] = TXT2BYTE_MoCtrlPitch;
-			break;
-		case MOTION_DETECT_SECTOR:
-			text[5] = TXT2BYTE_MoCtrlSector;
-			break;
-		case MOTION_DETECT_SCROLL:
-			text[5] = TXT2BYTE_MoCtrlScroll;
-					break;
-		default:
-			snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection);
-		break;
-    }
-    text[6] = 0;
-    write_label_var(  30, 700, ME_Y_LINE6, &FontT48, text);
-
     write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
 }
 
@@ -262,14 +209,15 @@
     switch(line)
     {
     	case 1:
-    	default:
-    			openEdit_Customview();
+    	default:	openEdit_Customview();
+    		break;
+    	case 2: 	openEdit_BigScreen();
     		break;
-    	case 2:
-				openEdit_CustomviewDivemode(cv_changelist);
+    	case 3:		openEdit_CustomviewDivemode(cv_changelist);
     		break;
-    	case 3:
-				openEdit_CustomviewDivemode(cv_changelist_BS);
+    	case 4:		openEdit_CustomviewDivemode(cv_changelist_BS);
+    		break;
+    	case 5:		openEdit_MotionCtrl();
     		break;
     }
 }
@@ -285,17 +233,59 @@
     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_ExtraDisplay,		400, 700, ME_Y_LINE5,  &FontT48, "");
-    write_field_button(StMCustom1_MotionCtrl,		400, 700, ME_Y_LINE6,  &FontT48, "");
-
     setEvent(StMCustom1_CViewTimeout,		(uint32_t)OnAction_CViewTimeout);
     setEvent(StMCustom1_CViewStandard,		(uint32_t)OnAction_CViewStandard);
 
     setEvent(StMCustom1_CornerTimeout,		(uint32_t)OnAction_CornerTimeout);
     setEvent(StMCustom1_CornerStandard,	(uint32_t)OnAction_CornerStandard);
+}
 
-    setEvent(StMCustom1_ExtraDisplay,		(uint32_t)OnAction_ExtraDisplay);
-    setEvent(StMCustom1_MotionCtrl,		(uint32_t)OnAction_MotionCtrl);
+void openEdit_BigScreen(void)
+{
+	uint8_t newValue = 0;
+    SSettings *pSettings = settingsGetPointer();
+
+    newValue = pSettings->extraDisplay + 1;
+    if(newValue == EXTRADISPLAY_DECOGAME)  /* Decogame not yet implemented */
+    {
+    	newValue++;
+    }
+    if(newValue >= EXTRADISPLAY_END)
+    {
+    	newValue = EXTRADISPLAY_none;
+    }
+    pSettings->extraDisplay = newValue;
+
+    exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
+}
+
+void openEdit_MotionCtrl(void)
+{
+	uint8_t newValue = 0;
+    SSettings *pSettings = settingsGetPointer();
+
+     switch(pSettings->MotionDetection)
+     {
+     case MOTION_DETECT_OFF:
+         newValue = MOTION_DETECT_MOVE;
+         break;
+     case MOTION_DETECT_MOVE:
+         newValue = MOTION_DETECT_SECTOR;
+         break;
+     case MOTION_DETECT_SECTOR:
+         newValue = MOTION_DETECT_SCROLL;
+         break;
+     case MOTION_DETECT_SCROLL:
+     	newValue = MOTION_DETECT_OFF;
+     	break;
+     default:
+         newValue = MOTION_DETECT_OFF;
+         break;
+     }
+     pSettings->MotionDetection = newValue;
+     InitMotionDetection();
+
+     exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
 }
 
 char customview_TXT2BYTE_helper(uint8_t customViewId)
@@ -479,15 +469,15 @@
 
 	switch(editId)
 	{
-		case StMCustom2_CViewSelection1:	line = 1;
+		case StMCustom3_CViewSelection1:	line = 1;
 			break;
-		case StMCustom2_CViewSelection2:	line = 2;
+		case StMCustom3_CViewSelection2:	line = 2;
 			break;
-		case StMCustom2_CViewSelection3:	line = 3;
+		case StMCustom3_CViewSelection3:	line = 3;
 			break;
-		case StMCustom2_CViewSelection4:	line = 4;
+		case StMCustom3_CViewSelection4:	line = 4;
 			break;
-		case StMCustom2_CViewSelection5:	line = 5;
+		case StMCustom3_CViewSelection5:	line = 5;
 			break;
 
 		default:
@@ -523,7 +513,7 @@
 	resetMenuEdit(CLUT_MenuPageCustomView);				/* rebuild page */
 	openEdit_CustomviewDivemode(pcv_curchangelist);
 
-	tMenuEdit_select(StMCustom2_CViewSelection6);
+	tMenuEdit_select(StMCustom3_CViewSelection6);
     return UPDATE_DIVESETTINGS;
 }
 
@@ -572,23 +562,21 @@
 
 				switch(i)
 				{
-					case 0: 	write_field_button(StMCustom2_CViewSelection1,	30, 800, ME_Y_LINE1,  &FontT48, "");
+					case 0: 	write_field_button(StMCustom3_CViewSelection1,	30, 800, ME_Y_LINE1,  &FontT48, "");
 						break;
-					case 1: 	write_field_button(StMCustom2_CViewSelection2,	30, 800, ME_Y_LINE2,  &FontT48, "");
+					case 1: 	write_field_button(StMCustom3_CViewSelection2,	30, 800, ME_Y_LINE2,  &FontT48, "");
 						break;
-					case 2: 	write_field_button(StMCustom2_CViewSelection3,	30, 800, ME_Y_LINE3,  &FontT48, "");
+					case 2: 	write_field_button(StMCustom3_CViewSelection3,	30, 800, ME_Y_LINE3,  &FontT48, "");
 						break;
-					case 3: 	write_field_button(StMCustom2_CViewSelection4,	30, 800, ME_Y_LINE4,  &FontT48, "");
+					case 3: 	write_field_button(StMCustom3_CViewSelection4,	30, 800, ME_Y_LINE4,  &FontT48, "");
 						break;
-					case 4: 	write_field_button(StMCustom2_CViewSelection5,	30, 800, ME_Y_LINE5,  &FontT48, "");
+					case 4: 	write_field_button(StMCustom3_CViewSelection5,	30, 800, ME_Y_LINE5,  &FontT48, "");
 						break;
 					default:
 						break;
 				}
      	}
      }
-  //   setEvent(StMCustom2_CViewSelection1, 				(uint32_t)OnAction_Customview_Toggle);
-
 
      if(customviewsSubpageMax != 1)
      {
@@ -596,7 +584,7 @@
          text[textPointer++] = TXT_2BYTE;
          text[textPointer++] = TXT2BYTE_ButtonNext;
          text[textPointer] = 0;
-    	 write_field_button(StMCustom2_CViewSelection6,	30, 800, ME_Y_LINE6,  &FontT48, text);
+    	 write_field_button(StMCustom3_CViewSelection6,	30, 800, ME_Y_LINE6,  &FontT48, text);
      }
 
      /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */
@@ -611,15 +599,15 @@
      	{
 				switch(i)
 				{
-					case 0: 	setEvent(StMCustom2_CViewSelection1, 				(uint32_t)OnAction_Customview_Toggle);
+					case 0: 	setEvent(StMCustom3_CViewSelection1, 				(uint32_t)OnAction_Customview_Toggle);
 						break;
-					case 1: 	setEvent(StMCustom2_CViewSelection2, 				(uint32_t)OnAction_Customview_Toggle);
+					case 1: 	setEvent(StMCustom3_CViewSelection2, 				(uint32_t)OnAction_Customview_Toggle);
 						break;
-					case 2: 	setEvent(StMCustom2_CViewSelection3, 				(uint32_t)OnAction_Customview_Toggle);
+					case 2: 	setEvent(StMCustom3_CViewSelection3, 				(uint32_t)OnAction_Customview_Toggle);
 						break;
-					case 3: 	setEvent(StMCustom2_CViewSelection4, 				(uint32_t)OnAction_Customview_Toggle);
+					case 3: 	setEvent(StMCustom3_CViewSelection4, 				(uint32_t)OnAction_Customview_Toggle);
 						break;
-					case 4: 	setEvent(StMCustom2_CViewSelection5, 				(uint32_t)OnAction_Customview_Toggle);
+					case 4: 	setEvent(StMCustom3_CViewSelection5, 				(uint32_t)OnAction_Customview_Toggle);
 						break;
 
 					default:
@@ -630,7 +618,7 @@
      }
      if(customviewsSubpageMax != 1)
      {
-    	 setEvent(StMCustom2_CViewSelection6,(uint32_t)OnAction_Customview_NextPage);
+    	 setEvent(StMCustom3_CViewSelection6,(uint32_t)OnAction_Customview_NextPage);
      }
      for(;i<5;i++)	/* clear empty lines in case menu shows less than 5 entries */
      {
@@ -657,7 +645,6 @@
 {
 	static uint8_t customviewsSubpage = 0;
 	SSettings *pSettings = settingsGetPointer();
-	extern _Bool WriteSettings;
 	char text[MAX_PAGE_TEXTSIZE];
 	uint16_t tabPosition;
 	uint32_t id;
@@ -705,34 +692,6 @@
     return UNSPECIFIC_RETURN;
 }
 
-
-
-uint8_t OnAction_MotionCtrl	 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
-{
-    uint8_t newValue;
-    switch(settingsGetPointer()->MotionDetection)
-    {
-    case MOTION_DETECT_OFF:
-        newValue = MOTION_DETECT_MOVE;
-        break;
-    case MOTION_DETECT_MOVE:
-        newValue = MOTION_DETECT_SECTOR;
-        break;
-    case MOTION_DETECT_SECTOR:
-        newValue = MOTION_DETECT_SCROLL;
-        break;
-    case MOTION_DETECT_SCROLL:
-    	newValue = MOTION_DETECT_OFF;
-    	break;
-    default:
-        newValue = MOTION_DETECT_OFF;
-        break;
-    }
-    settingsGetPointer()->MotionDetection = newValue;
-    InitMotionDetection();
-    return UNSPECIFIC_RETURN;
-}
-
 void CustomviewDivemode_refresh()
 {
 	SSettings *pSettings = settingsGetPointer();