changeset 778:74253a41cf80

Zusammenf?hren
author heinrichsweikamp
date Mon, 22 May 2023 09:15:09 +0200
parents 6a8cf91e5b22 (diff) 45b8f3c2acce (current diff)
children 0b5f45448eb6
files Discovery/Src/t7.c
diffstat 3 files changed, 33 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/t7.h	Thu May 18 09:49:17 2023 +0200
+++ b/Discovery/Inc/t7.h	Mon May 22 09:15:09 2023 +0200
@@ -29,6 +29,8 @@
 #define T7_H
 
 /* Includes ------------------------------------------------------------------*/
+#include <stdbool.h>
+
 #include "stm32f4xx_hal.h"
 #include "gfx_engine.h"
 #include "configuration.h"
@@ -79,6 +81,7 @@
 uint8_t t7_GetEnabled_customviews();
 uint8_t t7_customview_disabled(uint8_t view);
 
+bool t7_isCompassShowing(void);
 /*
 	 void t7c_refresh(uint32_t FramebufferStartAddress);
 */
--- a/Discovery/Src/t7.c	Thu May 18 09:49:17 2023 +0200
+++ b/Discovery/Src/t7.c	Mon May 22 09:15:09 2023 +0200
@@ -2794,6 +2794,11 @@
 
         GFX_write_string_color(&FontT48, &t7c2, TextR1, 0, CLUT_WarningYellow);
     }
+    else if(get_globalState() == StDBEAR)
+    {
+        snprintf(TextR1, TEXTSIZE, "\a\001 %c%c? ", TXT_2BYTE, TXT2BYTE_DiveBearingQ);
+        GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+    }
     else if(get_globalState() == StDSIM1)
     {
         snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ);
@@ -4475,3 +4480,8 @@
     }
 
 }
+
+bool t7_isCompassShowing(void)
+{
+    return selection_customview == CVIEW_Compass || selection_custom_field == LLC_Compass;
+}
--- a/Discovery/Src/tHome.c	Thu May 18 09:49:17 2023 +0200
+++ b/Discovery/Src/tHome.c	Mon May 22 09:15:09 2023 +0200
@@ -181,6 +181,16 @@
 }
 
 
+static void checkSetStateCompassSim(SSettings *settings)
+{
+    if (settings->design == 7 && t7_isCompassShowing()) {
+        set_globalState(StDBEAR);
+    } else {
+        checkSetStateSim(settings);
+    }
+}
+
+
 void tHomeDiveMenuControl(uint8_t sendAction)
 {
     SSettings *settings = settingsGetPointer();
@@ -277,7 +287,7 @@
                 break;
             }
 
-            checkSetStateSim(settings);
+            checkSetStateCompassSim(settings);
 
             break;
         case StDBAILOUT:
@@ -287,11 +297,11 @@
                 break;
             }
 
-            checkSetStateSim(settings);
+            checkSetStateCompassSim(settings);
 
             break;
         case StDSETPOINT:
-            checkSetStateSim(settings);
+            checkSetStateCompassSim(settings);
 
             break;
         case StDSIM1:
@@ -355,6 +365,12 @@
             break;
 #endif
         case StDBEAR:
+            if (settingsGetPointer()->design == 7) {
+                checkSetStateSim(settings);
+
+                break;
+            }
+
         	if(settingsGetPointer()->design == 5)
         	{
         		set_globalState(StDRAVG);
@@ -500,7 +516,7 @@
             set_globalState(StD);
 
             break;
-        case StDBEAR: // t5_gauge
+        case StDBEAR: // t5_gauge, t7
             setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading);
             set_globalState(StD);
             break;