annotate Discovery/Src/tMenuEditDeco.c @ 104:22a1094545f3 kittz

Tested and alive.
author Dmitry Romanov <kitt@bk.ru>
date Mon, 24 Dec 2018 16:15:02 +0300
parents 5f11787b4f42
children b7689d9e888a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tMenuEditDeco.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for Menu Edit Deco Parameters
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 31-July-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tMenuEditDeco.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "tMenuEdit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 uint8_t lineSelected = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 void openEdit_DiveMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 void openEdit_CCRModeSensorOrFixedSP(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 void openEdit_ppO2max(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 void openEdit_SafetyStop(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 void openEdit_FutureTTS(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 void openEdit_Salinity(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 /* Announced function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 void openEdit_Deco(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 resetMenuEdit(CLUT_MenuPageDeco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 SSettings *data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 lineSelected = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 if((data->dive_mode != DIVEMODE_CCR )&& (line > 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 line += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 switch(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 case 1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 openEdit_DiveMode();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 case 2:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 openEdit_CCRModeSensorOrFixedSP();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 case 3:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 openEdit_ppO2max();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 case 4:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 openEdit_SafetyStop();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 case 5:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 openEdit_FutureTTS();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 case 6:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 openEdit_Salinity();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 void openEdit_DiveMode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 #define APNEAANDGAUGE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 uint8_t actualDiveMode, active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 actualDiveMode = pSettings->dive_mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 text[1] = TXT_DiveMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 text[0] = TXT_OpenCircuit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 if(actualDiveMode == DIVEMODE_OC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 write_field_on_off(StMDECO1_OC, 30, 500, ME_Y_LINE1, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 text[0] = TXT_ClosedCircuit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 if(actualDiveMode == DIVEMODE_CCR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 write_field_on_off(StMDECO1_CC, 30, 500, ME_Y_LINE2, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 #ifdef APNEAANDGAUGE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 text[0] = TXT_Apnoe;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 if(actualDiveMode == DIVEMODE_Apnea)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 write_field_on_off(StMDECO1_Apnea, 30, 500, ME_Y_LINE3, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 text[0] = TXT_Gauge;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 if(actualDiveMode == DIVEMODE_Gauge)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 write_field_on_off(StMDECO1_Gauge, 30, 500, ME_Y_LINE4, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 setEvent(StMDECO1_OC, (uint32_t)OnAction_OC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 setEvent(StMDECO1_CC, (uint32_t)OnAction_CC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 #ifdef APNEAANDGAUGE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 setEvent(StMDECO1_Apnea, (uint32_t)OnAction_Apnea);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 setEvent(StMDECO1_Gauge, (uint32_t)OnAction_Gauge);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 if(pSettings->dive_mode == DIVEMODE_OC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 pSettings->dive_mode = DIVEMODE_OC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 setActualGasFirst(&stateRealGetPointerWrite()->lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 tMenuEdit_set_on_off(StMDECO1_CC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 tMenuEdit_set_on_off(StMDECO1_Apnea, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 tMenuEdit_set_on_off(StMDECO1_Gauge, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 if(pSettings->dive_mode == DIVEMODE_CCR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 pSettings->dive_mode = DIVEMODE_CCR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 setActualGasFirst(&stateRealGetPointerWrite()->lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 tMenuEdit_set_on_off(StMDECO1_OC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 tMenuEdit_set_on_off(StMDECO1_Apnea, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 tMenuEdit_set_on_off(StMDECO1_Gauge, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 if(pSettings->dive_mode == DIVEMODE_Apnea)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 pSettings->dive_mode = DIVEMODE_Apnea;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 setActualGasFirst(&stateRealGetPointerWrite()->lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 tMenuEdit_set_on_off(StMDECO1_CC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 tMenuEdit_set_on_off(StMDECO1_OC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 tMenuEdit_set_on_off(StMDECO1_Gauge, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 if(pSettings->dive_mode == DIVEMODE_Gauge)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 pSettings->dive_mode = DIVEMODE_Gauge;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 setActualGasFirst(&stateRealGetPointerWrite()->lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 tMenuEdit_set_on_off(StMDECO1_CC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 tMenuEdit_set_on_off(StMDECO1_Apnea, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 tMenuEdit_set_on_off(StMDECO1_OC, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 void openEdit_CCRModeSensorOrFixedSP(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 if(pSettings->CCR_Mode == CCRMODE_Sensors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 pSettings->CCR_Mode = CCRMODE_FixedSetpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 pSettings->CCR_Mode = CCRMODE_Sensors;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 exitEditWithUpdate();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 void openEdit_SafetyStop(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 uint32_t safetystopDuration, safetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 char text[64];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 safetystopDuration = settingsGetPointer()->safetystopDuration;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 safetystopDepth = settingsGetPointer()->safetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 text[1] = TXT_SafetyStop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 write_label_fix( 20, 800, y_line, &FontT48, TXT_SafetyStop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 strcpy(text,"\016\016");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 text[2] = TXT_Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 strcpy(&text[3],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 " @ "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 " ft"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 strcpy(&text[3],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 " @ "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 " m"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 write_label_var( 410, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 write_field_2digit(StMDECO4_SafetyStop, 350, 800, y_line, &FontT48, "## ##", safetystopDuration, unit_depth_integer(safetystopDepth), 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 write_field_udigit(StMDECO4_SafetyStop, 370, 800, y_line, &FontT48, "# #", safetystopDuration, safetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 uint32_t newSafetystopDuration, newSafetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 evaluateNewString(editId, &newSafetystopDuration, &newSafetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 newSafetystopDepth += 2; // f�r rundung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 newSafetystopDepth = (newSafetystopDepth * 3) / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 settingsGetPointer()->safetystopDuration = newSafetystopDuration;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 settingsGetPointer()->safetystopDepth = newSafetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 tMenuEdit_newInput(editId, newSafetystopDuration, newSafetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 if(blockNumber == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 if(digitContentNew > '5')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 if(settingsGetPointer()->nonMetricalSystem == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 if(digitContentNew > '6')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 digitContentNew = '3';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 if(digitContent < 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 else if(digitContent < 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 else if(digitContent < 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 if(blockNumber == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 digitContentNew = '5';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 if(settingsGetPointer()->nonMetricalSystem == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 if(digitContentNew < '3')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 digitContentNew = '6';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 if(digitContent >= 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 else if(digitContent >= 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 else if(digitContent >= 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 void openEdit_Salinity(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 text[1] = TXT_Salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 write_label_fix( 30, 800, y_line, &FontT48, TXT_Salinity);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 write_label_var( 400, 800, y_line, &FontT48, "\016\016 %\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 write_field_udigit(StMDECO6_SALINITY, 370, 800, y_line, &FontT48, "#", (uint32_t)settingsGetPointer()->salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 uint8_t OnAction_Salinity(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 uint32_t salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 evaluateNewString(editId, &salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 if(salinity >= 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 salinity = 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 pSettings->salinity = salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 tMenuEdit_newInput(editId, salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 if(digitContentNew > '4')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 digitContentNew = '4';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 void openEdit_ppO2max(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 uint8_t maxL_std, maxL_deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 maxL_std = pSettings->ppO2_max_std - 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 maxL_deco = pSettings->ppO2_max_deco - 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 text[1] = TXT_ppO2Name;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 strcpy(text,"ppO2\016\016max\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 write_label_var( 20, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 strcpy(text,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 " bar "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 " deco "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 " "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 " bar"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 write_label_var( 460, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 // write_field_udigit(StMDECO4_PPO2Max, 410, 800, y_line, &FontT48, "## ##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 write_field_udigit(StMDECO3_PPO2Max, 370, 800, y_line, &FontT48, "1.## 1.##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 uint8_t OnAction_ppO2Max(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 uint32_t newPPO2LStd, newPPO2LDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 evaluateNewString(editId, &newPPO2LStd, &newPPO2LDeco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 if(newPPO2LStd > 90)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 newPPO2LStd = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 if(newPPO2LDeco > 90)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 newPPO2LDeco = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 pSettings->ppO2_max_std = 100 + newPPO2LStd;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 pSettings->ppO2_max_deco = 100 + newPPO2LDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 tMenuEdit_newInput(editId, newPPO2LStd, newPPO2LDeco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 void openEdit_FutureTTS(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 uint8_t futureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 futureTTS = pSettings->future_TTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 text[1] = TXT_FutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 strcpy(text,"\016\016");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 text[2] = TXT_Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 write_label_fix( 20, 800, y_line, &FontT48, TXT_FutureTTS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 write_label_var( 435, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 write_field_2digit(StMDECO5_FUTURE, 370, 500, y_line, &FontT48, "##", (uint32_t)futureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 uint8_t OnAction_FutureTTS(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 int8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 uint32_t newFutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 evaluateNewString(editId, &newFutureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 if(newFutureTTS > 15)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 newFutureTTS = 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 pSettings->future_TTS = newFutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 tMenuEdit_newInput(editId, newFutureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 if(digitContentNew > '0'+ 15)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 digitContentNew = '0' + 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 if((digitNumber == 0) && (digitContentNew > '1'))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 if((digitNumber == 0) && (digitContentNew < '0'))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 digitContentNew = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619