Mercurial > public > ostc4
changeset 506:998529b3e142
Added new top level menu for customization of views
In the previous versions all menus were occupied by menu option. To indroduce the selection views for data visualization a new tab had to be added.
The menu "Customize views" has been moded to the new tab but not yet removed from the previous one. In addition a view for selection of big font options has been added (including multilanguage strings and other infrastructure)
author | Ideenmodellierer |
---|---|
date | Sun, 30 Aug 2020 17:19:23 +0200 |
parents | 06b21f1e47a5 |
children | 5e3b830b955f |
files | Discovery/Inc/gfx_colors.h Discovery/Inc/tMenuCustom.h Discovery/Inc/tMenuEditCustom.h Discovery/Inc/tStructure.h Discovery/Inc/text_multilanguage.h Discovery/Src/gfx_colors.c Discovery/Src/tMenuCustom.c Discovery/Src/tMenuEditCustom.c Discovery/Src/text_multilanguage.c |
diffstat | 9 files changed, 979 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/gfx_colors.h Sun Aug 30 17:14:31 2020 +0200 +++ b/Discovery/Inc/gfx_colors.h Sun Aug 30 17:19:23 2020 +0200 @@ -86,8 +86,8 @@ CLUT_MenuPageDecoParameter, CLUT_MenuPageHardware, CLUT_MenuPageSystem, + CLUT_MenuPageCustomView, CLUT_MenuPageDivePlanner, - CLUT_MenuPage9, CLUT_MenuPage10, CLUT_ButtonSymbols, CLUT_InfoSurface,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Inc/tMenuCustom.h Sun Aug 30 17:19:23 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****/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Inc/tMenuEditCustom.h Sun Aug 30 17:19:23 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 Sun Aug 30 17:14:31 2020 +0200 +++ b/Discovery/Inc/tStructure.h Sun Aug 30 17:19:23 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 Sun Aug 30 17:14:31 2020 +0200 +++ b/Discovery/Inc/text_multilanguage.h Sun Aug 30 17:19:23 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/gfx_colors.c Sun Aug 30 17:14:31 2020 +0200 +++ b/Discovery/Src/gfx_colors.c Sun Aug 30 17:19:23 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Src/tMenuCustom.c Sun Aug 30 17:19:23 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; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Discovery/Src/tMenuEditCustom.c Sun Aug 30 17:19:23 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/text_multilanguage.c Sun Aug 30 17:14:31 2020 +0200 +++ b/Discovery/Src/text_multilanguage.c Sun Aug 30 17:19:23 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}}, + + };