Mercurial > public > ostc4
changeset 513:0680975c39b8
Merge
author | heinrichsweikamp |
---|---|
date | Mon, 31 Aug 2020 20:06:59 +0200 |
parents | 3485360c5db0 (diff) 5757edda56b7 (current diff) |
children | d9dbfa496f7e |
files | |
diffstat | 22 files changed, 1180 insertions(+), 260 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/settings.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Common/Inc/settings.h Mon Aug 31 20:06:59 2020 +0200 @@ -220,7 +220,8 @@ uint32_t cv_configuration; /* new in 0xFFFF001A */ uint8_t MotionDetection; - + /* new in 0xFFFF001B */ + uint32_t cv_config_BigScreen; } SSettings; typedef struct
--- a/Discovery/Inc/gfx_colors.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Inc/gfx_colors.h Mon Aug 31 20:06:59 2020 +0200 @@ -86,8 +86,8 @@ CLUT_MenuPageDecoParameter, CLUT_MenuPageHardware, CLUT_MenuPageSystem, + CLUT_MenuPageCustomView, CLUT_MenuPageDivePlanner, - CLUT_MenuPage9, CLUT_MenuPage10, CLUT_ButtonSymbols, CLUT_InfoSurface,
--- a/Discovery/Inc/tHome.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Inc/tHome.h Mon Aug 31 20:06:59 2020 +0200 @@ -54,9 +54,6 @@ EXTRADISPLAY_none = 0, EXTRADISPLAY_BIGFONT, EXTRADISPLAY_DECOGAME, -#ifdef ENABLE_BIGFONT_VX - EXTRADISPLAY_BIGFONT2, -#endif EXTRADISPLAY_END }; @@ -83,19 +80,14 @@ CVIEW_T3_GasList, CVIEW_T3_Temperature, CVIEW_T3_ApnoeSurfaceInfo, -#ifdef ENABLE_BIGFONT_VX CVIEW_T3_Navigation, CVIEW_T3_DepthData, -#endif CVIEW_T3_END }; // for custom view switch on/off 161122 hw extern const uint8_t cv_changelist[]; extern const uint8_t cv_changelist_BS[]; -#ifdef ENABLE_BIGFONT_VX -extern const uint8_t cv_changelist_BSV2[]; -#endif #define CHECK_BIT_THOME(var,pos) (((var)>>(pos)) & 1) @@ -139,6 +131,7 @@ uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput); void tHome_init_compass(void); +uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list); float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode); void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1); @@ -147,7 +140,7 @@ void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode); //void _findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut); void t3_basics_colorscheme_mod(char *text); -void t3_basics_change_customview(uint8_t *tX_selection_customview, uint8_t *tX_customviews, uint8_t action); +void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action); uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Inc/tMenuCustom.h Mon Aug 31 20:06:59 2020 +0200 @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +/// -*- coding: UTF-8 -*- +/// +/// \file Discovery/Inc/tMenuCustom.h +/// \brief Menu Custom View - Provide access to custom view options +/// \author heinrichs weikamp gmbh +/// \date 25-Aug-2020 +/// +/// $Id$ +/////////////////////////////////////////////////////////////////////////////// +/// \par Copyright (c) 2014-2020 Heinrichs Weikamp gmbh +/// +/// This program is free software: you can redistribute it and/or modify +/// it under the terms of the GNU General Public License as published by +/// the Free Software Foundation, either version 3 of the License, or +/// (at your option) any later version. +/// +/// This program is distributed in the hope that it will be useful, +/// but WITHOUT ANY WARRANTY; without even the implied warranty of +/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/// GNU General Public License for more details. +/// +/// You should have received a copy of the GNU General Public License +/// along with this program. If not, see <http://www.gnu.org/licenses/>. +////////////////////////////////////////////////////////////////////////////// + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef TMENU_CUSTOM_H +#define TMENU_CUSTOM_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include <stdint.h> + +/** @addtogroup Template + * @{ + */ + +/* Exported variables --------------------------------------------------------*/ + + +/* Exported functions --------------------------------------------------------*/ + +uint32_t tMCustom_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext); + + #ifdef __cplusplus +} +#endif + +#endif /* TMENU_CUSTOM_H */ + +/************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/
--- a/Discovery/Inc/tMenuEdit.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Inc/tMenuEdit.h Mon Aug 31 20:06:59 2020 +0200 @@ -55,6 +55,7 @@ void resetMenuEdit(uint8_t color); void tMenuEdit_refresh_live_content(void); void tMenuEdit_refresh_field(uint32_t editID); +void tMenuEdit_select(uint32_t editID); void evaluateNewString (uint32_t editID, uint32_t *pNewValue1, uint32_t *pNewValue2, uint32_t *pNewValue3, uint32_t *pNewValue4); void tMenuEdit_newInput (uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Inc/tMenuEditCustom.h Mon Aug 31 20:06:59 2020 +0200 @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +/// -*- coding: UTF-8 -*- +/// +/// \file Discovery/Inc/tMenuEditCustom.h +/// \brief Header file for editing custom view Settings +/// \author heinrichs weikamp gmbh +/// \date 05-Aug-2014 +/// +/// $Id$ +/////////////////////////////////////////////////////////////////////////////// +/// \par Copyright (c) 2014-2020 Heinrichs Weikamp gmbh +/// +/// This program is free software: you can redistribute it and/or modify +/// it under the terms of the GNU General Public License as published by +/// the Free Software Foundation, either version 3 of the License, or +/// (at your option) any later version. +/// +/// This program is distributed in the hope that it will be useful, +/// but WITHOUT ANY WARRANTY; without even the implied warranty of +/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/// GNU General Public License for more details. +/// +/// You should have received a copy of the GNU General Public License +/// along with this program. If not, see <http://www.gnu.org/licenses/>. +////////////////////////////////////////////////////////////////////////////// + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef TMENU_EDIT_CUSTOM_H +#define TMENU_EDIT_CUSTOM_H + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" +#include "gfx_engine.h" +#include "settings.h" +#include "data_central.h" + +void openEdit_Custom(uint8_t line); +void openEdit_CustomviewDivemode2(const uint8_t* pcv_changelist); +void CustomviewDivemode2_refresh(); + +#endif /* TMENU_EDIT_CUSTOM_H */
--- a/Discovery/Inc/tStructure.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Inc/tStructure.h Mon Aug 31 20:06:59 2020 +0200 @@ -304,15 +304,41 @@ #define StMSYS6_SetFactoryBC _MB(2,8,6,11,0) #define StMSYS6_SetSampleIndx _MB(2,8,6,12,0) -/* PAGE 9 */ -#define StMPLAN _MB(2,9,0,0,0) + /* PAGE 9 */ + + # define StMCustom _MB(2,9,0,0,0) + + /* PAGE 9 EDIT FIELD CONTENT */ +// + +#define StMCustom1_CViewTimeout _MB(2,9,1,1,0) +#define StMCustom1_CViewStandard _MB(2,9,1,2,0) +#define StMCustom1_CornerTimeout _MB(2,9,1,3,0) +#define StMCustom1_CornerStandard _MB(2,9,1,4,0) + -/* PAGE 9 EDIT FIELD CONTENT */ -#define StMPLAN2_Interval _MB(2,9,2,1,0) -#define StMPLAN3_DiveTime _MB(2,9,3,1,0) -#define StMPLAN4_MaxDepth _MB(2,9,4,1,0) -#define StMPLAN5_ExitResult _MB(2,9,5,1,0) -#define StMPLAN4_Settings _MB(2,9,6,1,0) +#define StMCustom2_CViewSelection1 _MB(2,9,2,1,0) +#define StMCustom2_CViewSelection2 _MB(2,9,2,2,0) +#define StMCustom2_CViewSelection3 _MB(2,9,2,3,0) +#define StMCustom2_CViewSelection4 _MB(2,9,2,4,0) +#define StMCustom2_CViewSelection5 _MB(2,9,2,5,0) +#define StMCustom2_CViewSelection6 _MB(2,9,2,6,0) + + +#define StMCustom2_BFSelection _MB(2,9,3,1,0) + +/* PAGE 10 */ +#define StMPLAN _MB(2,10,0,0,0) + +/* PAGE 10 EDIT FIELD CONTENT */ +#define StMPLAN2_Interval _MB(2,10,2,1,0) +#define StMPLAN3_DiveTime _MB(2,10,3,1,0) +#define StMPLAN4_MaxDepth _MB(2,10,4,1,0) +#define StMPLAN5_ExitResult _MB(2,10,5,1,0) +#define StMPLAN4_Settings _MB(2,10,6,1,0) + + + //#define StMDECO6_SALINITY _MB(2,5,6,1,0) @@ -321,7 +347,7 @@ -//#define StMDECO7_AMV _MB(2,5,7,1,0) +//#define StMDECO7_AMV _MB(2,5,7,1,0) //#define StMDECO7_DefaultAMV _MB(2,5,7,2,0) //#define StMDECO7_RESERVE _MB(2,5,7,3,0)
--- a/Discovery/Inc/text_multilanguage.h Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Inc/text_multilanguage.h Mon Aug 31 20:06:59 2020 +0200 @@ -302,6 +302,14 @@ TXT2BYTE_ApneaSurface, /* */ TXT2BYTE_FLIPDISPLAY, + TXT2BYTE_SelectCustomviews, + TXT2BYTE_SelectBigFont, + TXT2BYTE_MaxDepth, + TXT2BYTE_Stopwatch, + TXT2BYTE_TTS, + TXT2BYTE_ppoNair, + TXT2BYTE_Navigation, + TXT2BYTE_DepthData, TXT2BYTE_END };
--- a/Discovery/Src/base.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/base.c Mon Aug 31 20:06:59 2020 +0200 @@ -747,11 +747,7 @@ && (settingsGetPointer()->design < 7)) { settingsGetPointer()->design = 7; // auto switch to 9 if necessary } else if ((status.page == PageDive) && (status.line != 0)) { - if ((settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT) -#ifdef ENABLE_BIGFONT_VX - || (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2) -#endif - ) + if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT) { settingsGetPointer()->design = 3; if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR)
--- a/Discovery/Src/gfx_colors.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/gfx_colors.c Mon Aug 31 20:06:59 2020 +0200 @@ -88,8 +88,8 @@ 0x00FFC000,//0x00C4EACC, // CLUT_MenuPageDecoParameter 0x00AC00ff,//0x00E5AE18, // CLUT_MenuPageHardware 0x00ff00ff,//0x00E5AEFF, // CLUT_MenuPageSystem - 0x00C4EACC,//0x00FFFF00, // CLUT_MenuPageDivePlanner - 0x00000000, // CLUT_MenuPage9 - UNUSED + 0x00FF55FF,//0x00FFFF00, // CLUT_MenuPageCustomView + 0x00C4EACC, // CLUT_MenuPageDivePlanner 0x00000000, // CLUT_MenuPage10 - UNUSED 0x00FFFFFF, // CLUT_ButtonSymbols 0x000092D0, // CLUT_InfoSurface
--- a/Discovery/Src/gfx_engine.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/gfx_engine.c Mon Aug 31 20:06:59 2020 +0200 @@ -3624,6 +3624,11 @@ SSettings* pSettings; pSettings = settingsGetPointer(); + if(total > 8) + { + Font = &FontT24; + } + hgfx.Image = tMscreen; hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; @@ -3632,7 +3637,14 @@ if(!pSettings->FlipDisplay) { hgfx.WindowX1 = 779; - hgfx.WindowX0 = hgfx.WindowX1 - (25*5); + if(Font == &FontT24) + { + hgfx.WindowX0 = hgfx.WindowX1 - (Font->spacesize*3); + } + else + { + hgfx.WindowX0 = hgfx.WindowX1 - (Font->spacesize2Monospaced*3); + } hgfx.WindowY1 = 479; hgfx.WindowY0 = hgfx.WindowY1 - Font->height; }
--- a/Discovery/Src/settings.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/settings.c Mon Aug 31 20:06:59 2020 +0200 @@ -84,7 +84,7 @@ * There might even be entries with fixed values that have no range */ const SSettings SettingsStandard = { - .header = 0xFFFF001A, + .header = 0xFFFF001B, .warning_blink_dsec = 8 * 2, .lastDiveLogId = 0, .logFlashNextSampleStartAddress = 0, @@ -310,6 +310,7 @@ .FlipDisplay = 0, .cv_configuration = 0xFFFFFFFF, .MotionDetection = MOTION_DETECT_OFF, + .cv_config_BigScreen = 0xFFFFFFFF, }; /* Private function prototypes -----------------------------------------------*/ @@ -457,6 +458,12 @@ case 0xFFFF0019: pSettings->MotionDetection = MOTION_DETECT_OFF; // no break + case 0xFFFF001A: + /* deactivate new views => to be activated by customer */ + pSettings->cv_config_BigScreen = 0xFFFFFFFF; + pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_Navigation; + pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData; + // no break default: pSettings->header = pStandard->header; break; // no break before!!
--- a/Discovery/Src/t3.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/t3.c Mon Aug 31 20:06:59 2020 +0200 @@ -69,22 +69,11 @@ CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_ppO2andGas, + CVIEW_T3_Navigation, + CVIEW_T3_DepthData, CVIEW_T3_END }; -#ifdef ENABLE_BIGFONT_VX -const uint8_t t3_customviewsV2[] = -{ - CVIEW_T3_Decostop, - CVIEW_sensors, - CVIEW_T3_Navigation, - CVIEW_T3_DepthData, - CVIEW_T3_TTS, - CVIEW_T3_ppO2andGas, - CVIEW_T3_END -}; -#endif - /* Private function prototypes -----------------------------------------------*/ void t3_refresh_divemode(void); @@ -146,23 +135,23 @@ t3c1.Image = &t3screen; t3c1.WindowNumberOfTextLines = 2; - t3c1.WindowLineSpacing = t3l1.WindowLineSpacing; + t3c1.WindowLineSpacing = 100; t3c1.WindowX0 = 0; t3c1.WindowX1 = 799; if(!pSettings->FlipDisplay) { - t3c1.WindowY0 = 0; + t3c1.WindowY0 = 5; t3c1.WindowY1 = BigFontSeperationTopBottom - 5; } else { t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; - t3c1.WindowY1 = 479; + t3c1.WindowY1 = 479 - 5; } t3c2.Image = &t3screen; t3c2.WindowNumberOfTextLines = 3; - t3c2.WindowLineSpacing = 58; + t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ; t3c2.WindowX0 = 370; t3c2.WindowX1 = 799; t3c2.WindowY0 = t3c1.WindowY0; @@ -1017,7 +1006,6 @@ GFX_write_string(&FontT48,tXc1,text,0); break; -#ifdef ENABLE_BIGFONT_VX case CVIEW_T3_Navigation: Stopwatch.Total = timer_Stopwatch_GetTime(); Stopwatch.Minutes = Stopwatch.Total / 60; @@ -1035,9 +1023,9 @@ } snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); - GFX_write_string(&FontT42,tXc2,text,0); + GFX_write_string(&FontT42,tXc1,text,0); snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth)); - GFX_write_string(&FontT105,tXc2,text,0); + GFX_write_string(&FontT105,tXc1,text,0); if(!pSettings->FlipDisplay) { tXc2->WindowY0 = 100; @@ -1048,7 +1036,7 @@ } snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); - GFX_write_string(&FontT105,tXc2,text,0); + GFX_write_string(&FontT105,tXc1,text,1); center.x = 400; @@ -1099,12 +1087,11 @@ } fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); - GFX_write_string(&FontT42,tXc2,text,0); + GFX_write_string(&FontT42,tXc1,text,0); snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute)); - GFX_write_string(&FontT105,tXc2,text,0); + GFX_write_string(&FontT105,tXc1,text,0); break; -#endif } @@ -1150,8 +1137,8 @@ more = 0; textpointerMain = 0; - textMain[textpointerMain++] = '\025'; - textMain[textpointerMain++] = '\003'; + textMain[textpointerMain++] = '\025'; /* red */ + textMain[textpointerMain++] = '\003'; /* doublesize */ textpointer = 0; @@ -1290,10 +1277,10 @@ text[textpointer] = 0; } */ - GFX_write_string(&FontT48,&t3c1,textMain,1); + GFX_write_string(&FontT48,&t3c1,textMain,0); if(more) { - GFX_write_string(&FontT48,&t3c2,text,1); + GFX_write_string(&FontT48,&t3c2,text,0); } } @@ -1304,16 +1291,7 @@ const uint8_t *pcv_changelist; uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; -#ifdef ENABLE_BIGFONT_VX - if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2) - { - pcv_changelist = cv_changelist_BSV2; - } - else -#endif - { - pcv_changelist = cv_changelist_BS; - } + pcv_changelist = cv_changelist_BS; while(pcv_changelist[i] != CVIEW_T3_END) { @@ -1336,22 +1314,12 @@ void t3_change_customview(uint8_t action) { -#ifdef ENABLE_BIGFONT_VX - if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2) - { - t3_basics_change_customview(&t3_selection_customview, t3_customviewsV2, action); - } - else - { - t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); - } -#else + t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); -#endif } -void t3_basics_change_customview(uint8_t *tX_selection_customview, uint8_t *tX_customviews, uint8_t action) +void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) { const SDecoinfo * pDecoinfo; if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) @@ -1359,33 +1327,27 @@ else pDecoinfo = &stateUsed->decolistVPM; - uint8_t curView; - uint8_t *pViews; - pViews = tX_customviews; - - uint8_t *pStartView,*pCurView, *pLastView; + uint8_t curViewIdx = 0xff; + uint8_t index = 0; + uint8_t lastViewIdx = 0; uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ - pStartView = pViews; - curView = CVIEW_T3_END; /* set pointer to currently selected view and count number of entries */ - while((*pViews != CVIEW_T3_END)) + while((tX_customviews[index] != CVIEW_T3_END)) { - if (*pViews == *tX_selection_customview) + if (tX_customviews[index] == *tX_selection_customview) { - pCurView = pViews; - curView = *pViews; + curViewIdx = index; } - pViews++; + index++; } - if(curView == CVIEW_T3_END) /* called with unknown view */ + if(curViewIdx == 0xff) /* called with unknown view */ { - *tX_selection_customview = CVIEW_T3_Decostop; - pCurView = pStartView; + curViewIdx = 0; + *tX_selection_customview = tX_customviews[index]; } - pLastView = pViews; - pViews = pCurView; - + lastViewIdx = index; + index = curViewIdx; do { iterate = 0; @@ -1394,33 +1356,34 @@ case ACTION_BUTTON_ENTER: case ACTION_PITCH_POS: - if(*pViews != CVIEW_T3_END) - pViews++; - - if(*pViews == CVIEW_T3_END) + if(tX_customviews[index] != CVIEW_T3_END) { - pViews = pStartView; + index++; + } + if(tX_customviews[index] == CVIEW_T3_END) + { + index = 0; } break; case ACTION_PITCH_NEG: - if(pViews == pStartView) + if(index == 0) { - pViews = pLastView - 1; + index = lastViewIdx - 1; } else { - pViews--; + index--; } break; default: break; } - if(t3_customview_disabled(*pViews)) + if(t3_customview_disabled(tX_customviews[index])) { iterate = 1; } - if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) + if((tX_customviews[index] == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) { iterate = 1; } @@ -1430,7 +1393,7 @@ } }while (iterate == 1); - *tX_selection_customview = *pViews; + *tX_selection_customview = tX_customviews[index]; } @@ -1576,16 +1539,7 @@ uint8_t increment = 1; uint8_t enabledViewCnt = 0; -#ifdef ENABLE_BIGFONT_VX - if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2) - { - pViews = (uint8_t*)t3_customviewsV2; - } - else - { - pViews = (uint8_t*)t3_customviewsStandard; - } - + pViews = (uint8_t*)t3_customviewsStandard; while((*pViews != CVIEW_T3_END)) { increment = 1; @@ -1597,32 +1551,6 @@ pViews++; enabledViewCnt += increment; } -#else - - uint8_t i=0; - uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; - pcv_changelist = cv_changelist_BS; - do - { - if(pcv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */ - { - if(!CHECK_BIT_THOME(cv_config, pcv_changelist[i])) - { - enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ - } - else - { - enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */ - } - break; - } - i++; - } while(pcv_changelist[i] != CVIEW_T3_END); - if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)) - { - enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ - } -#endif return enabledViewCnt; }
--- a/Discovery/Src/t7.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/t7.c Mon Aug 31 20:06:59 2020 +0200 @@ -1410,7 +1410,7 @@ textpointer = 0; lineFree = 5; - + text[textpointer++] = '\001'; if(lineFree && stateUsed->warnings.decoMissed) { text[textpointer++] = TXT_2BYTE; @@ -1589,9 +1589,9 @@ { case ACTION_BUTTON_ENTER: case ACTION_PITCH_POS: - if(*pViews != CVIEW_T3_END) + if(*pViews != CVIEW_END) pViews++; - if(*pViews == CVIEW_T3_END) + if(*pViews == CVIEW_END) { pViews = pStartView; }
--- a/Discovery/Src/tHome.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/tHome.c Mon Aug 31 20:06:59 2020 +0200 @@ -58,11 +58,7 @@ static uint16_t tHome_tick_count_field; const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist,CVIEW_sensors,CVIEW_sensors_mV, CVIEW_END}; -const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_END}; - -#ifdef ENABLE_BIGFONT_VX -const uint8_t cv_changelist_BSV2[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_TTS, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_END}; -#endif +const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_END}; /* Private function prototypes -----------------------------------------------*/ @@ -363,6 +359,21 @@ t6_change_customview(action); } +uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) +{ + uint8_t cnt = 0; + + while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) + { + cnt++; + if (cnt > 100) /* just in case an invalid list has been provided... */ + { + break; + } + } + cnt--; /* do not count end token */ + return cnt; +} void tHome_tick(void) {
--- a/Discovery/Src/tMenu.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/tMenu.c Mon Aug 31 20:06:59 2020 +0200 @@ -41,12 +41,14 @@ #include "tMenuEditSetpoint.h" #include "tMenuEditSystem.h" #include "tMenuEditXtra.h" +#include "tMenuEditCustom.h" #include "tMenuGas.h" #include "tMenuHardware.h" #include "tMenuPlanner.h" #include "tMenuSetpoint.h" #include "tMenuSystem.h" #include "tMenuXtra.h" +#include "tMenuCustom.h" /* Private types -------------------------------------------------------------*/ #define MAXPAGES 10 @@ -492,6 +494,7 @@ { tM_add(StMDECO); tM_add(StMHARD); + tM_add(StMCustom); // tM_add(StMSYS); now in both modes } else @@ -542,6 +545,9 @@ id = tMSystem_refresh(0, text, &tabPosition, subtext); tM_build_page(id, text, tabPosition, subtext); + + id = tMCustom_refresh(0, text, &tabPosition, subtext); + tM_build_page(id, text, tabPosition, subtext); } @@ -698,6 +704,11 @@ update_content_actual_page(text, tabPosition, subtext); } break; + case StMCustom: + tMCustom_refresh(line, text, &tabPosition, subtext); + clean_line_actual_page(); + update_content_actual_page(text, tabPosition, subtext); + break; default: break; } @@ -936,6 +947,9 @@ case StMSYS: openEdit_System(line); break; + case StMCustom: + openEdit_Custom(line); + break; default: break; } @@ -1139,8 +1153,8 @@ "", "SYS", "", - "SIM", - "" + "", + "SIM" }; const _Bool spacing[MAXPAGES+1] = @@ -1152,7 +1166,8 @@ 0, // behind DECO1 1, // behind DECO2 0, // behind SYS1 - 1, // behind SYS2 + 0, // behind SYS2 + 1, // behind SYS3 1, // behind SIM 0 };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Src/tMenuCustom.c Mon Aug 31 20:06:59 2020 +0200 @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +/// -*- coding: UTF-8 -*- +/// +/// \file Discovery/Src/tMenuCustom.c +/// \brief Menu Custom - Provide access to custom view options +/// \author heinrichs weikamp gmbh +/// \date 25-Aug-2020 +/// +/// \details +/// +/// $Id$ +/////////////////////////////////////////////////////////////////////////////// +/// \par Copyright (c) 2014-2020 Heinrichs Weikamp gmbh +/// +/// This program is free software: you can redistribute it and/or modify +/// it under the terms of the GNU General Public License as published by +/// the Free Software Foundation, either version 3 of the License, or +/// (at your option) any later version. +/// +/// This program is distributed in the hope that it will be useful, +/// but WITHOUT ANY WARRANTY; without even the implied warranty of +/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/// GNU General Public License for more details. +/// +/// You should have received a copy of the GNU General Public License +/// along with this program. If not, see <http://www.gnu.org/licenses/>. +////////////////////////////////////////////////////////////////////////////// + +/* Includes ------------------------------------------------------------------*/ +#include <stdio.h> +#include <string.h> +#include "tMenu.h" +#include "tStructure.h" +#include "tMenuCustom.h" +#include "text_multilanguage.h" +#include "data_central.h" + + +/* Exported functions --------------------------------------------------------*/ + +uint32_t tMCustom_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) +{ + uint8_t textPointer; + + textPointer = 0; + *tab = 550; + *subtext = 0; + + if((line == 0) || (line == 1)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_Customviews; + } + text[textPointer++] = '\n'; + text[textPointer++] = '\r'; + text[textPointer] = 0; + + if((line == 0) || (line == 2)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_SelectCustomviews; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + + if((line == 0) || (line == 3)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_SelectBigFont; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + + return StMCustom; +} +
--- a/Discovery/Src/tMenuEdit.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/tMenuEdit.c Mon Aug 31 20:06:59 2020 +0200 @@ -37,6 +37,7 @@ #include "tMenuEditPlanner.h" #include "tMenuEditSystem.h" #include "tMenuEditXtra.h" +#include "tMenuEditCustom.h" /* Private types -------------------------------------------------------------*/ #define TEXTSIZE 16 @@ -87,27 +88,27 @@ GFX_DrawCfgScreen tMEcursor; GFX_DrawCfgScreen tMEcursorNew; -uint32_t menuID; -uint8_t menuColor; +static uint32_t menuID; +static uint8_t menuColor; -int8_t id = 0; -int8_t idLast = -1; -SEditIdent ident[10]; -int8_t tME_stop = 0; +static int8_t id = 0; +static int8_t idLast = -1; +static SEditIdent ident[10]; +static int8_t tME_stop = 0; -int8_t evid = 0; -int8_t evidLast = -1; -SEventHandler event[10]; +static int8_t evid = 0; +static int8_t evidLast = -1; +static SEventHandler event[10]; -SBackMenuHandler backmenu; +static SBackMenuHandler backmenu; -int8_t block = 0; -int8_t subBlockPosition = 0; +static int8_t block = 0; +static int8_t subBlockPosition = 0; -_Bool EnterPressedBeforeButtonAction = 0; -_Bool EnterPressed = 0; +static _Bool EnterPressedBeforeButtonAction = 0; +static _Bool EnterPressed = 0; -_Bool WriteSettings = 0; +static _Bool WriteSettings = 0; /* Private function prototypes -----------------------------------------------*/ void draw_tMEdesign(void); @@ -198,73 +199,52 @@ void tMenuEdit_refresh_live_content(void) { + uint32_t globState = get_globalState(); + void (*refreshFct)() = NULL; - if(get_globalState() == (StMHARD3_O2_Sensor1 & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); -// draw_tMEdesign(); - refresh_O2Sensors(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMHARD2_Compass_SetCourse & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_CompassEdit(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMXTRA_CompassHeading & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); -// draw_tMEdesign(); - refresh_CompassHeading(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMSYS5_Info & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_InformationPage(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMPLAN5_ExitResult & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_PlanResult(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMHARD5_Button1 & MaskFieldDigit)) // will not be executed in EditFieldMode as global state is different - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_ButtonValuesFromPIC(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMSYS3_Units & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_Design(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } - else if(get_globalState() == (StMSYS4_CViewTimeout & MaskFieldDigit)) - { - uint32_t rememberPage = tMEscreen.FBStartAdress; - tMEscreen.FBStartAdress = getFrame(9); - refresh_Customviews(); - GFX_SetFrameTop(tMEscreen.FBStartAdress); - releaseFrame(9,rememberPage); - } + + switch(globState) + { + case (StMHARD3_O2_Sensor1 & MaskFieldDigit): refreshFct = refresh_O2Sensors; + break; + case (StMHARD2_Compass_SetCourse & MaskFieldDigit): refreshFct = refresh_CompassEdit; + break; + case (StMXTRA_CompassHeading & MaskFieldDigit): refreshFct = refresh_CompassHeading; + break; + case (StMSYS5_Info & MaskFieldDigit): refreshFct = &refresh_InformationPage; + break; + case (StMPLAN5_ExitResult & MaskFieldDigit): refreshFct = refresh_PlanResult; + break; + case (StMHARD5_Button1 & MaskFieldDigit): // will not be executed in EditFieldMode as global state is different + refreshFct = refresh_ButtonValuesFromPIC; + break; + case (StMSYS3_Units & MaskFieldDigit): refreshFct = refresh_Design; + break; + case (StMCustom1_CViewTimeout & MaskFieldDigit): + case (StMSYS4_CViewTimeout & MaskFieldDigit): refreshFct = refresh_Customviews; + break; + case (StMCustom2_CViewSelection1 & MaskFieldDigit) : + case StMCustom2_CViewSelection2: + case StMCustom2_CViewSelection3: + case StMCustom2_CViewSelection4: + case StMCustom2_CViewSelection5: + case StMCustom2_CViewSelection6: + case (StMCustom2_BFSelection & MaskFieldDigit) : refreshFct = CustomviewDivemode2_refresh; + break; + default: /* no menu has been updated */ + break; + } + + if(refreshFct != NULL) + { + uint32_t rememberPage = tMEscreen.FBStartAdress; + tMEscreen.FBStartAdress = getFrame(9); + + refreshFct(); + + GFX_SetFrameTop(tMEscreen.FBStartAdress); + releaseFrame(9,rememberPage); + } } void tMenuEdit_writeSettingsToFlash(void) @@ -980,7 +960,19 @@ id = backup_id; } +void tMenuEdit_select(uint32_t editID) +{ + uint8_t id_local = 0; + id_local = get_id_of(editID); + if(id_local <= idLast) + { + id = id_local; + set_cursorNew(id); + } +} + +#if OLD_SELECTION void tMenuEdit_select(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) { if(int1 > 4) @@ -1006,6 +998,7 @@ id = backup_id; } +#endif void tMenuEdit_newInput(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Src/tMenuEditCustom.c Mon Aug 31 20:06:59 2020 +0200 @@ -0,0 +1,721 @@ +/////////////////////////////////////////////////////////////////////////////// +/// -*- coding: UTF-8 -*- +/// +/// \file Discovery/Src/tMenuEditXtra.c +/// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch +/// \author heinrichs weikamp gmbh +/// \date 02-Mar-2015 +/// +/// \details +/// +/// $Id$ +/////////////////////////////////////////////////////////////////////////////// +/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh +/// +/// This program is free software: you can redistribute it and/or modify +/// it under the terms of the GNU General Public License as published by +/// the Free Software Foundation, either version 3 of the License, or +/// (at your option) any later version. +/// +/// This program is distributed in the hope that it will be useful, +/// but WITHOUT ANY WARRANTY; without even the implied warranty of +/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/// GNU General Public License for more details. +/// +/// You should have received a copy of the GNU General Public License +/// along with this program. If not, see <http://www.gnu.org/licenses/>. +////////////////////////////////////////////////////////////////////////////// + +/* Includes ------------------------------------------------------------------*/ +#include "tMenuEditCustom.h" + +#include "gfx_fonts.h" +#include "simulation.h" +#include "timer.h" +#include "tMenuEdit.h" +#include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() +#include "t3.h" +#include "t7.h" +#include "data_exchange_main.h" +#include "motion.h" + +#define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ + +static uint8_t customviewsSubpage = 0; +static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ +static const uint8_t* pcv_curchangelist; +/* Private function prototypes -----------------------------------------------*/ +void openEdit_Customview2(void); +void refresh_Customviews2(void); +/* Announced function prototypes -----------------------------------------------*/ +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_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); + + +/* Exported functions --------------------------------------------------------*/ + + + + +void refresh_Customviews2(void) +{ + char text[32]; + uint8_t textpointer = 0; + + // header + text[0] = '\001'; + text[1] = TXT_2BYTE; + text[2] = TXT2BYTE_Customviews; + text[3] = 0; + write_topline(text); + + // custom view center return + textpointer = 0; + text[textpointer++] = TXT_2BYTE; + text[textpointer++] = TXT2BYTE_CViewTimeout; + textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds); + write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text); + + // custom view center primary + text[0] = TXT_2BYTE; + text[1] = TXT2BYTE_CViewStandard; + text[2] = ' '; + text[3] = ' '; + 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; + } + text[6] = 0; + write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); + + + // field corner return + textpointer = 0; + text[textpointer++] = TXT_2BYTE; + text[textpointer++] = TXT2BYTE_CornerTimeout; + textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds); + write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); + + // field corner primary + text[0] = TXT_2BYTE; + text[1] = TXT2BYTE_CornerStandard; + text[2] = ' '; + text[3] = ' '; + switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary) + { + /* Temperature */ + case LLC_Temperature: + text[4] = TXT_Temperature; + break; + /* Average Depth */ + case LLC_AverageDepth: + text[4] = TXT_AvgDepth; + break; + /* ppO2 */ + case LLC_ppO2: + text[4] = TXT_ppO2; + break; + /* Stop Uhr */ + case LLC_Stopwatch: + text[4] = TXT_Stopwatch; + break; + /* Ceiling */ + case LLC_Ceiling: + text[4] = TXT_Ceiling; + break; + /* Future TTS */ + case LLC_FutureTTS: + text[4] = TXT_FutureTTS; + break; + /* CNS */ + case LLC_CNS: + text[4] = TXT_CNS; + break; + case LLC_GF: + text[4] = TXT_ActualGradient; + break; +#ifdef ENABLE_BOTTLE_SENSOR + case LCC_BottleBar: + text[4] = TXT_AtemGasVorrat; + break; +#endif + /* none */ + case LLC_Empty: + text[4] = '-'; + break; + default: + snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary); + break; + } + text[5] = 0; + write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); + + + // extra display + text[0] = TXT_2BYTE; + text[1] = TXT2BYTE_ExtraDisplay; + text[2] = ' '; + text[3] = ' '; + text[4] = TXT_2BYTE; + switch(settingsGetPointer()->extraDisplay) + { + /* BigFont */ + case EXTRADISPLAY_BIGFONT: + text[5] = TXT2BYTE_ExtraBigFont; + break; + /* DecoGame */ + case EXTRADISPLAY_DECOGAME: + text[5] = TXT2BYTE_ExtraDecoGame; + break; + /* none */ + case EXTRADISPLAY_none: + text[5] = TXT2BYTE_ExtraNone; + break; + + default: + snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); + break; + } + text[6] = 0; + write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); + + /* MotionCtrl */ + text[0] = TXT_2BYTE; + text[1] = TXT2BYTE_MotionCtrl; + text[2] = ' '; + text[3] = ' '; + text[4] = TXT_2BYTE; + switch(settingsGetPointer()->MotionDetection) + { + case MOTION_DETECT_OFF: + text[5] = TXT2BYTE_MoCtrlNone; + break; + case MOTION_DETECT_MOVE: + text[5] = TXT2BYTE_MoCtrlPitch; + break; + case MOTION_DETECT_SECTOR: + text[5] = TXT2BYTE_MoCtrlSector; + break; + case MOTION_DETECT_SCROLL: + text[5] = TXT2BYTE_MoCtrlScroll; + break; + default: + snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection); + break; + } + text[6] = 0; + write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text); + + write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); +} + +void openEdit_Custom(uint8_t line) +{ + set_globalState_Menu_Line(line); + resetMenuEdit(CLUT_MenuPageCustomView); + + switch(line) + { + case 1: + default: + openEdit_Customview2(); + break; + case 2: + openEdit_CustomviewDivemode2(cv_changelist); + break; + case 3: + openEdit_CustomviewDivemode2(cv_changelist_BS); + break; + } +} + +/* Private functions ---------------------------------------------------------*/ +void openEdit_Customview2(void) +{ + refresh_Customviews2(); + + 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_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); + write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); + +// write_field_button(StMCustom1_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); +// write_field_button(StMCustom1_MotionCtrl, 400, 700, ME_Y_LINE6, &FontT48, ""); + + setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout); + setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard); + + setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout); + setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard); + +// setEvent(StMCustom1_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); +// setEvent(StMCustom1_MotionCtrl, (uint32_t)OnAction_MotionCtrl); +} + +char customview_TXT2BYTE_helper2(uint8_t customViewId) +{ + char text = 0; + + switch(customViewId) + { + case CVIEW_sensors: + text = TXT2BYTE_O2monitor; + break; + case CVIEW_sensors_mV: + text = TXT2BYTE_O2voltage; + break; + case CVIEW_Compass: + text = TXT2BYTE_Compass; + break; + case CVIEW_Decolist: + case CVIEW_T3_Decostop: + text = TXT2BYTE_Decolist; + break; + case CVIEW_Tissues: + text = TXT2BYTE_Tissues; + break; + case CVIEW_Profile: + text = TXT2BYTE_Profile; + break; + case CVIEW_Gaslist: + text = TXT2BYTE_Gaslist; + break; + case CVIEW_EADTime: + text = TXT2BYTE_Info; + break; + case CVIEW_SummaryOfLeftCorner: + text = TXT2BYTE_Summary; + break; + case CVIEW_noneOrDebug: + text = TXT2BYTE_DispNoneDbg; + break; + case CVIEW_T3_MaxDepth: + text = TXT2BYTE_MaxDepth; + break; + case CVIEW_T3_StopWatch: + text = TXT2BYTE_Stopwatch; + break; + case CVIEW_T3_TTS: + text = TXT2BYTE_TTS; + break; + case CVIEW_T3_ppO2andGas: + text = TXT2BYTE_ppoNair; + break; + case CVIEW_T3_Navigation: + text = TXT2BYTE_Navigation; + break; + case CVIEW_T3_DepthData: + text = TXT2BYTE_DepthData; + break; + default: + break; + } + return text; +} + + +uint8_t OnAction_CViewTimeout2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + uint8_t value; + value = settingsGetPointer()->tX_customViewTimeout; + + if(value < 5) + value = 5; + else if(value < 10) + value = 10; + else if(value < 15) + value = 15; + else if(value < 20) + value = 20; + else if(value < 30) + value = 30; + else if(value < 45) + value = 45; + else if(value < 60) + value = 60; + else + value = 0; + + settingsGetPointer()->tX_customViewTimeout = value; + return UPDATE_DIVESETTINGS; +} + + +uint8_t OnAction_CViewStandard2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + uint8_t newValue; + switch(settingsGetPointer()->tX_customViewPrimary) + { + case CVIEW_sensors: + newValue = CVIEW_sensors_mV; + break; + case CVIEW_sensors_mV: + newValue = CVIEW_Compass; + break; + case CVIEW_Compass: + newValue = CVIEW_Decolist; + break; + case CVIEW_Decolist: + newValue = CVIEW_Tissues; + break; + case CVIEW_Tissues: + newValue = CVIEW_Profile; + break; + case CVIEW_Profile: + newValue = CVIEW_Gaslist; + break; + case CVIEW_Gaslist: + newValue = CVIEW_EADTime; + break; + case CVIEW_EADTime: + newValue = CVIEW_SummaryOfLeftCorner; + break; + case CVIEW_SummaryOfLeftCorner: + newValue = CVIEW_noneOrDebug; + break; + case CVIEW_noneOrDebug: + default: + newValue = CVIEW_sensors; + break; + } + settingsGetPointer()->tX_customViewPrimary = newValue; + return UPDATE_DIVESETTINGS; +} + + +uint8_t OnAction_CornerTimeout2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + uint8_t value; + value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; + + if(value < 5) + value = 5; + else if(value < 10) + value = 10; + else if(value < 15) + value = 15; + else if(value < 20) + value = 20; + else if(value < 30) + value = 30; + else if(value < 45) + value = 45; + else if(value < 60) + value = 60; + else + value = 0; + + settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value; + return UPDATE_DIVESETTINGS; +} + + +uint8_t OnAction_CornerStandard2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + uint8_t value; + value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; + + value += 1; + + if(value >= LLC_END) + value = 0; + + settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value; + return UPDATE_DIVESETTINGS; +} + + +uint8_t OnAction_Customview_Toggle(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + + uint8_t line = 0; + SSettings *pSettings = settingsGetPointer(); + + switch(editId) + { + case StMCustom2_CViewSelection1: line = 1; + break; + case StMCustom2_CViewSelection2: line = 2; + break; + case StMCustom2_CViewSelection3: line = 3; + break; + case StMCustom2_CViewSelection4: line = 4; + break; + case StMCustom2_CViewSelection5: line = 5; + break; + + default: + break; + } + if(pcv_curchangelist == cv_changelist) + { + pSettings->cv_configuration ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]); + if(t7_GetEnabled_customviews() == 0) + { + pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug); + } + } + else + { + pSettings->cv_config_BigScreen ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]); + if(t3_GetEnabled_customviews() == 0) + { + pSettings->cv_config_BigScreen ^= (1 << CVIEW_noneOrDebug); + } + } + return UPDATE_DIVESETTINGS; +} + + +uint8_t OnAction_Customview_NextPage(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + uint8_t id_next = 0; + customviewsSubpage++; + if(customviewsSubpage == customviewsSubpageMax) + { + customviewsSubpage = 0; + } + resetMenuEdit(CLUT_MenuPageCustomView); /* rebuild page */ + openEdit_CustomviewDivemode2(pcv_curchangelist); + + tMenuEdit_select(StMCustom2_CViewSelection6); + return UPDATE_DIVESETTINGS; +} + +void openEdit_CustomviewDivemode2(const uint8_t* pcv_changelist) +{ + + SSettings *pSettings = settingsGetPointer(); + char text[MAX_PAGE_TEXTSIZE]; + uint8_t textPointer = 0; + uint32_t id; + + uint8_t i; + + customviewsSubpageMax = (tHome_getNumberOfAvailableCVs(pcv_changelist) / CV_PER_PAGE) + 1; + pcv_curchangelist = pcv_changelist; + + CustomviewDivemode2_refresh(pcv_changelist); + + + text[0] = '\001'; + text[1] = TXT_2BYTE; + text[2] = TXT2BYTE_SelectCustomviews; + text[3] = 0; + write_topline(text); + + for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ + { + textPointer = 0; + id = pcv_changelist[customviewsSubpage * 5 + i]; + if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ + { + break; + } + else + { + if(pcv_changelist == cv_changelist) + { + text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id); + } + else + { + text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id); + } + text[textPointer++] = ' '; + textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper2(id)); + + switch(i) + { + case 0: write_field_button(StMCustom2_CViewSelection1, 30, 800, ME_Y_LINE1, &FontT48, ""); + break; + case 1: write_field_button(StMCustom2_CViewSelection2, 30, 800, ME_Y_LINE2, &FontT48, ""); + break; + case 2: write_field_button(StMCustom2_CViewSelection3, 30, 800, ME_Y_LINE3, &FontT48, ""); + break; + case 3: write_field_button(StMCustom2_CViewSelection4, 30, 800, ME_Y_LINE4, &FontT48, ""); + break; + case 4: write_field_button(StMCustom2_CViewSelection5, 30, 800, ME_Y_LINE5, &FontT48, ""); + break; + default: + break; + } + } + } + // setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle); + + + if(customviewsSubpageMax != 1) + { + textPointer = 0; + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ButtonNext; + text[textPointer] = 0; + write_field_button(StMCustom2_CViewSelection6, 30, 800, ME_Y_LINE6, &FontT48, text); + } + + /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */ + for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ + { + id = pcv_changelist[customviewsSubpage * 5 + i]; + if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ + { + break; + } + else + { + switch(i) + { + case 0: setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle); + break; + case 1: setEvent(StMCustom2_CViewSelection2, (uint32_t)OnAction_Customview_Toggle); + break; + case 2: setEvent(StMCustom2_CViewSelection3, (uint32_t)OnAction_Customview_Toggle); + break; + case 3: setEvent(StMCustom2_CViewSelection4, (uint32_t)OnAction_Customview_Toggle); + break; + case 4: setEvent(StMCustom2_CViewSelection5, (uint32_t)OnAction_Customview_Toggle); + break; + + default: + break; + } + + } + } + if(customviewsSubpageMax != 1) + { + setEvent(StMCustom2_CViewSelection6,(uint32_t)OnAction_Customview_NextPage); + } + for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ + { + switch(i) + { + case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, ""); + break; + case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, ""); + break; + case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, ""); + break; + case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, ""); + break; + case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, ""); + break; + default: + break; + }; + } + + + write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); +} + + +void CustomviewDivemode2_refresh() +{ + SSettings *pSettings = settingsGetPointer(); + char text[MAX_PAGE_TEXTSIZE]; + uint8_t textPointer = 0; + uint32_t id; + + uint8_t i; + + text[0] = '\001'; + text[1] = TXT_2BYTE; + text[2] = TXT2BYTE_SelectCustomviews; + text[3] = 0; + write_topline(text); + + + for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ + { + textPointer = 0; + id = pcv_curchangelist[customviewsSubpage * 5 + i]; + if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ + { + break; + } + else + { + if(pcv_curchangelist == cv_changelist) + { + text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id); + } + else + { + text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id); + } + text[textPointer++] = ' '; + textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper2(id)); + + switch(i) + { + case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); + break; + case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); + break; + case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, text); + break; + case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); + break; + case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, text); + break; + default: + break; + } + } + } + if(customviewsSubpageMax != 1) + { + textPointer = 0; + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ButtonNext; + text[textPointer] = 0; + write_label_var( 30, 800, ME_Y_LINE6, &FontT48, text); + } +}
--- a/Discovery/Src/tMenuEditSystem.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/tMenuEditSystem.c Mon Aug 31 20:06:59 2020 +0200 @@ -186,7 +186,6 @@ { pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug); } - WriteSettings = 1; InitMotionDetection(); /* consider new view setup for view selection by motion */ exitMenuEdit_to_Menu_with_Menu_Update(); } @@ -943,11 +942,7 @@ case EXTRADISPLAY_none: text[5] = TXT2BYTE_ExtraNone; break; -#ifdef ENABLE_BIGFONT_VX - case EXTRADISPLAY_BIGFONT2: - text[5] = TXT2BYTE_ExtraBigFontV2; - break; -#endif + default: snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); break;
--- a/Discovery/Src/tMenuSystem.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/tMenuSystem.c Mon Aug 31 20:06:59 2020 +0200 @@ -305,6 +305,7 @@ text = TXT2BYTE_Compass; break; case CVIEW_Decolist: + case CVIEW_T3_Decostop: text = TXT2BYTE_Decolist; break; case CVIEW_Tissues: @@ -325,6 +326,24 @@ case CVIEW_noneOrDebug: text = TXT2BYTE_DispNoneDbg; break; + case CVIEW_T3_MaxDepth: + text = TXT2BYTE_MaxDepth; + break; + case CVIEW_T3_StopWatch: + text = TXT2BYTE_Stopwatch; + break; + case CVIEW_T3_TTS: + text = TXT2BYTE_TTS; + break; + case CVIEW_T3_ppO2andGas: + text = TXT2BYTE_ppoNair; + break; + case CVIEW_T3_Navigation: + text = TXT2BYTE_Navigation; + break; + case CVIEW_T3_DepthData: + text = TXT2BYTE_DepthData; + break; default: break; }
--- a/Discovery/Src/text_multilanguage.c Mon Aug 24 19:59:28 2020 +0200 +++ b/Discovery/Src/text_multilanguage.c Mon Aug 31 20:06:59 2020 +0200 @@ -1258,26 +1258,11 @@ static uint8_t text_ES_ExtraDisplay[] = "Letras grandes"; // Menu SYS2 -#ifdef ENABLE_BIGFONT_VX -static uint8_t text_EN_ExtraBigFont[] = "classic"; -static uint8_t text_DE_ExtraBigFont[] = "klassisch"; -static uint8_t text_FR_ExtraBigFont[] = "classic"; -static uint8_t text_IT_ExtraBigFont[] = "classic"; -static uint8_t text_ES_ExtraBigFont[] = "classic"; - -static uint8_t text_EN_ExtraBigFontV2[] = "V2"; -static uint8_t text_DE_ExtraBigFontV2[] = "V2"; -static uint8_t text_FR_ExtraBigFontV2[] = "V2"; -static uint8_t text_IT_ExtraBigFontV2[] = "V2"; -static uint8_t text_ES_ExtraBigFontV2[] = "V2"; - -#else static uint8_t text_EN_ExtraBigFont[] = "yes"; static uint8_t text_DE_ExtraBigFont[] = "ja"; static uint8_t text_FR_ExtraBigFont[] = "si"; static uint8_t text_IT_ExtraBigFont[] = "si"; static uint8_t text_ES_ExtraBigFont[] = "si"; -#endif // Menu SYS2 (future feature) static uint8_t text_EN_ExtraDecoGame[] = "Deco game"; @@ -1579,6 +1564,36 @@ static uint8_t text_IT_FlipDisplay[] = ""; static uint8_t text_ES_FlipDisplay[] = ""; +static uint8_t text_EN_SelectCustom[] = "Data views"; +static uint8_t text_DE_SelectCustom[] = "Auswahl Datenanzeige"; +static uint8_t text_FR_SelectCustom[] = ""; +static uint8_t text_IT_SelectCustom[] = ""; +static uint8_t text_ES_SelectCustom[] = ""; + +static uint8_t text_EN_SelectBigFont[] = "Bigfont data views"; +static uint8_t text_DE_SelectBigFont[] = "Grosschrift Daten"; +static uint8_t text_FR_SelectBigFont[] = ""; +static uint8_t text_IT_SelectBigFont[] = ""; +static uint8_t text_ES_SelectBigFont[] = ""; + +static uint8_t text_EN_ppo2Air[] = "PPO2 and active gas"; +static uint8_t text_DE_ppo2Air[] = "PPO2 und aktives Atemgas"; +static uint8_t text_FR_ppo2Air[] = ""; +static uint8_t text_IT_ppo2Air[] = ""; +static uint8_t text_ES_ppo2Air[] = ""; + +static uint8_t text_EN_Navigation[] = "Compass and stop watch"; +static uint8_t text_DE_Navigation[] = "Kompass und Stoppuhr"; +static uint8_t text_FR_Navigation[] = ""; +static uint8_t text_IT_Navigation[] = ""; +static uint8_t text_ES_Navigation[] = ""; + +static uint8_t text_EN_DepthData[] = "Average and max depth"; +static uint8_t text_DE_DepthData[] = "Mittlere und maximale Tiefe"; +static uint8_t text_FR_DepthData[] = ""; +static uint8_t text_IT_DepthData[] = ""; +static uint8_t text_ES_DepthData[] = ""; + /* Lookup Table -------------------------------------------------------------*/ const tText text_array[] = @@ -1769,9 +1784,6 @@ {(uint8_t)TXT2BYTE_DiveResetAvgQ, {text_EN_DiveResetAvgQ, text_DE_DiveResetAvgQ, text_FR_DiveResetAvgQ, text_IT_DiveResetAvgQ, text_ES_DiveResetAvgQ}}, {(uint8_t)TXT2BYTE_ExtraDisplay, {text_EN_ExtraDisplay, text_DE_ExtraDisplay, text_FR_ExtraDisplay, text_IT_ExtraDisplay, text_ES_ExtraDisplay}}, {(uint8_t)TXT2BYTE_ExtraBigFont, {text_EN_ExtraBigFont, text_DE_ExtraBigFont, text_FR_ExtraBigFont, text_IT_ExtraBigFont, text_ES_ExtraBigFont}}, -#ifdef ENABLE_BIGFONT_VX - {(uint8_t)TXT2BYTE_ExtraBigFontV2, {text_EN_ExtraBigFontV2, text_DE_ExtraBigFontV2, text_FR_ExtraBigFontV2, text_IT_ExtraBigFontV2, text_ES_ExtraBigFontV2}}, -#endif {(uint8_t)TXT2BYTE_ExtraDecoGame, {text_EN_ExtraDecoGame, text_DE_ExtraDecoGame, text_FR_ExtraDecoGame, text_IT_ExtraDecoGame, text_ES_ExtraDecoGame}}, {(uint8_t)TXT2BYTE_ExtraNone, {text_EN_ExtraNone, text_DE_ExtraNone, text_FR_ExtraNone, text_IT_ExtraNone, text_ES_ExtraNone}}, {(uint8_t)TXT2BYTE_MotionCtrl, {text_EN_MotionCtrl, text_DE_MotionCtrl, text_FR_MotionCtrl, text_IT_MotionCtrl, text_ES_MotionCtrl}}, @@ -1802,4 +1814,14 @@ {(uint8_t)TXT2BYTE_FLIPDISPLAY, {text_EN_FlipDisplay, text_DE_FlipDisplay, text_FR_FlipDisplay, text_IT_FlipDisplay, text_ES_FlipDisplay}}, + {(uint8_t)TXT2BYTE_SelectCustomviews,{text_EN_SelectCustom, text_DE_SelectCustom, text_FR_SelectCustom, text_IT_SelectCustom, text_ES_SelectCustom}}, + {(uint8_t)TXT2BYTE_SelectBigFont, {text_EN_SelectBigFont, text_DE_SelectBigFont, text_FR_SelectBigFont, text_IT_SelectBigFont, text_ES_SelectBigFont}}, + {(uint8_t)TXT2BYTE_MaxDepth, {text_EN_MaxDepth, text_DE_MaxDepth, text_FR_MaxDepth, text_IT_MaxDepth, text_ES_MaxDepth}}, + {(uint8_t)TXT2BYTE_Stopwatch, {text_EN_Stopwatch, text_DE_Stopwatch, text_FR_Stopwatch, text_IT_Stopwatch, text_ES_Stopwatch}}, + {(uint8_t)TXT2BYTE_TTS, {text_EN_TTS, text_DE_TTS, text_FR_TTS, text_IT_TTS, text_ES_TTS}}, + {(uint8_t)TXT2BYTE_ppoNair, {text_EN_ppo2Air, text_DE_ppo2Air, text_FR_ppo2Air, text_IT_ppo2Air, text_ES_ppo2Air}}, + {(uint8_t)TXT2BYTE_Navigation, {text_EN_Navigation, text_DE_Navigation, text_FR_Navigation, text_IT_Navigation, text_ES_Navigation}}, + {(uint8_t)TXT2BYTE_DepthData, {text_EN_DepthData, text_DE_DepthData, text_FR_DepthData, text_IT_DepthData, text_ES_DepthData}}, + + };