changeset 633:68d95049f11a

Added menu structure to allow ppo2 modification in simulator mode: For development purpose (to be enabled by compile switch) the posibillity to modify ppo2 values using the T3_Sensor view quick menu access has been added.
author Ideenmodellierer
date Tue, 23 Feb 2021 21:58:18 +0100
parents 2586f7b734f4
children 7c73f066cd16
files Discovery/Inc/configuration.h Discovery/Inc/tStructure.h Discovery/Src/t3.c Discovery/Src/tHome.c
diffstat 4 files changed, 146 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/configuration.h	Tue Feb 23 21:55:52 2021 +0100
+++ b/Discovery/Inc/configuration.h	Tue Feb 23 21:58:18 2021 +0100
@@ -58,5 +58,7 @@
 /* Enable to have the new T3 profile view available */
 /* #define ENABLE_T3_PROFILE_VIEW */
 
+/* Enable to have PPO2 adjustments in T3 sensor view during dive simulation */
+/* #define ENABLE_T3_PPO_SIM */
 
 #endif
--- a/Discovery/Inc/tStructure.h	Tue Feb 23 21:55:52 2021 +0100
+++ b/Discovery/Inc/tStructure.h	Tue Feb 23 21:58:18 2021 +0100
@@ -99,6 +99,8 @@
 #define StDQUIT	_MB(1,2,10,0,0)
 #define StDMARK	_MB(1,2,11,0,0)
 #define StDCHECK _MB(1,2,12,0,0)
+#define StDSIM5	_MB(1,2,13,0,0)
+#define StDSIM6	_MB(1,2,14,0,0)
 
 
 #define StUART_STANDARD		_MB(3,1,0,0,0)
--- a/Discovery/Src/t3.c	Tue Feb 23 21:55:52 2021 +0100
+++ b/Discovery/Src/t3.c	Tue Feb 23 21:58:18 2021 +0100
@@ -689,6 +689,26 @@
 							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
     			break;
 
+#ifdef ENABLE_T3_PPO_SIM
+    		case StDSIM1:	snprintf(text,TEXTSIZE,"\a\003\001PPO S0 +");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+    		case StDSIM2:	snprintf(text,TEXTSIZE,"\a\003\001PPO S0 -");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+    		case StDSIM3:	snprintf(text,TEXTSIZE,"\a\003\001PPO S1 +");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+    		case StDSIM4:	snprintf(text,TEXTSIZE,"\a\003\001PPO S1 -");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+    		case StDSIM5:	snprintf(text,TEXTSIZE,"\a\003\001PPO S2 +");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+    		case StDSIM6:	snprintf(text,TEXTSIZE,"\a\003\001PPO S2 -");
+							GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
+    			break;
+#endif
     		default:		/* show divetime */
 
 							Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
@@ -1241,6 +1261,7 @@
                 text[textpointer++] = ' ';
                 text[textpointer++] = '-';
                 text[textpointer++] = ' ';
+                text[textpointer++] = 0;
             }
             else
             {
--- a/Discovery/Src/tHome.c	Tue Feb 23 21:55:52 2021 +0100
+++ b/Discovery/Src/tHome.c	Tue Feb 23 21:58:18 2021 +0100
@@ -193,6 +193,13 @@
                         						set_globalState(StDMGAS);
             								}
             			break;
+#ifdef ENABLE_T3_PPO_SIM
+            		case CVIEW_sensors:		if(is_stateUsedSetToSim())
+											{
+												set_globalState(StDSIM1);
+											}
+						break;
+#endif
 #ifdef ENABLE_T3_PROFILE_VIEW
             		case CVIEW_T3_Profile: 	set_globalState(StDMARK);
 #endif
@@ -232,7 +239,34 @@
 
         case StDMENU:
             if(is_stateUsedSetToSim())
-                set_globalState(StDSIM1);
+            {
+            	if(settingsGetPointer()->design != 3)
+            	{
+            		set_globalState(StDSIM1);
+            	}
+            	else
+            	{
+#ifdef ENABLE_T3_PPO_SIM
+            		if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x01) == 0)
+            		{
+            			set_globalState(StDSIM1);
+            		}
+            		else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0)
+            		{
+            			set_globalState(StDSIM3);
+            		}
+            		else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
+            		{
+            			set_globalState(StDSIM5);
+            		}
+            		else
+            		{
+            			set_globalState(StD);
+            		}
+#endif
+            	}
+            }
+
             else
                 set_globalState(StD);
             break;
@@ -242,7 +276,27 @@
             break;
 
         case StDSIM2:
-                set_globalState(StDSIM3);
+           		if(settingsGetPointer()->design != 3)
+            	{
+            		set_globalState(StDSIM3);
+            	}
+            	else
+            	{
+#ifdef ENABLE_T3_PPO_SIM
+            		if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0)
+            		{
+            			set_globalState(StDSIM3);
+            		}
+            		else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
+            		{
+            			set_globalState(StDSIM5);
+            		}
+            		else
+            		{
+            			set_globalState(StD);
+            		}
+#endif
+            	}
             break;
 
         case StDSIM3:
@@ -250,9 +304,33 @@
             break;
 
         case StDSIM4:
+           	if(settingsGetPointer()->design != 3)
+            {
+                set_globalState(StD);
+            }
+           	else
+           	{
+#ifdef ENABLE_T3_PPO_SIM
+           		if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
+           		{
+           			set_globalState(StDSIM5);
+           		}
+           		else
+           		{
+           			set_globalState(StD);
+           		}
+#endif
+           	}
+            break;
+#ifdef ENABLE_T3_PPO_SIM
+        case StDSIM5:
+                set_globalState(StDSIM6);
+            break;
+
+        case StDSIM6:
                 set_globalState(StD);
             break;
-
+#endif
         case StDBEAR:
         	if(settingsGetPointer()->design == 5)
         	{
@@ -326,21 +404,59 @@
             break;
 
         case StDSIM1:
+        	if(settingsGetPointer()->design != 3)
+        	{
                 Sim_Quit();
+        	}
+        	else
+        	{
+        		Sim_IncreasePPO(0);
+        	}
             break;
 
         case StDSIM2:
-                Sim_Ascend();
+        	if(settingsGetPointer()->design != 3)
+        	{
+        		Sim_Ascend();
+        	}
+        	else
+        	{
+        		Sim_DecreasePPO(0);
+        	}
+
             break;
 
         case StDSIM3:
+        	if(settingsGetPointer()->design != 3)
+        	{
                 Sim_Descend();
+        	}
+        	else
+        	{
+        		Sim_IncreasePPO(1);
+        	}
+
             break;
 
         case StDSIM4:
+        	if(settingsGetPointer()->design != 3)
+        	{
                 Sim_Divetime();
+        	}
+        	else
+        	{
+        		Sim_DecreasePPO(1);
+        	}
+
             break;
-
+#ifdef ENABLE_T3_PPO_SIM
+        case StDSIM5:
+        		Sim_IncreasePPO(2);
+			break;
+        case StDSIM6:
+        		Sim_DecreasePPO(2);
+			break;
+#endif
         case StDBEAR: // t5_gauge
         	stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
             set_globalState(StD);