# HG changeset patch # User Ideenmodellierer # Date 1702844057 -3600 # Node ID 2a8af51ab04db9bf96ddb062f29b5b554f1ad090 # Parent e963d32f746e3d2a203cf45a548dbb00b8eff9c6 Added event based display changes for big font view: It is now possible to activate "Autofocus" option in custom view dialog. This enables automatic switching of the current view depending on current dive situation. Because T7 view already displays a lot of information this feature targets the T3 view. diff -r e963d32f746e -r 2a8af51ab04d Common/Inc/data_central.h --- a/Common/Inc/data_central.h Sun Dec 17 21:10:04 2023 +0100 +++ b/Common/Inc/data_central.h Sun Dec 17 21:14:17 2023 +0100 @@ -351,6 +351,8 @@ uint8_t pscr_o2_drop; uint8_t pscr_lung_ratio; + + uint32_t activeAFViews; } SDiveSettings; enum CHARGE_STATUS{ diff -r e963d32f746e -r 2a8af51ab04d Common/Inc/settings.h --- a/Common/Inc/settings.h Sun Dec 17 21:10:04 2023 +0100 +++ b/Common/Inc/settings.h Sun Dec 17 21:14:17 2023 +0100 @@ -311,6 +311,7 @@ uint16_t scrubTimerCur_Obsolete; /* have been replaced with new scrubber data format */ uint8_t scrubTimerMode; uint8_t ext_sensor_map[8]; /* redefined in 0xFFFF0027 */ + uint8_t cvAutofocus; } SSettings; typedef struct diff -r e963d32f746e -r 2a8af51ab04d Discovery/Inc/tMenuEditCustom.h --- a/Discovery/Inc/tMenuEditCustom.h Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Inc/tMenuEditCustom.h Sun Dec 17 21:14:17 2023 +0100 @@ -39,5 +39,6 @@ void openEdit_CustomviewDivemodeMenu(uint8_t line); void CustomviewDivemode_refresh(); void refresh_ViewPort(void); +uint8_t HandleAFCompass(void); #endif /* TMENU_EDIT_CUSTOM_H */ diff -r e963d32f746e -r 2a8af51ab04d Discovery/Inc/tStructure.h --- a/Discovery/Inc/tStructure.h Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Inc/tStructure.h Sun Dec 17 21:14:17 2023 +0100 @@ -358,8 +358,9 @@ #define StMCustom1_CViewTimeout _MB(2,9,1,1,0) #define StMCustom1_CViewStandard _MB(2,9,1,2,0) #define StMCustom1_CViewStandardBF _MB(2,9,1,3,0) -#define StMCustom1_CornerTimeout _MB(2,9,1,4,0) -#define StMCustom1_CornerStandard _MB(2,9,1,5,0) +#define StMCustom1_CViewAutoFocusBF _MB(2,9,1,4,0) +#define StMCustom1_CornerTimeout _MB(2,9,1,5,0) +#define StMCustom1_CornerStandard _MB(2,9,1,6,0) #define StMCustom2_BFSelection _MB(2,9,2,1,0) diff -r e963d32f746e -r 2a8af51ab04d Discovery/Inc/text_multilanguage.h --- a/Discovery/Inc/text_multilanguage.h Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Inc/text_multilanguage.h Sun Dec 17 21:14:17 2023 +0100 @@ -212,6 +212,7 @@ TXT2BYTE_CompassCalib, TXT2BYTE_CompassInertia, TXT2BYTE_CompassDeclination, + TXT2BYTE_Autofocus, TXT2BYTE_UseSensor, TXT2BYTE_AutomaticSP, /* */ diff -r e963d32f746e -r 2a8af51ab04d Discovery/Src/data_central.c --- a/Discovery/Src/data_central.c Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Src/data_central.c Sun Dec 17 21:14:17 2023 +0100 @@ -72,6 +72,8 @@ #include "tCCR.h" #include "crcmodel.h" #include "configuration.h" +#include "tHome.h" +#include "t3.h" static SDiveState stateReal = { 0 }; SDiveState stateSim = { 0 }; @@ -375,6 +377,12 @@ break; } } + /* generate Bitfield of active T3 views */ + stateReal.diveSettings.activeAFViews = 0; + if(t3_customview_disabled(CVIEW_T3_Navigation) == 0) + { + stateReal.diveSettings.activeAFViews |= (1 << CVIEW_T3_Navigation); + } } diff -r e963d32f746e -r 2a8af51ab04d Discovery/Src/settings.c --- a/Discovery/Src/settings.c Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Src/settings.c Sun Dec 17 21:14:17 2023 +0100 @@ -89,7 +89,7 @@ * There might even be entries with fixed values that have no range */ const SSettings SettingsStandard = { - .header = 0xFFFF0029, + .header = 0xFFFF002A, .warning_blink_dsec = 8 * 2, .lastDiveLogId = 0, .logFlashNextSampleStartAddress = SAMPLESTART, @@ -339,6 +339,7 @@ .compassDeclinationDeg = 0, .delaySetpointLow = false, .timerDurationS = 180, + .cvAutofocus = 0, }; /* Private function prototypes -----------------------------------------------*/ @@ -595,6 +596,9 @@ } } // no break; + case 0xFFFF0029: + Settings.cvAutofocus = 0; + // no break; default: pSettings->header = pStandard->header; break; // no break before!! @@ -1833,6 +1837,12 @@ setFirstCorrection(parameterId); } parameterId++; + if(Settings.cvAutofocus > 1) + { + corrections++; + Settings.cvAutofocus = 0; + } + parameterId++; if(corrections) { settingsWarning = 1; diff -r e963d32f746e -r 2a8af51ab04d Discovery/Src/tMenuEditCustom.c --- a/Discovery/Src/tMenuEditCustom.c Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Src/tMenuEditCustom.c Sun Dec 17 21:14:17 2023 +0100 @@ -63,6 +63,7 @@ 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_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); +uint8_t OnAction_CViewAutofocusBF(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_CViewPortCalib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); @@ -115,6 +116,16 @@ text[6] = 0; write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); + /* Bigfont autofocus selector */ + textpointer = 0; + text[textpointer++] = TXT_2BYTE; + text[textpointer++] = TXT2BYTE_ExtraDisplay; + textpointer += snprintf(&text[textpointer],20," %c%c",TXT_2BYTE, TXT2BYTE_Autofocus); + write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); + + tMenuEdit_refresh_field(StMCustom1_CViewAutoFocusBF); + + // field corner return textpointer = 0; text[textpointer++] = TXT_2BYTE; @@ -377,14 +388,14 @@ write_field_button(StMCustom1_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, ""); write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); write_field_button(StMCustom1_CViewStandardBF, 400, 700, ME_Y_LINE3, &FontT48, ""); - + write_field_on_off(StMCustom1_CViewAutoFocusBF, 650, 700, ME_Y_LINE4, &FontT48, "", settingsGetPointer()->cvAutofocus); write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE5, &FontT48, ""); write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE6, &FontT48, ""); setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout); setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard); setEvent(StMCustom1_CViewStandardBF, (uint32_t)OnAction_CViewStandardBF); - + setEvent(StMCustom1_CViewAutoFocusBF, (uint32_t)OnAction_CViewAutofocusBF); setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout); setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard); } @@ -646,6 +657,20 @@ return UPDATE_DIVESETTINGS; } +uint8_t OnAction_CViewAutofocusBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + SSettings *pSettings = settingsGetPointer(); + if(pSettings->cvAutofocus) + { + pSettings->cvAutofocus = 0; + } + else + { + pSettings->cvAutofocus = 1; + } + tMenuEdit_set_on_off(editId, pSettings->cvAutofocus); + return UPDATE_DIVESETTINGS; +} uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) { @@ -1064,3 +1089,44 @@ } write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); } + +uint8_t HandleAFCompass() +{ + static uint8_t debounce = 0; + static uint8_t lastState = 0; + uint8_t detectionState = 0; + + float pitch = stateRealGetPointer()->lifeData.compass_pitch; + float roll = stateRealGetPointer()->lifeData.compass_roll; + + if((pitch > -5.0) && (pitch < 5.0) && (roll > -5.0) && (roll < 5.0)) /* OSTC in horizontal position */ + { + if(debounce < 10) debounce++; + if(debounce == 10) + { + detectionState = 1; + // debounce = 0; + // t3_select_customview(CVIEW_T3_Navigation); + } + } + else + { + if(debounce > 0) debounce--; + if(debounce == 0) + { + detectionState = 2; + } + } + if(detectionState) /* no state change => return 0 */ + { + if((detectionState == lastState)) + { + detectionState = 0; + } + else + { + lastState = detectionState; + } + } + return detectionState; +} diff -r e963d32f746e -r 2a8af51ab04d Discovery/Src/text_multilanguage.c --- a/Discovery/Src/text_multilanguage.c Sun Dec 17 21:10:04 2023 +0100 +++ b/Discovery/Src/text_multilanguage.c Sun Dec 17 21:14:17 2023 +0100 @@ -188,6 +188,11 @@ static uint8_t text_IT_CompassDeclination[] = "Ddeclinazione"; static uint8_t text_ES_CompassDeclination[] = "Declinación"; +static uint8_t text_EN_Autofocus[] = "Autofocus"; +static uint8_t text_DE_Autofocus[] = "Automatik"; +static uint8_t text_FR_Autofocus[] = ""; +static uint8_t text_IT_Autofocus[] = ""; +static uint8_t text_ES_Autofocus[] = ""; // Menu SYS1 and Customview header static uint8_t text_EN_Compass[] = "Compass"; @@ -288,8 +293,8 @@ static uint8_t text_ES_Deco[] = "Deco"; // Menu Gas -static uint8_t text_EN_Travel[] = "Work"; -static uint8_t text_DE_Travel[] = "Arbeit"; +static uint8_t text_EN_Travel[] = "Travel"; +static uint8_t text_DE_Travel[] = "Reise"; static uint8_t text_FR_Travel[] = "Travel"; static uint8_t text_IT_Travel[] = "Viaggio"; static uint8_t text_ES_Travel[] = "Viaje"; @@ -1589,8 +1594,8 @@ static uint8_t text_IT_ShowDebug[] = "Informazioni Debug"; static uint8_t text_ES_ShowDebug[] = "Información de depuración"; -static uint8_t text_EN_SimTravelGas[] = "Work Gas"; -static uint8_t text_DE_SimTravelGas[] = "Arbeitsgas"; +static uint8_t text_EN_SimTravelGas[] = "Travel Gas"; +static uint8_t text_DE_SimTravelGas[] = "Reise Gas"; static uint8_t text_FR_SimTravelGas[] = "Gaz Travel"; static uint8_t text_IT_SimTravelGas[] = "Gas da viaggio"; static uint8_t text_ES_SimTravelGas[] = "Gas de viaje"; @@ -2043,6 +2048,7 @@ {(uint8_t)TXT2BYTE_CompassCalib, {text_EN_CompassCalib, text_DE_CompassCalib, text_FR_CompassCalib, text_IT_CompassCalib, text_ES_CompassCalib}}, {(uint8_t)TXT2BYTE_CompassInertia, {text_EN_CompassInertia, text_DE_CompassInertia, text_FR_CompassInertia, text_IT_CompassInertia, text_ES_CompassInertia}}, {(uint8_t)TXT2BYTE_CompassDeclination, {text_EN_CompassDeclination, text_DE_CompassDeclination, text_FR_CompassDeclination, text_IT_CompassDeclination, text_ES_CompassDeclination}}, + {(uint8_t)TXT2BYTE_Autofocus , {text_EN_Autofocus, text_DE_Autofocus, text_FR_Autofocus, text_IT_Autofocus, text_ES_Autofocus}}, {(uint8_t)TXT2BYTE_UseSensor, {text_EN_UseSensor, text_DE_UseSensor, text_FR_UseSensor, text_IT_UseSensor, text_ES_UseSensor}}, {(uint8_t)TXT2BYTE_AutomaticSP, {text_EN_AutomaticSP, text_DE_AutomaticSP, text_FR_AutomaticSP, text_IT_AutomaticSP, text_ES_AutomaticSP}}, {(uint8_t)TXT2BYTE_WarnDecoMissed, {text_EN_WarnDecoMissed, text_DE_WarnDecoMissed, text_FR_WarnDecoMissed, text_IT_WarnDecoMissed, text_ES_WarnDecoMissed}},