# HG changeset patch # User heinrichsweikamp # Date 1684739667 -7200 # Node ID 6a8cf91e5b22b42d2b23c02dfd31b4d70b46e1d8 # Parent 46c6d2380d4ed2f47eb5d74a0758cf21605f39e7 This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller) diff -r 46c6d2380d4e -r 6a8cf91e5b22 Discovery/Inc/t7.h --- a/Discovery/Inc/t7.h Thu May 11 12:13:03 2023 +0200 +++ b/Discovery/Inc/t7.h Mon May 22 09:14:27 2023 +0200 @@ -29,6 +29,8 @@ #define T7_H /* Includes ------------------------------------------------------------------*/ +#include + #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); */ diff -r 46c6d2380d4e -r 6a8cf91e5b22 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Thu May 11 12:13:03 2023 +0200 +++ b/Discovery/Src/t7.c Mon May 22 09:14:27 2023 +0200 @@ -2800,6 +2800,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); @@ -4481,3 +4486,8 @@ } } + +bool t7_isCompassShowing(void) +{ + return selection_customview == CVIEW_Compass || selection_custom_field == LLC_Compass; +} diff -r 46c6d2380d4e -r 6a8cf91e5b22 Discovery/Src/tHome.c --- a/Discovery/Src/tHome.c Thu May 11 12:13:03 2023 +0200 +++ b/Discovery/Src/tHome.c Mon May 22 09:14:27 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;