changeset 540:ffd01ead2c80

Bugfix return from submenu in t3 view: In case of beeing in a sub menu (e.g. set bearing) in t3 view and pressing back button, visualization changed to t7 view without reset of the menu state => OSTC assumes still beeing in a sub menu while user sees main screen. Solution: evaluate menu state and take action according to it.
author Ideenmodellierer
date Sat, 10 Oct 2020 18:30:13 +0200
parents d784f281833a
children 6fbf7cd391cb
files Discovery/Src/base.c
diffstat 1 files changed, 26 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/base.c	Sat Oct 10 16:59:18 2020 +0200
+++ b/Discovery/Src/base.c	Sat Oct 10 18:30:13 2020 +0200
@@ -742,11 +742,28 @@
 					tHomeDiveMenuControl(action);
 			} else if (action == ACTION_BUTTON_BACK) {
 				if (get_globalState() == StS)
+				{
 					openInfo(StILOGLIST);
-				else if ((status.page == PageDive)
-						&& (settingsGetPointer()->design < 7)) {
-					settingsGetPointer()->design = 7; // auto switch to 9 if necessary
-				} else if ((status.page == PageDive) && (status.line != 0)) {
+				}
+				else if ((status.page == PageDive) && (settingsGetPointer()->design < 7))
+				{
+					if(settingsGetPointer()->design == 3)
+					{
+						if(get_globalState() != StD)		/* located in submenu? => return */
+						{
+							set_globalState(StD);
+						}
+						else								/* return to t7 view */
+						{
+							settingsGetPointer()->design = 7;
+						}
+					}
+					else
+					{
+						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;
@@ -755,13 +772,14 @@
 							DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS);
 						}
 					}
-					else if (settingsGetPointer()->extraDisplay
-							== EXTRADISPLAY_DECOGAME)
+					else if (settingsGetPointer()->extraDisplay	== EXTRADISPLAY_DECOGAME)
 						settingsGetPointer()->design = 4;
-
 					set_globalState(StD);
-				} else
+				}
+				else
+				{
 					tHome_change_field_button_pressed();
+				}
 			} else if ((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_NEG) || (action == ACTION_PITCH_POS))
 					{