Mercurial > public > ostc4
changeset 552:531e7818b737
Added menu structure to acces viewport calibration:
A menu item in surface and dive mode has been added to calibrate the view point between diver and OSTC display. For a proper calibration the diver needs to face north (0? ) => Detailed instruction / guidance to be added.
author | Ideenmodellierer |
---|---|
date | Sun, 08 Nov 2020 18:46:46 +0100 |
parents | e3237f580ae9 |
children | 43a2dd4ba30f |
files | Discovery/Inc/tMenuEdit.h Discovery/Inc/tMenuEditCustom.h Discovery/Inc/text_multilanguage.h Discovery/Src/tMenuCustom.c Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditCustom.c Discovery/Src/tMenuEditXtra.c Discovery/Src/text_multilanguage.c |
diffstat | 8 files changed, 205 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/tMenuEdit.h Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Inc/tMenuEdit.h Sun Nov 08 18:46:46 2020 +0100 @@ -98,4 +98,5 @@ void tMenuEdit_writeSettingsToFlash(void); +GFX_DrawCfgScreen* getMenuEditScreen(void); #endif /* TMENU_EDIT_H */
--- a/Discovery/Inc/tMenuEditCustom.h Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Inc/tMenuEditCustom.h Sun Nov 08 18:46:46 2020 +0100 @@ -38,5 +38,7 @@ void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist); void openEdit_CustomviewDivemodeMenu(uint8_t line); void CustomviewDivemode_refresh(); +void refresh_ViewPort(void); +void tViewControl(uint8_t sendAction); #endif /* TMENU_EDIT_CUSTOM_H */
--- a/Discovery/Inc/text_multilanguage.h Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Inc/text_multilanguage.h Sun Nov 08 18:46:46 2020 +0100 @@ -262,6 +262,9 @@ TXT2BYTE_CViewStandard, TXT2BYTE_CornerTimeout, TXT2BYTE_CornerStandard, + TXT2BYTE_IndicateFrame, + TXT2BYTE_BoostBacklight, + TXT2BYTE_SetToMOD, /* */ TXT2BYTE_HUDbattery,
--- a/Discovery/Src/tMenuCustom.c Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Src/tMenuCustom.c Sun Nov 08 18:46:46 2020 +0100 @@ -36,6 +36,9 @@ #include "text_multilanguage.h" #include "data_central.h" #include "motion.h" +#include "gfx_fonts.h" +#include "tInfo.h" +#include "motion.h" /* Exported functions --------------------------------------------------------*/ @@ -132,6 +135,15 @@ textPointer++; break; } + } + + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + + if((line == 0) || (line == 6)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_CalibView; strcpy(&text[textPointer],"\n\r"); textPointer += 2; }
--- a/Discovery/Src/tMenuEdit.c Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Src/tMenuEdit.c Sun Nov 08 18:46:46 2020 +0100 @@ -230,6 +230,10 @@ case StMCustom3_CViewSelection5: case StMCustom3_CViewSelection6: refreshFct = CustomviewDivemode_refresh; break; + case (StMCustom6_CViewPortCalib& MaskFieldDigit): + case StMCustom6_CViewPortLayout: + case StMCustom6_CViewPortAmbient: refreshFct = refresh_ViewPort; + break; default: /* no menu has been updated */ break; } @@ -1928,3 +1932,10 @@ draw_tMEdesignSubSelected(&pDestination); } } + +GFX_DrawCfgScreen* getMenuEditScreen() +{ + return &tMEscreen; +} + +
--- a/Discovery/Src/tMenuEditCustom.c Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Src/tMenuEditCustom.c Sun Nov 08 18:46:46 2020 +0100 @@ -40,6 +40,7 @@ #include "motion.h" #include "tMenu.h" #include "tMenuSystem.h" +#include <math.h> #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ @@ -52,6 +53,7 @@ void openEdit_Customview(void); void openEdit_BigScreen(void); void openEdit_MotionCtrl(void); +void openEdit_ViewPort(void); void refresh_Customviews(void); char customview_TXT2BYTE_helper(uint8_t customViewId); /* Announced function prototypes -----------------------------------------------*/ @@ -60,6 +62,9 @@ uint8_t OnAction_CViewStandardBF(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); +uint8_t OnAction_CViewPortLayout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); +uint8_t OnAction_CViewPortAmbient(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); /* Exported functions --------------------------------------------------------*/ @@ -90,54 +95,6 @@ text[2] = ' '; text[3] = ' '; -#if 0 - switch(settingsGetPointer()->tX_customViewPrimary) - { - case CVIEW_sensors: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_O2monitor; - break; - case CVIEW_sensors_mV: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_O2voltage; - break; - case CVIEW_Compass: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Compass; - break; - case CVIEW_Decolist: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Decolist; - break; - case CVIEW_Tissues: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Tissues; - break; - case CVIEW_Profile: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Profile; - break; - case CVIEW_Gaslist: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Gaslist; - break; - case CVIEW_EADTime: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Info; - break; - case CVIEW_SummaryOfLeftCorner: - text[4] = TXT_2BYTE; - text[5] = TXT2BYTE_Summary; - break; - case CVIEW_noneOrDebug: - text[4] = ' '; - text[5] = '-'; - break; - default: - snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary); - break; - } -#endif text[4] = TXT_2BYTE; text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimary); text[6] = 0; @@ -217,6 +174,83 @@ write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); } +void refresh_ViewPort(void) +{ + uint16_t heading; + char text[32]; + uint8_t textIndex = 0; + float distance = 0.0; + SSettings* pSettings = settingsGetPointer(); + GFX_DrawCfgScreen* pdrawScreen; + point_t lowerleft = {0,0}; + point_t upperright = {799,479}; + + text[0] = '\001'; + text[1] = TXT_2BYTE; + text[2] = TXT2BYTE_CalibView; + text[3] = 0; + write_topline(text); + + text[0] = TXT_2BYTE; + text[1] = TXT2BYTE_CalibView; + text[2] = 0; + write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); + + if(pSettings->compassInertia) + { + heading = (uint16_t)compass_getCompensated(); + } + else + { + heading = (uint16_t)stateUsed->lifeData.compass_heading; + } + snprintf(text,32,"\001%03i`",heading); + write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text); + + textIndex = 0; + text[textIndex++] = TXT_2BYTE; + text[textIndex++] = TXT2BYTE_IndicateFrame; + text[textIndex++] = ' '; + text[textIndex++] = '\006' - (settingsGetPointer()->viewPortMode >> 4); + text[textIndex++] = 0; + write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); + textIndex = 0; + text[textIndex++] = TXT_2BYTE; + text[textIndex++] = TXT2BYTE_BoostBacklight; + text[textIndex++] = ' '; + snprintf(&text[textIndex],32," %d",(settingsGetPointer()->viewPortMode & 0x3)); + write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text); + + write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); + + /* test if we are in focus */ + if((pSettings->viewPitch != 0.0) || (pSettings->viewRoll != 0.0) || (pSettings->viewYaw != 0.0)) + { + distance = checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); + + if(distance < 0.5) + { + set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03); + if(pSettings->viewPortMode >> 4) + { + pdrawScreen = getMenuEditScreen(); + GFX_draw_box(pdrawScreen,lowerleft,upperright,0,CLUT_NiceGreen); + } + } + else + { + set_Backlight_Boost(0); + if(pSettings->viewPortMode >> 4) + { + pdrawScreen = getMenuEditScreen(); + GFX_draw_box(pdrawScreen,lowerleft,upperright,0,CLUT_MenuTopBackground); + } + } + resetFocusState(); /* no other instance shall be impacted by the local detection */ + } + +} + void openEdit_Custom(uint8_t line) { set_globalState_Menu_Line(line); @@ -235,6 +269,8 @@ break; case 5: openEdit_MotionCtrl(); break; + case 6: openEdit_ViewPort(); + break; } } @@ -306,6 +342,22 @@ exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); } + + +void openEdit_ViewPort(void) +{ + refresh_ViewPort(); + + write_field_button(StMCustom6_CViewPortCalib, 400, 700, ME_Y_LINE3, &FontT48, ""); + write_field_button(StMCustom6_CViewPortLayout, 400, 700, ME_Y_LINE5, &FontT48, ""); + write_field_button(StMCustom6_CViewPortAmbient, 400, 700, ME_Y_LINE6, &FontT48, ""); + + setEvent(StMCustom6_CViewPortCalib, (uint32_t)OnAction_CViewPortCalib); + setEvent(StMCustom6_CViewPortLayout, (uint32_t)OnAction_CViewPortLayout); + setEvent(StMCustom6_CViewPortAmbient, (uint32_t)OnAction_CViewPortAmbient); +} + + char customview_TXT2BYTE_helper(uint8_t customViewId) { char text = 0; @@ -562,6 +614,45 @@ return UPDATE_DIVESETTINGS; } +uint8_t OnAction_CViewPortCalib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + float heading; + if(settingsGetPointer()->compassInertia) + { + heading = (uint16_t)compass_getCompensated(); + } + else + { + heading = (uint16_t)stateUsed->lifeData.compass_heading; + } + calibrateViewport(stateUsed->lifeData.compass_roll,stateUsed->lifeData.compass_pitch,heading); + + return UPDATE_DIVESETTINGS; +} +uint8_t OnAction_CViewPortLayout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + SSettings* pSettings = settingsGetPointer(); + if(pSettings->viewPortMode >> 4 != 0) + { + pSettings->viewPortMode &= 0x0F; + } + else + { + pSettings->viewPortMode |= 0x10; + } + + return UPDATE_DIVESETTINGS; +} +uint8_t OnAction_CViewPortAmbient(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + SSettings* pSettings = settingsGetPointer(); + pSettings->viewPortMode = (pSettings->viewPortMode + 1) & 0xF3; + + return UPDATE_DIVESETTINGS; +} + + + void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist) { @@ -801,3 +892,24 @@ } write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); } + +void tViewControl(uint8_t sendAction) +{ + switch(sendAction) + { + case ACTION_BUTTON_ENTER: + break; + case ACTION_BUTTON_NEXT: + break; + case ACTION_TIMEOUT: + case ACTION_MODE_CHANGE: + case ACTION_BUTTON_BACK: + exitInfo(); + break; + default: + break; + case ACTION_IDLE_TICK: + case ACTION_IDLE_SECOND: + break; + } +}
--- a/Discovery/Src/tMenuEditXtra.c Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Src/tMenuEditXtra.c Sun Nov 08 18:46:46 2020 +0100 @@ -43,6 +43,7 @@ void openEdit_SimFollowDecostops(void); void openEdit_SetManualMarker(void); void openEdit_SetEndDive(void); +void openEdit_CalibViewport(void); /* Announced function prototypes -----------------------------------------------*/ uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
--- a/Discovery/Src/text_multilanguage.c Sun Nov 08 18:43:19 2020 +0100 +++ b/Discovery/Src/text_multilanguage.c Sun Nov 08 18:46:46 2020 +0100 @@ -1,5 +1,4 @@ -///////////////////////////////////////////////////////////////////////////// -/// -*- coding: UTF-8 -*- +/// -*- coding: UTF-8 -*- /// /// \file Discovery/Src/text_multilanguage.c /// \brief Date file of TXT Multilanguage Support @@ -1407,6 +1406,18 @@ static uint8_t text_IT_ApneaSurface[] = "Tempo di superficie"; static uint8_t text_ES_ApneaSurface[] = "Tiempo de superficie"; +static uint8_t text_EN_IndicateFrame[] = "Change frame color"; +static uint8_t text_DE_IndicateFrame[] = "Farbwechsel Rahmen"; +static uint8_t text_FR_IndicateFrame[] = ""; +static uint8_t text_IT_IndicateFrame[] = ""; +static uint8_t text_ES_IndicateFrame[] = ""; + +static uint8_t text_EN_BoostBacklight[] = "Boost Backlight:"; +static uint8_t text_DE_BoostBacklight[] = "Helligkeit+:"; +static uint8_t text_FR_BoostBacklight[] = ""; +static uint8_t text_IT_BoostBacklight[] = ""; +static uint8_t text_ES_BoostBacklight[] = ""; + /* static uint8_t text_EN_ApneaCount[] = ""; static uint8_t text_DE_ApneaCount[] = ""; @@ -1722,6 +1733,8 @@ {(uint8_t)TXT2BYTE_SetMarker, {text_EN_SetMarker, text_DE_SetMarker, text_FR_SetMarker, text_IT_SetMarker, text_ES_SetMarker}}, {(uint8_t)TXT2BYTE_CompassHeading, {text_EN_CompassHeading, text_DE_CompassHeading, text_FR_CompassHeading, text_IT_CompassHeading, text_ES_CompassHeading}}, {(uint8_t)TXT2BYTE_CalibView, {text_EN_CalibView, text_DE_CalibView, text_FR_CalibView, text_IT_CalibView, text_ES_CalibView}}, + {(uint8_t)TXT2BYTE_IndicateFrame, {text_EN_IndicateFrame, text_DE_IndicateFrame, text_FR_IndicateFrame, text_IT_IndicateFrame, text_ES_IndicateFrame}}, + {(uint8_t)TXT2BYTE_BoostBacklight, {text_EN_BoostBacklight, text_DE_BoostBacklight, text_FR_BoostBacklight, text_IT_BoostBacklight, text_ES_BoostBacklight}}, {(uint8_t)TXT2BYTE_EndDiveMode, {text_EN_EndDiveMode, text_DE_EndDiveMode, text_FR_EndDiveMode, text_IT_EndDiveMode, text_ES_EndDiveMode}}, {(uint8_t)TXT2BYTE_Simulator, {text_EN_Simulator, text_DE_Simulator, text_FR_Simulator, text_IT_Simulator, text_ES_Simulator}}, {(uint8_t)TXT2BYTE_StartSimulator, {text_EN_StartSimulator, text_DE_StartSimulator, text_FR_StartSimulator, text_IT_StartSimulator, text_ES_StartSimulator}},