Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSystem.c @ 849:fce639612464 Evo_2_23
Consider flipped screen for Predive menu:
In previous version some values were not optimized for the visualization while the screen is flipped.
author | Ideenmodellierer |
---|---|
date | Thu, 29 Feb 2024 18:49:55 +0100 |
parents | e04d7dd199fb |
children | 48b6a3b1f3f8 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditSystem.c | |
5 /// \brief Main Template file for Menu Edit System settings | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 05-Aug-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenuEditSystem.h" | |
31 | |
138 | 32 #include "data_exchange_main.h" |
38 | 33 #include "externLogbookFlash.h" |
34 #include "gfx_fonts.h" | |
35 #include "ostc.h" | |
36 #include "settings.h" // for getLicence() | |
37 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
38 #include "tMenu.h" |
38 | 39 #include "tMenuEdit.h" |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
40 #include "tMenuSystem.h" |
520 | 41 #include "tMenuEditCustom.h" |
389
ebc2b571a0b9
Fix case for case sensitive OS
Jan Mulder <jan@jlmulder.nl>
parents:
384
diff
changeset
|
42 #include "motion.h" |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
43 #include "t7.h" |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
44 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
468
diff
changeset
|
45 |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
46 /*#define HAVE_DEBUG_VIEW */ |
379 | 47 static uint8_t infoPage = 0; |
38 | 48 |
49 /* Private function prototypes -----------------------------------------------*/ | |
50 void openEdit_DateTime(void); | |
51 void openEdit_Language(void); | |
52 void openEdit_Design(void); | |
53 void openEdit_Information(void); | |
54 void openEdit_Reset(void); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
55 void openEdit_Maintenance(void); |
38 | 56 //void openEdit_ShowDebugInfo(void); |
57 //void openEdit_Salinity(void); | |
58 | |
59 /* Announced function prototypes -----------------------------------------------*/ | |
60 uint8_t OnAction_Date (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
61 uint8_t OnAction_Time (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
567 | 62 uint8_t OnAction_12HR (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 63 uint8_t OnAction_DDMMYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
64 uint8_t OnAction_MMDDYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
65 uint8_t OnAction_YYMMDD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
66 uint8_t OnAction_DST (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
67 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
69 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
70 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
71 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
72 //uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
73 //uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
74 //uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
75 | |
76 uint8_t OnAction_Units (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
77 uint8_t OnAction_Colorscheme (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
78 uint8_t OnAction_DebugInfo (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
79 | |
80 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
81 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
82 uint8_t OnAction_Maintenance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 83 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
84 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
85 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
86 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
87 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
88 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
89 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
90 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
91 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
92 uint8_t OnAction_AdjustSurfacePressure (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
93 #ifdef ENABLE_ANALYSE_SAMPLES |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
94 uint8_t OnAction_RecoverSampleIdx(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
95 #endif |
38 | 96 #ifdef SCREENTEST |
97 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
98 #endif | |
99 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
100 /* | |
101 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
102 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
103 */ | |
104 | |
105 /* Exported functions --------------------------------------------------------*/ | |
106 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
107 static uint8_t OnAction_Timer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
108 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
109 SSettings *settings = settingsGetPointer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
110 uint8_t digitContentNew; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
111 switch (action) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
112 case ACTION_BUTTON_ENTER: |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
113 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
114 return digitContent; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
115 case ACTION_BUTTON_ENTER_FINAL: |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
116 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
117 uint32_t timerM; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
118 uint32_t timerS; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
119 evaluateNewString(editId, &timerM, &timerS, 0, 0); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
120 if (timerM > 9) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
121 timerM = 9; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
122 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
123 if (timerS > 59) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
124 timerS = 59; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
125 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
126 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
127 uint16_t timerDurationS = 60 * timerM + timerS; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
128 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
129 if (timerDurationS < 1) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
130 timerDurationS = 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
131 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
132 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
133 if (timerDurationS != settings->timerDurationS) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
134 settings->timerDurationS = timerDurationS; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
135 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
136 disableTimer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
137 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
138 tMenuEdit_newInput(editId, settings->timerDurationS / 60, settings->timerDurationS % 60, 0, 0); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
139 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
140 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
141 return EXIT_TO_MENU; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
142 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
143 case ACTION_BUTTON_NEXT: |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
144 digitContentNew = digitContent + 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
145 if ((blockNumber == 1 && digitNumber == 0 && digitContentNew > '5') || digitContentNew > '9') { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
146 digitContentNew = '0'; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
147 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
148 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
149 return digitContentNew; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
150 case ACTION_BUTTON_BACK: |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
151 digitContentNew = digitContent - 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
152 if (digitContentNew < '0') { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
153 if (blockNumber == 1 && digitNumber == 0) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
154 digitContentNew = '5'; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
155 } else { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
156 digitContentNew = '9'; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
157 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
158 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
159 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
160 return digitContentNew; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
161 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
162 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
163 return EXIT_TO_MENU; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
164 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
165 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
166 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
167 static void openEdit_Timer(void) |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
168 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
169 SSettings *settings = settingsGetPointer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
170 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
171 char text[32]; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
172 snprintf(text, 32, "\001%c%c", TXT_2BYTE, TXT2BYTE_Timer); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
173 write_topline(text); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
174 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
175 uint16_t yPos = ME_Y_LINE_BASE + get_globalState_Menu_Line() * ME_Y_LINE_STEP; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
176 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Timer); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
177 write_label_var(30, 299, yPos, &FontT48, text); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
178 write_field_udigit(StMSYS_Timer, 300, 392, yPos, &FontT48, "#:##", settings->timerDurationS / 60, settings->timerDurationS % 60, 0, 0); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
179 write_label_var(393, 800, yPos, &FontT48, "\016\016 [m:ss]\017"); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
180 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
181 write_buttonTextline(TXT2BYTE_ButtonMinus, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonPlus); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
182 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
183 setEvent(StMSYS_Timer, (uint32_t)OnAction_Timer); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
184 startEdit(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
185 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
186 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
187 |
38 | 188 void openEdit_System(uint8_t line) |
189 { | |
190 set_globalState_Menu_Line(line); | |
191 resetMenuEdit(CLUT_MenuPageSystem); | |
192 | |
193 if(actual_menu_content == MENU_SURFACE) | |
194 { | |
195 switch(line) | |
196 { | |
197 case 1: | |
198 default: | |
199 openEdit_DateTime(); | |
200 break; | |
201 case 2: | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
202 openEdit_Timer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
203 break; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
204 case 3: |
38 | 205 openEdit_Language(); |
206 break; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
207 case 4: |
38 | 208 openEdit_Design(); |
209 break; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
210 case 5: |
520 | 211 openEdit_Information(); |
38 | 212 break; |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
213 case 6: |
38 | 214 openEdit_Reset(); |
215 break; | |
216 /* | |
217 case 3: | |
218 openEdit_DecoFutureTTS(); | |
219 break; | |
220 case 4: | |
221 openEdit_DecoLastStop(); | |
222 break; | |
223 */ | |
224 } | |
225 } | |
226 else | |
227 { | |
520 | 228 openEdit_CustomviewDivemodeMenu(line); |
38 | 229 } |
230 | |
231 } | |
232 | |
233 /* Private functions ---------------------------------------------------------*/ | |
234 | |
235 | |
236 void openEdit_DateTime(void) | |
237 { | |
238 RTC_DateTypeDef Sdate; | |
239 RTC_TimeTypeDef Stime; | |
240 uint8_t day,month,year,hour,minute, dateFormat, ddmmyy, mmddyy, yymmdd; | |
241 char text[32]; | |
242 SSettings *pSettings; | |
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
720
diff
changeset
|
243 const SFirmwareData *pFirmwareInfo; |
720 | 244 pFirmwareInfo = firmwareDataGetPointer(); |
38 | 245 const SDiveState * pStateReal = stateRealGetPointer(); |
246 | |
247 pSettings = settingsGetPointer(); | |
248 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
249 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
250 year = Sdate.Year; | |
251 month = Sdate.Month; | |
252 day = Sdate.Date; | |
253 hour = Stime.Hours; | |
254 minute= Stime.Minutes; | |
255 | |
720 | 256 if(year < pFirmwareInfo->release_year) |
257 year = pFirmwareInfo->release_year; | |
38 | 258 |
259 if(month < 1) | |
260 month = 1; | |
261 | |
262 if(day < 1) | |
263 day = 1; | |
264 | |
265 // daylightsaving = Stime.DayLightSaving; | |
266 dateFormat = pSettings->date_format; | |
267 ddmmyy = 0; | |
268 mmddyy = 0; | |
269 yymmdd = 0; | |
270 | |
271 if(dateFormat == DDMMYY) | |
272 ddmmyy = 1; | |
273 else | |
274 if(dateFormat == MMDDYY) | |
275 mmddyy = 1; | |
276 else | |
277 yymmdd = 1; | |
278 | |
279 text[0] = '\001'; | |
280 text[1] = TXT_DateAndTime; | |
281 text[2] = 0; | |
282 | |
283 write_topline(text); | |
284 | |
285 write_label_fix( 20, 340, ME_Y_LINE1, &FontT42, TXT_TimeConfig); | |
567 | 286 write_label_fix( 20, 340, ME_Y_LINE2, &FontT42, TXT_Format); |
287 write_label_fix( 20, 340, ME_Y_LINE3, &FontT42, TXT_DateConfig); | |
288 write_label_var( 600, 800, ME_Y_LINE4, &FontT48, "\016\016DDMMYY\017"); | |
289 write_label_fix( 20, 790, ME_Y_LINE5, &FontT42, TXT_Format); | |
38 | 290 // write_label_fix( 350 ,580, 250, &FontT42, TXT_Daylightsaving); |
291 | |
292 write_field_2digit(StMSYS1_Time, 320, 780, ME_Y_LINE1, &FontT48, "##:##", (uint32_t)hour, (uint32_t)minute, 0, 0); | |
567 | 293 write_field_on_off(StMSYS1_12HR, 320, 790, ME_Y_LINE2, &FontT48, "12 HR", pSettings->amPMTime); |
294 write_field_2digit(StMSYS1_Date, 320, 780, ME_Y_LINE3, &FontT48, "##-##-20##", (uint32_t)day, (uint32_t)month, (uint32_t)year, 0); | |
295 write_field_on_off(StMSYS1_DDMMYY, 320, 790, ME_Y_LINE4, &FontT48, "DDMMYY", ddmmyy); | |
296 write_field_on_off(StMSYS1_MMDDYY, 320, 790, ME_Y_LINE5, &FontT48, "MMDDYY", mmddyy); | |
297 write_field_on_off(StMSYS1_YYMMDD, 320, 790, ME_Y_LINE6, &FontT48, "YYMMDD", yymmdd); | |
38 | 298 // write_field_on_off(StMSYS1_DST, 350, 580, 310, &FontT48, "Active", daylightsaving); |
299 | |
300 setEvent(StMSYS1_Date, (uint32_t)OnAction_Date); | |
301 setEvent(StMSYS1_Time, (uint32_t)OnAction_Time); | |
567 | 302 setEvent(StMSYS1_12HR, (uint32_t)OnAction_12HR); |
38 | 303 setEvent(StMSYS1_DDMMYY, (uint32_t)OnAction_DDMMYY); |
304 setEvent(StMSYS1_MMDDYY, (uint32_t)OnAction_MMDDYY); | |
305 setEvent(StMSYS1_YYMMDD, (uint32_t)OnAction_YYMMDD); | |
306 // setEvent(StMSYS1_DST, (uint32_t)OnAction_DST); | |
307 | |
308 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
309 } | |
310 | |
311 | |
312 uint8_t OnAction_Date(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
313 { | |
314 uint8_t digitContentNew; | |
315 uint32_t newDay, newMonth, newYear; | |
316 RTC_DateTypeDef sdatestructure; | |
317 | |
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
720
diff
changeset
|
318 const SFirmwareData *pFirmwareInfo; |
720 | 319 pFirmwareInfo = firmwareDataGetPointer(); |
38 | 320 |
321 if(action == ACTION_BUTTON_ENTER) | |
322 { | |
323 return digitContent; | |
324 } | |
325 if(action == ACTION_BUTTON_ENTER_FINAL) | |
326 { | |
327 evaluateNewString(editId, &newDay, &newMonth, &newYear, 0); | |
328 if(newDay == 0) | |
329 newDay = 1; | |
330 if(newDay > 31) | |
331 newDay = 31; | |
332 if(newMonth == 0) | |
333 newMonth = 1; | |
334 if(newMonth > 12) | |
335 newMonth = 12; | |
336 if((newMonth == 2) && (newDay > 29)) | |
337 newDay = 29; | |
338 if((newDay > 30) && ((newMonth == 4) ||(newMonth == 6) ||(newMonth == 9) ||(newMonth == 11))) | |
339 newDay = 30; | |
340 if(newYear < 17) | |
341 newYear = 17; | |
342 if(newYear > 99) | |
343 newYear = 99; | |
344 | |
345 sdatestructure.Date = newDay; | |
346 sdatestructure.Month = newMonth; | |
347 sdatestructure.Year = newYear; | |
348 setWeekday(&sdatestructure); | |
349 | |
350 setDate(sdatestructure); | |
351 | |
352 tMenuEdit_newInput(editId, newDay, newMonth, newYear, 0); | |
353 return UNSPECIFIC_RETURN; | |
354 } | |
720 | 355 if(action == ACTION_BUTTON_NEXT) /* clip values to a specific range e.g. 12 months */ |
38 | 356 { |
357 digitContentNew = digitContent + 1; | |
358 if((blockNumber == 0) && (digitContentNew > '0' + 31)) | |
359 digitContentNew = '1'; | |
360 if((blockNumber == 1) && (digitContentNew > '0' + 12)) | |
361 digitContentNew = '1'; | |
720 | 362 if((blockNumber == 2) && (digitContentNew > '0' + pFirmwareInfo->release_year + 10)) |
363 digitContentNew = '0' + pFirmwareInfo->release_year; | |
38 | 364 return digitContentNew; |
365 } | |
720 | 366 if(action == ACTION_BUTTON_BACK) /* clip values to a specific range e.g. 12 months */ |
38 | 367 { |
368 digitContentNew = digitContent - 1; | |
369 if((blockNumber == 0) && (digitContentNew < '1')) | |
370 digitContentNew = '0' + 31; | |
371 if((blockNumber == 1) && (digitContentNew < '1')) | |
372 digitContentNew = '0' + 12; | |
720 | 373 if((blockNumber == 2) && (digitContentNew < '0' + pFirmwareInfo->release_year)) |
374 digitContentNew = '0' + pFirmwareInfo->release_year + 10; | |
38 | 375 return digitContentNew; |
376 } | |
377 /* | |
378 if(action == ACTION_BUTTON_NEXT) | |
379 { | |
380 digitContentNew = digitContent + 1; | |
381 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew > '2')) | |
382 digitContentNew = '1'; | |
383 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '3')) | |
384 digitContentNew = '0'; | |
385 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '1')) | |
386 digitContentNew = '0'; | |
387 if(digitContentNew > '9') | |
388 digitContentNew = '0'; | |
389 return digitContentNew; | |
390 } | |
391 if(action == ACTION_BUTTON_BACK) | |
392 { | |
393 digitContentNew = digitContent - 1; | |
394 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew < '1')) | |
395 digitContentNew = '2'; | |
396 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
397 digitContentNew = '3'; | |
398 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
399 digitContentNew = '1'; | |
400 if(digitContentNew < '0') | |
401 digitContentNew = '9'; | |
402 return digitContentNew; | |
403 } | |
404 */ | |
405 return UNSPECIFIC_RETURN; | |
406 } | |
407 | |
408 | |
409 uint8_t OnAction_Time(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
410 { | |
411 uint8_t digitContentNew; | |
412 uint32_t newHour, newMinute; | |
413 RTC_TimeTypeDef stimestructure; | |
414 | |
415 if(action == ACTION_BUTTON_ENTER) | |
416 { | |
417 return digitContent; | |
418 } | |
419 if(action == ACTION_BUTTON_ENTER_FINAL) | |
420 { | |
421 evaluateNewString(editId, &newHour, &newMinute, 0, 0); | |
422 if(newHour > 23) | |
423 newHour = 23; | |
424 if(newMinute > 59) | |
425 newMinute = 59; | |
426 | |
427 stimestructure.Hours = newHour; | |
428 stimestructure.Minutes = newMinute; | |
429 stimestructure.Seconds = 0; | |
430 | |
431 setTime(stimestructure); | |
432 | |
433 tMenuEdit_newInput(editId, newHour, newMinute, 0, 0); | |
434 return UNSPECIFIC_RETURN; | |
435 } | |
436 if(action == ACTION_BUTTON_NEXT) | |
437 { | |
438 digitContentNew = digitContent + 1; | |
439 if((blockNumber == 0) && (digitContentNew > '0' + 23)) | |
440 digitContentNew = '0'; | |
441 if((blockNumber == 1) && (digitContentNew > '0' + 59)) | |
442 digitContentNew = '0'; | |
443 return digitContentNew; | |
444 } | |
445 if(action == ACTION_BUTTON_BACK) | |
446 { | |
447 digitContentNew = digitContent - 1; | |
448 if((blockNumber == 0) && (digitContentNew < '0')) | |
449 digitContentNew = '0' + 23; | |
450 if((blockNumber == 1) && (digitContentNew < '0')) | |
451 digitContentNew = '0' + 59; | |
452 return digitContentNew; | |
453 } | |
454 /* | |
455 if(action == ACTION_BUTTON_NEXT) | |
456 { | |
457 digitContentNew = digitContent + 1; | |
458 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '2')) | |
459 digitContentNew = '0'; | |
460 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '5')) | |
461 digitContentNew = '0'; | |
462 if(digitContentNew > '9') | |
463 digitContentNew = '0'; | |
464 return digitContentNew; | |
465 } | |
466 if(action == ACTION_BUTTON_BACK) | |
467 { | |
468 digitContentNew = digitContent - 1; | |
469 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
470 digitContentNew = '2'; | |
471 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
472 digitContentNew = '5'; | |
473 if(digitContentNew < '0') | |
474 digitContentNew = '9'; | |
475 return digitContentNew; | |
476 } | |
477 */ | |
478 return UNSPECIFIC_RETURN; | |
479 } | |
480 | |
567 | 481 uint8_t OnAction_12HR(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
482 { | |
483 SSettings *pSettings; | |
484 | |
485 pSettings = settingsGetPointer(); | |
486 pSettings->amPMTime = !(pSettings->amPMTime); | |
487 | |
488 tMenuEdit_set_on_off(editId, pSettings->amPMTime); | |
489 | |
490 return UNSPECIFIC_RETURN; | |
491 } | |
38 | 492 |
493 uint8_t OnAction_DDMMYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
494 { | |
495 SSettings *pSettings; | |
496 | |
497 pSettings = settingsGetPointer(); | |
498 pSettings->date_format = DDMMYY; | |
499 | |
500 tMenuEdit_set_on_off(editId, 1); | |
501 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
502 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
503 | |
504 return UNSPECIFIC_RETURN; | |
505 } | |
506 | |
507 | |
508 uint8_t OnAction_MMDDYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
509 { | |
510 SSettings *pSettings; | |
511 | |
512 pSettings = settingsGetPointer(); | |
513 pSettings->date_format = MMDDYY; | |
514 | |
515 tMenuEdit_set_on_off(editId, 1); | |
516 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
517 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
518 | |
519 return UNSPECIFIC_RETURN; | |
520 } | |
521 | |
522 | |
523 uint8_t OnAction_YYMMDD(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
524 { | |
525 SSettings *pSettings; | |
526 | |
527 pSettings = settingsGetPointer(); | |
528 pSettings->date_format = YYMMDD; | |
529 | |
530 tMenuEdit_set_on_off(editId, 1); | |
531 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
532 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
533 | |
534 return UNSPECIFIC_RETURN; | |
535 } | |
536 | |
537 | |
538 uint8_t OnAction_DST(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
539 { | |
540 RTC_TimeTypeDef stimestructure; | |
541 uint8_t newDST; | |
542 | |
543 get_RTC_DateTime(0, &stimestructure); | |
544 newDST = stimestructure.DayLightSaving; | |
545 if(newDST) | |
546 newDST = 0; | |
547 else | |
548 newDST = 1; | |
549 stimestructure.DayLightSaving = newDST; | |
550 set_RTC_DateTime(0, &stimestructure); | |
551 | |
552 tMenuEdit_set_on_off(editId, newDST); | |
553 | |
554 return UNSPECIFIC_RETURN; | |
555 } | |
556 | |
557 | |
558 void openEdit_Language(void) | |
559 { | |
560 char text[32]; | |
561 uint8_t actualLanguage, active; | |
562 SSettings *pSettings; | |
563 | |
564 pSettings = settingsGetPointer(); | |
565 actualLanguage = pSettings->selected_language; | |
566 | |
567 text[0] = '\001'; | |
568 text[1] = TXT_Language; | |
569 text[2] = 0; | |
570 write_topline(text); | |
571 | |
572 text[0] = TXT_LanguageName; | |
573 text[1] = 0; | |
574 | |
575 pSettings->selected_language = LANGUAGE_English; | |
576 if( actualLanguage == pSettings->selected_language) | |
577 active = 1; | |
578 else | |
579 active = 0; | |
580 write_field_on_off(StMSYS2_English, 30, 500, ME_Y_LINE1, &FontT48, text, active); | |
581 | |
582 pSettings->selected_language = LANGUAGE_German; | |
583 if( actualLanguage == pSettings->selected_language) | |
584 active = 1; | |
585 else | |
586 active = 0; | |
587 write_field_on_off(StMSYS2_German, 30, 800, ME_Y_LINE2, &FontT48, text, active); | |
588 | |
589 pSettings->selected_language = LANGUAGE_French; | |
590 if( actualLanguage == pSettings->selected_language) | |
591 active = 1; | |
592 else | |
593 active = 0; | |
594 write_field_on_off(StMSYS2_French, 30, 800, ME_Y_LINE3, &FontT48, text, active); | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
595 |
38 | 596 |
597 pSettings->selected_language = LANGUAGE_Italian; | |
598 if( actualLanguage == pSettings->selected_language) | |
599 active = 1; | |
600 else | |
601 active = 0; | |
602 write_field_on_off(StMSYS2_Italian, 30, 800, ME_Y_LINE4, &FontT48, text, active); | |
603 | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
604 |
38 | 605 pSettings->selected_language = LANGUAGE_Espanol; |
606 if( actualLanguage == pSettings->selected_language) | |
607 active = 1; | |
608 else | |
609 active = 0; | |
610 write_field_on_off(StMSYS2_Espanol, 30, 800, ME_Y_LINE5, &FontT48, text, active); | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
611 |
38 | 612 pSettings->selected_language = actualLanguage; |
613 | |
614 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
615 | |
616 setEvent(StMSYS2_English, (uint32_t)OnAction_English); | |
617 setEvent(StMSYS2_German, (uint32_t)OnAction_German); | |
618 setEvent(StMSYS2_French, (uint32_t)OnAction_French); | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
619 setEvent(StMSYS2_Italian, (uint32_t)OnAction_Italian); |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
620 setEvent(StMSYS2_Espanol, (uint32_t)OnAction_Espanol); |
38 | 621 } |
622 | |
623 | |
624 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
625 { | |
626 SSettings *pSettings = settingsGetPointer(); | |
627 pSettings->selected_language = LANGUAGE_English; | |
628 return EXIT_TO_MENU_WITH_LOGO; | |
629 } | |
630 | |
631 | |
632 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
633 { | |
634 SSettings *pSettings = settingsGetPointer(); | |
635 pSettings->selected_language = LANGUAGE_German; | |
636 return EXIT_TO_MENU_WITH_LOGO; | |
637 } | |
638 | |
639 | |
640 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
641 { | |
642 SSettings *pSettings = settingsGetPointer(); | |
643 pSettings->selected_language = LANGUAGE_French; | |
644 return EXIT_TO_MENU_WITH_LOGO; | |
645 } | |
646 | |
647 | |
648 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
649 { | |
650 SSettings *pSettings = settingsGetPointer(); | |
651 pSettings->selected_language = LANGUAGE_Italian; | |
652 return EXIT_TO_MENU_WITH_LOGO; | |
653 } | |
654 | |
655 | |
656 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
657 { | |
658 SSettings *pSettings = settingsGetPointer(); | |
659 pSettings->selected_language = LANGUAGE_Espanol; | |
660 return EXIT_TO_MENU_WITH_LOGO; | |
661 } | |
662 | |
663 | |
664 void openEdit_Design(void) | |
665 { | |
666 refresh_Design(); | |
667 | |
668 write_field_button(StMSYS3_Units, 400, 700, ME_Y_LINE1, &FontT48, ""); | |
669 write_field_button(StMSYS3_Colors, 400, 700, ME_Y_LINE2, &FontT48, ""); | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
670 #ifdef HAVE_DEBUG_VIEW |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
671 write_field_button(StMSYS3_Debug, 400, 700, ME_Y_LINE3, &FontT48, ""); |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
672 #endif |
38 | 673 setEvent(StMSYS3_Units, (uint32_t)OnAction_Units); |
674 setEvent(StMSYS3_Colors, (uint32_t)OnAction_Colorscheme); | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
675 #ifdef HAVE_DEBUG_VIEW |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
676 setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo); |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
677 #endif |
38 | 678 } |
679 | |
680 | |
681 void refresh_Design(void) | |
682 { | |
683 char text[32]; | |
684 | |
685 // header | |
686 text[0] = '\001'; | |
687 text[1] = TXT_2BYTE; | |
688 text[2] = TXT2BYTE_Layout; | |
689 text[3] = 0; | |
690 write_topline(text); | |
691 | |
692 // units | |
693 text[0] = TXT_2BYTE; | |
694 text[1] = TXT2BYTE_Units; | |
695 text[2] = 0; | |
696 write_label_var( 30, 200, ME_Y_LINE1, &FontT48, text); | |
697 | |
698 if(settingsGetPointer()->nonMetricalSystem) | |
699 { | |
700 text[1] = TXT2BYTE_Units_feet; | |
701 } | |
702 else | |
703 { | |
704 text[1] = TXT2BYTE_Units_metric; | |
705 } | |
706 write_label_var( 400, 700, ME_Y_LINE1, &FontT48, text); | |
707 | |
708 // colorscheme | |
709 text[0] = TXT_2BYTE; | |
710 text[1] = TXT2BYTE_Farbschema; | |
711 text[2] = 0; | |
118
ee7f2cd9b9b4
Enlarge text limits to get string displayed completly
Ideenmodellierer
parents:
103
diff
changeset
|
712 write_label_var( 30, 300, ME_Y_LINE2, &FontT48, text); |
38 | 713 |
714 text[0] = '0' + settingsGetPointer()->tX_colorscheme; | |
715 text[1] = 0; | |
716 write_label_var( 400, 700, ME_Y_LINE2, &FontT48, text); | |
717 | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
718 #ifdef HAVE_DEBUG_VIEW |
38 | 719 // specials |
720 text[0] = TXT_2BYTE; | |
721 text[1] = TXT2BYTE_ShowDebug; | |
722 text[2] = 0; | |
723 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
724 | |
725 if(settingsGetPointer()->showDebugInfo) | |
726 text[0] = '\005'; | |
727 else | |
728 text[0] = '\006'; | |
729 text[1] = 0; | |
730 write_label_var( 400, 700, ME_Y_LINE3, &FontT48, text); | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
731 #endif |
38 | 732 |
733 // design | |
734 text[0] = TXT_Depth; | |
735 text[1] = 0; | |
736 write_content( 30, 700, ME_Y_LINE4, &FontT24, text, CLUT_Font031); | |
737 write_content( 30, 700, ME_Y_LINE4 + 30 + 70, &FontT48, "___________", CLUT_DIVE_FieldSeperatorLines); | |
738 write_content(280, 700, ME_Y_LINE4 + 30 + 70 - 3, &FontT48, "|", CLUT_DIVE_pluginbox); | |
739 write_content(290, 700, ME_Y_LINE4 + 30 + 70 - 37, &FontT48, "_______________", CLUT_DIVE_pluginbox); | |
740 write_content( 30, 700, ME_Y_LINE4 + 30, &FontT144, "24.7", CLUT_Font027); | |
741 | |
742 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
743 } | |
744 | |
745 | |
746 uint8_t OnAction_Units(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
747 { | |
748 settingsGetPointer()->nonMetricalSystem = !(settingsGetPointer()->nonMetricalSystem); | |
749 return EXIT_TO_MENU_WITH_LOGO;//UPDATE_DIVESETTINGS; | |
750 } | |
751 | |
752 | |
753 uint8_t OnAction_Colorscheme(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
754 { | |
755 uint8_t newColorscheme; | |
756 | |
757 newColorscheme = settingsGetPointer()->tX_colorscheme + 1; | |
758 | |
759 if(newColorscheme > 3) | |
760 newColorscheme = 0; | |
761 | |
762 settingsGetPointer()->tX_colorscheme = newColorscheme; | |
763 GFX_use_colorscheme(newColorscheme); | |
764 tHome_init_compass(); | |
765 return UNSPECIFIC_RETURN; | |
766 } | |
767 | |
768 | |
769 uint8_t OnAction_DebugInfo(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
770 { | |
771 settingsGetPointer()->showDebugInfo = !(settingsGetPointer()->showDebugInfo); | |
772 return UPDATE_DIVESETTINGS; | |
773 } | |
774 | |
775 | |
776 | |
777 | |
778 /* | |
779 uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
780 { | |
781 SSettings *pSettings = settingsGetPointer(); | |
782 if((pSettings->design == 7) && pSettings->nonMetricalSystem) | |
783 return EXIT_TO_MENU; | |
784 pSettings->design = 7; | |
785 pSettings->nonMetricalSystem = 1; | |
786 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
787 tMenuEdit_set_on_off(StMSYS3_t7ft, 1); | |
788 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
789 return UPDATE_DIVESETTINGS; | |
790 } | |
791 | |
792 | |
793 uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
794 { | |
795 SSettings *pSettings = settingsGetPointer(); | |
796 if((pSettings->design == 7) && (pSettings->nonMetricalSystem == 0)) | |
797 return EXIT_TO_MENU; | |
798 pSettings->design = 7; | |
799 pSettings->nonMetricalSystem = 0; | |
800 tMenuEdit_set_on_off(StMSYS3_t7, 1); | |
801 tMenuEdit_set_on_off(StMSYS3_t7ft, 0); | |
802 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
803 return UPDATE_DIVESETTINGS; | |
804 } | |
805 | |
806 | |
807 uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
808 { | |
809 SSettings *pSettings = settingsGetPointer(); | |
810 if(pSettings->design == 3) | |
811 return EXIT_TO_MENU; | |
812 pSettings->design = 3; | |
813 pSettings->nonMetricalSystem = 0; | |
814 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
815 tMenuEdit_set_on_off(StMSYS3_t7ft,0); | |
816 tMenuEdit_set_on_off(StMSYS3_t3, 1); | |
817 return UPDATE_DIVESETTINGS; | |
818 } | |
819 */ | |
820 | |
821 | |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
259
diff
changeset
|
822 |
38 | 823 void openEdit_Information(void) |
824 { | |
825 char text[70]; | |
826 | |
827 infoPage = 0; | |
828 | |
829 text[0] = '\001'; | |
830 text[1] = TXT_Information; | |
831 text[2] = 0; | |
832 write_topline(text); | |
833 | |
834 text[0] = TXT_2BYTE; | |
835 text[1] = TXT2BYTE_ButtonNext; | |
836 text[2] = 0; | |
837 | |
520 | 838 write_field_button(StMSYS4_Info, 30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 839 |
520 | 840 setEvent(StMSYS4_Info, (uint32_t)OnAction_Information); |
38 | 841 } |
842 | |
843 | |
844 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
845 { | |
846 resetEnterPressedToStateBeforeButtonAction(); | |
847 | |
848 infoPage++; | |
849 if(infoPage > 3) | |
850 return EXIT_TO_MENU; | |
851 else | |
852 return UNSPECIFIC_RETURN; | |
853 } | |
854 | |
855 | |
856 void refresh_InformationPage(void) | |
857 { | |
858 char text_header[5]; | |
859 char text_button[5]; | |
860 char text_content[256]; | |
861 uint8_t date[3], year,month,day; | |
862 | |
863 RTC_DateTypeDef Sdate, Sdate2; | |
864 float temperature1, temperature2, voltage, offsetTemperature; | |
865 | |
866 //RTC_TimeTypeDef Stime; | |
867 | |
868 /* | |
869 SDeviceLine batteryChargeCycles; | |
870 SDeviceLine batteryChargeCompleteCycles; | |
871 SDeviceLine temperatureMinimum; | |
872 SDeviceLine temperatureMaximum; | |
873 SDeviceLine depthMaximum; | |
874 SDeviceLine diveCycles; | |
875 SDeviceLine voltageMinimum; | |
876 */ | |
877 | |
878 switch(infoPage) | |
879 { | |
880 case 0: | |
881 text_header[0] = '\001'; | |
882 text_header[1] = TXT_Information; | |
883 text_header[2] = 0; | |
884 | |
885 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, "Dive Computer OSTC4"); | |
886 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, "Design heinrichs/weikamp"); | |
887 | |
888 Sdate.Year = firmwareDataGetPointer()->release_year; | |
889 Sdate.Month = firmwareDataGetPointer()->release_month; | |
890 Sdate.Date = firmwareDataGetPointer()->release_day; | |
891 | |
892 if(settingsGetPointer()->date_format == DDMMYY) | |
893 { | |
894 day = 0; | |
895 month = 1; | |
896 year = 2; | |
897 } | |
898 else | |
899 if(settingsGetPointer()->date_format == MMDDYY) | |
900 { | |
901 day = 1; | |
902 month = 0; | |
903 year = 2; | |
904 } | |
905 else | |
906 { | |
907 day = 2; | |
908 month = 1; | |
909 year = 0; | |
910 } | |
911 date[day] = Sdate.Date; | |
912 date[month] = Sdate.Month; | |
913 date[year] = Sdate.Year; | |
914 snprintf(text_content,40,"Firmware release date: %02d.%02d.%02d",date[0],date[1],date[2]); | |
915 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
916 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, "for more information"); | |
64 | 917 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, "info@heinrichsweikamp.com"); |
38 | 918 |
919 text_button[0] = TXT_2BYTE; | |
920 text_button[1] = TXT2BYTE_ButtonNext; | |
921 text_button[2] = 0; | |
922 break; | |
923 | |
924 case 1: | |
925 text_header[0] = '\001'; | |
926 text_header[1] = TXT_2BYTE; | |
927 text_header[2] = TXT2BYTE_Usage_Battery; | |
928 text_header[3] = 0; | |
929 | |
930 text_content[0] = TXT_2BYTE; | |
931 text_content[1] = TXT2BYTE_ChargeCycles; | |
932 text_content[2] = 0; | |
933 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
646
0fc1b47d2482
Remove battery charge counter from information menu:
Ideenmodellierer
parents:
567
diff
changeset
|
934 /* snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->batteryChargeCycles.value_int32,stateDeviceGetPointer()->batteryChargeCompleteCycles.value_int32); |
0fc1b47d2482
Remove battery charge counter from information menu:
Ideenmodellierer
parents:
567
diff
changeset
|
935 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); */ |
38 | 936 |
937 translateDate(stateDeviceGetPointer()->batteryChargeCycles.date_rtc_dr, &Sdate); | |
938 translateDate(stateDeviceGetPointer()->batteryChargeCompleteCycles.date_rtc_dr, &Sdate2); | |
939 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
646
0fc1b47d2482
Remove battery charge counter from information menu:
Ideenmodellierer
parents:
567
diff
changeset
|
940 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
38 | 941 |
942 text_content[0] = TXT_2BYTE; | |
943 text_content[1] = TXT2BYTE_LowestVoltage; | |
944 text_content[2] = 0; | |
945 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
946 | |
404
e729b8e7654d
Bugfix: display of time of minimum voltag:
ideenmodellierer
parents:
389
diff
changeset
|
947 translateDate(stateDeviceGetPointer()->voltageMinimum.date_rtc_dr, &Sdate); |
38 | 948 voltage = ((float)stateDeviceGetPointer()->voltageMinimum.value_int32) / 1000; |
949 snprintf(text_content,80,"%0.3fV (%u.%u.20%02u)",voltage, Sdate.Date,Sdate.Month,Sdate.Year); | |
950 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); | |
951 | |
952 text_button[0] = TXT_2BYTE; | |
953 text_button[1] = TXT2BYTE_ButtonNext; | |
954 text_button[2] = 0; | |
955 break; | |
956 | |
957 case 2: | |
958 text_header[0] = '\001'; | |
959 text_header[1] = TXT_2BYTE; | |
960 text_header[2] = TXT2BYTE_Usage_Dives; | |
961 text_header[3] = 0; | |
962 | |
963 text_content[0] = TXT_2BYTE; | |
964 text_content[1] = TXT2BYTE_NumberOfDives; | |
965 text_content[2] = 0; | |
966 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
967 | |
57 | 968 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->diveCycles.value_int32,(stateDeviceGetPointer()->depthMaximum.value_int32 - 1000) / 100); |
38 | 969 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
970 | |
971 translateDate(stateDeviceGetPointer()->diveCycles.date_rtc_dr, &Sdate); | |
972 translateDate(stateDeviceGetPointer()->depthMaximum.date_rtc_dr, &Sdate2); | |
973 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
974 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
975 | |
976 text_content[0] = TXT_2BYTE; | |
977 text_content[1] = TXT2BYTE_HoursOfOperation; | |
978 text_content[2] = 0; | |
979 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
980 | |
57 | 981 snprintf(text_content,80,"%ld",(stateDeviceGetPointer()->hoursOfOperation.value_int32)/3600); |
38 | 982 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
983 | |
984 text_button[0] = TXT_2BYTE; | |
985 text_button[1] = TXT2BYTE_ButtonNext; | |
986 text_button[2] = 0; | |
987 break; | |
988 | |
989 case 3: | |
990 text_header[0] = '\001'; | |
991 text_header[1] = TXT_2BYTE; | |
992 text_header[2] = TXT2BYTE_Usage_Environment; | |
993 text_header[3] = 0; | |
994 | |
995 text_content[0] = TXT_2BYTE; | |
996 text_content[1] = TXT2BYTE_AmbientTemperature; | |
997 text_content[2] = 0; | |
998 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
999 | |
1000 temperature1 = ((float)stateDeviceGetPointer()->temperatureMinimum.value_int32) / 100; | |
1001 temperature2 = ((float)stateDeviceGetPointer()->temperatureMaximum.value_int32) / 100; | |
1002 snprintf(text_content,80,"%0.2f\140C / %0.2f\140C",temperature1,temperature2); | |
1003 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); | |
1004 | |
1005 translateDate(stateDeviceGetPointer()->temperatureMinimum.date_rtc_dr, &Sdate); | |
1006 translateDate(stateDeviceGetPointer()->temperatureMaximum.date_rtc_dr, &Sdate2); | |
1007 snprintf(text_content,80,"(%u.%u.20%02u / %u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1008 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1009 | |
1010 text_content[0] = TXT_2BYTE; | |
1011 text_content[1] = TXT2BYTE_Korrekturwerte; | |
1012 text_content[2] = 0; | |
1013 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1014 | |
1015 offsetTemperature = ((float)settingsGetPointer()->offsetTemperature_centigrad) / 10; | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1016 snprintf(text_content,80,"%i %s / %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, TEXT_PRESSURE_UNIT, offsetTemperature); |
38 | 1017 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1018 | |
1019 text_button[0] = TXT_2BYTE; | |
1020 text_button[1] = TXT2BYTE_Exit; | |
1021 text_button[2] = 0; | |
1022 break; | |
1023 } | |
1024 | |
1025 write_topline(text_header); | |
520 | 1026 tMenuEdit_newButtonText(StMSYS4_Info, text_button); |
38 | 1027 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonNext,0); |
1028 } | |
1029 | |
1030 | |
1031 void openEdit_Reset(void) | |
1032 { | |
1033 char text[32]; | |
1034 | |
1035 text[0] = '\001'; | |
1036 text[1] = TXT_2BYTE; | |
1037 text[2] = TXT2BYTE_ResetMenu; | |
1038 text[3] = 0; | |
1039 write_topline(text); | |
1040 | |
1041 text[0] = TXT_2BYTE; | |
1042 text[1] = TXT2BYTE_LogbookOffset; | |
1043 text[7] = 0; | |
1044 | |
1045 write_label_var( 30, 400, ME_Y_LINE1, &FontT48, text); | |
1046 | |
520 | 1047 write_field_udigit(StMSYS5_LogbookOffset,420, 800, ME_Y_LINE1, &FontT48, "####", settingsGetPointer()->logbookOffset,0,0,0); |
38 | 1048 |
1049 text[0] = TXT_2BYTE; | |
1050 text[2] = 0; | |
1051 | |
1052 text[1] = TXT2BYTE_ResetAll; | |
520 | 1053 write_field_button(StMSYS5_ResetAll, 30, 800, ME_Y_LINE2, &FontT48, text); |
38 | 1054 |
1055 text[1] = TXT2BYTE_ResetDeco; | |
520 | 1056 write_field_button(StMSYS5_ResetDeco, 30, 800, ME_Y_LINE3, &FontT48, text); |
38 | 1057 |
1058 text[1] = TXT2BYTE_Reboot; | |
520 | 1059 write_field_button(StMSYS5_Reboot, 30, 800, ME_Y_LINE4, &FontT48, text); |
38 | 1060 |
1061 text[1] = TXT2BYTE_Maintenance; | |
520 | 1062 write_field_button(StMSYS5_Maintenance, 30, 800, ME_Y_LINE5, &FontT48, text); |
38 | 1063 |
1064 #ifndef RESETLOGBLOCK | |
1065 text[1] = TXT2BYTE_ResetLogbook; | |
520 | 1066 write_field_button(StMSYS5_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 1067 #else |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
520
diff
changeset
|
1068 text[0] = '\031'; |
38 | 1069 text[1] = TXT_2BYTE; |
1070 text[2] = TXT2BYTE_ResetLogbook; | |
1071 text[3] = 0; | |
520 | 1072 write_field_button(StMSYS5_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 1073 text[0] = TXT_2BYTE; |
1074 text[2] = 0; | |
1075 #endif | |
1076 | |
520 | 1077 setEvent(StMSYS5_LogbookOffset, (uint32_t)OnAction_LogbookOffset); |
1078 setEvent(StMSYS5_ResetAll, (uint32_t)OnAction_Confirm); | |
1079 setEvent(StMSYS5_ResetDeco, (uint32_t)OnAction_Confirm); | |
1080 setEvent(StMSYS5_Reboot, (uint32_t)OnAction_Confirm); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1081 setEvent(StMSYS5_Maintenance, (uint32_t)OnAction_Maintenance); |
38 | 1082 #ifndef RESETLOGBLOCK |
520 | 1083 setEvent(StMSYS5_ResetLogbook, (uint32_t)OnAction_Confirm); |
38 | 1084 #else |
520 | 1085 setEvent(StMSYS5_ResetLogbook, (uint32_t)OnAction_Nothing); |
38 | 1086 #endif |
1087 | |
1088 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1089 } | |
1090 | |
1091 | |
1092 void openEdit_ResetConfirmation(uint32_t editIdOfCaller) | |
1093 { | |
1094 char text[32]; | |
1095 | |
1096 resetMenuEdit(CLUT_MenuPageSystem); | |
1097 | |
1098 text[0] = '\001'; | |
1099 text[1] = TXT_2BYTE; | |
1100 text[2] = TXT2BYTE_AreYouSure; | |
1101 text[3] = 0; | |
1102 write_topline(text); | |
1103 | |
1104 text[0] = TXT_2BYTE; | |
1105 text[2] = 0; | |
1106 text[1] = TXT2BYTE_Abort; | |
1107 | |
520 | 1108 write_field_button(StMSYS5_Exit, 30, 800, ME_Y_LINE1, &FontT48, text); |
38 | 1109 |
1110 text[2] = 0; | |
1111 text[3] = 0; | |
1112 switch(editIdOfCaller) | |
1113 { | |
520 | 1114 case StMSYS5_Reboot: |
1115 case StMSYS5_RebootRTE: | |
1116 case StMSYS5_RebootMainCPU: | |
38 | 1117 text[1] = TXT2BYTE_RebootMainCPU; |
520 | 1118 write_field_button(StMSYS5_RebootMainCPU, 30, 800, ME_Y_LINE2, &FontT48, text); |
38 | 1119 text[1] = TXT2BYTE_RebootRTE; |
520 | 1120 write_field_button(StMSYS5_RebootRTE, 30, 800, ME_Y_LINE3, &FontT48, text); |
1121 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); | |
1122 setEvent(StMSYS5_RebootMainCPU, (uint32_t)OnAction_RebootMainCPU); | |
1123 setEvent(StMSYS5_RebootRTE, (uint32_t)OnAction_RebootRTE); | |
38 | 1124 text[0] = '\025'; |
1125 text[1] = TXT_2BYTE; | |
1126 text[2] = TXT2BYTE_DecoDataLost; | |
1127 text[3] = 0; | |
1128 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1129 break; | |
1130 | |
520 | 1131 case StMSYS5_ResetDeco: |
38 | 1132 text[1] = TXT2BYTE_ResetDeco; |
1133 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1134 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1135 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetDeco); |
1136 text[0] = '\025'; | |
1137 text[1] = TXT_2BYTE; | |
1138 text[2] = TXT2BYTE_DecoDataLost; | |
1139 text[3] = 0; | |
1140 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1141 break; | |
1142 | |
520 | 1143 case StMSYS5_ResetAll: |
38 | 1144 text[1] = TXT2BYTE_ResetAll; |
1145 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1146 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1147 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetAll); |
1148 break; | |
1149 | |
520 | 1150 case StMSYS5_ResetLogbook: |
38 | 1151 text[1] = TXT2BYTE_ResetLogbook; |
1152 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1153 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1154 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); |
1155 break; | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1156 } |
38 | 1157 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1158 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1159 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1160 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1161 void openEdit_Maintenance(void) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1162 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1163 char text[32]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1164 unsigned char index = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1165 SSettings *pSettings = settingsGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1166 SSensorDataDiveO2* pDiveO2Data = NULL; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1167 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1168 resetMenuEdit(CLUT_MenuPageSystem); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1169 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1170 text[0] = '\001'; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1171 text[1] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1172 text[2] = TXT2BYTE_Maintenance; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1173 text[3] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1174 write_topline(text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1175 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1176 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1177 text[1] = TXT2BYTE_SetFactoryDefaults; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1178 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1179 write_field_button(StMSYS5_SetFactoryBC, 30, 800, ME_Y_LINE1, &FontT48, text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1180 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1181 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1182 if(stateRealGetPointer()->lifeData.battery_charge <= 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1183 { |
38 | 1184 text[0] = TXT_2BYTE; |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1185 text[1] = TXT2BYTE_SetBatteryCharge; |
38 | 1186 text[2] = 0; |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1187 snprintf(&text[2],10,": %u%%",pSettings->lastKnownBatteryPercentage); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1188 write_field_button(StMSYS5_SetBattCharge, 30, 800, ME_Y_LINE2, &FontT48, text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1189 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1190 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1191 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL)) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1192 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1193 for (index = 0; index < 3; index++) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1194 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1195 if(pSettings->ext_sensor_map[index] == SENSOR_DIGO2M) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1196 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1197 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1198 if(pDiveO2Data->pressure != 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1199 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1200 snprintf(text,32,"%c%c (%1.3lf => %1.3f)\016\016Bar",TXT_2BYTE,TXT2BYTE_AdjustAmbPressure,(float)(pDiveO2Data->pressure/1000000.0), |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1201 stateRealGetPointer()->lifeData.pressure_surface_bar); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1202 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1203 write_field_button(StMSYS5_AdjustSurfPres, 30, 800, ME_Y_LINE4, &FontT48, text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1204 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1205 break; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1206 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1207 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1208 } |
38 | 1209 |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1210 #ifdef ENABLE_ANALYSE_SAMPLES |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1211 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1212 text[1] = TXT2BYTE_SetSampleIndex; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1213 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1214 write_field_button(StMSYS5_SetSampleIndx, 30, 800, ME_Y_LINE4, &FontT48, text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1215 #endif |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1216 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1217 setEvent(StMSYS5_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1218 if(stateRealGetPointer()->lifeData.battery_charge <= 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1219 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1220 setEvent(StMSYS5_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1221 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1222 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL)) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1223 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1224 if(pDiveO2Data != NULL) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1225 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1226 setEvent(StMSYS5_AdjustSurfPres, (uint32_t)OnAction_AdjustSurfacePressure); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1227 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1228 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1229 #ifdef ENABLE_ANALYSE_SAMPLES |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1230 setEvent(StMSYS5_SetSampleIndx, (uint32_t)OnAction_RecoverSampleIdx); |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1231 #endif |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1232 |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1233 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1234 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1235 text[1] = TXT2BYTE_WarnBatteryLow; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1236 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1237 snprintf(&text[2],10,": %01.2fV",stateRealGetPointer()->lifeData.battery_voltage); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1238 write_label_var( 30, 800, ME_Y_LINE5, &FontT42, text); |
38 | 1239 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1240 snprintf(&text[0],30,"Code: %X",getLicence()); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1241 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); |
38 | 1242 |
1243 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1244 } | |
1245 | |
1246 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1247 { | |
1248 uint8_t digitContentNew; | |
1249 uint32_t newOffset; | |
1250 | |
1251 if(action == ACTION_BUTTON_ENTER) | |
1252 return digitContent; | |
1253 | |
1254 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1255 { | |
1256 evaluateNewString(editId, &newOffset, 0, 0, 0); | |
1257 if(newOffset > 9000) | |
1258 newOffset = 0; | |
1259 tMenuEdit_newInput(editId, newOffset, 0, 0, 0); | |
1260 settingsGetPointer()->logbookOffset = (uint16_t)newOffset; | |
1261 return UPDATE_DIVESETTINGS; | |
1262 } | |
1263 | |
1264 if(action == ACTION_BUTTON_NEXT) | |
1265 { | |
1266 digitContentNew = digitContent + 1; | |
1267 if(digitContentNew > '9') | |
1268 digitContentNew = '0'; | |
1269 return digitContentNew; | |
1270 } | |
1271 | |
1272 if(action == ACTION_BUTTON_BACK) | |
1273 { | |
1274 digitContentNew = digitContent - 1; | |
1275 if(digitContentNew < '0') | |
1276 digitContentNew = '9'; | |
1277 return digitContentNew; | |
1278 } | |
1279 return UNSPECIFIC_RETURN; | |
1280 } | |
1281 | |
1282 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1283 { | |
1284 return UNSPECIFIC_RETURN; | |
1285 } | |
1286 | |
1287 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1288 { | |
1289 return EXIT_TO_MENU; | |
1290 } | |
1291 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1292 { | |
1293 openEdit_ResetConfirmation(editId); | |
1294 return UNSPECIFIC_RETURN; | |
1295 } | |
1296 | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1297 uint8_t OnAction_Maintenance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1298 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1299 openEdit_Maintenance(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1300 return UNSPECIFIC_RETURN; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1301 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1302 |
38 | 1303 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
1304 { | |
1305 MX_SmallCPU_Reset_To_Standard(); | |
1306 return EXIT_TO_MENU; | |
1307 } | |
1308 | |
1309 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1310 { | |
1311 clearDeco(); | |
1312 return EXIT_TO_MENU; | |
1313 } | |
1314 | |
1315 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1316 { | |
1317 set_settings_to_Standard(); | |
1318 check_and_correct_settings(); | |
1319 | |
1320 return UPDATE_AND_EXIT_TO_HOME; | |
1321 } | |
1322 | |
1323 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1324 { | |
1325 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1326 ext_flash_erase_logbook(); | |
1327 | |
1328 SSettings * pSettings = settingsGetPointer(); | |
1329 pSettings->lastDiveLogId = 255; | |
1330 pSettings->logFlashNextSampleStartAddress = 0; | |
1331 | |
1332 return EXIT_TO_MENU; | |
1333 } | |
1334 | |
1335 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1336 { | |
1337 settingsGetPointer()->showDebugInfo = 0; | |
1338 extern uint8_t bootToBootloader; | |
1339 bootToBootloader = 1; | |
1340 return UNSPECIFIC_RETURN; | |
1341 } | |
1342 | |
1343 | |
1344 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1345 { | |
1346 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
1347 return EXIT_TO_MENU; | |
1348 } | |
1349 | |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
1350 #ifdef ENABLE_ANALYSE_SAMPLES |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1351 uint8_t OnAction_RecoverSampleIdx(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1352 { |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1353 char text[32]; |
558
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1354 uint8_t openSec; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1355 uint8_t retval = UNSPECIFIC_RETURN; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1356 openSec = ext_flash_AnalyseSampleBuffer(); |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1357 snprintf(&text[0],30,"OpenSec: %d",openSec); |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1358 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1359 |
558
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1360 if(openSec == 2) |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1361 { |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1362 retval = UPDATE_DIVESETTINGS; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1363 } |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1364 return retval; |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1365 } |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
1366 #endif |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1367 |
38 | 1368 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
1369 { | |
1370 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); | |
1371 // setBatteryPercentage(100); | |
1372 return EXIT_TO_MENU; | |
1373 } | |
1374 | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1375 uint8_t OnAction_AdjustSurfacePressure (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1376 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1377 SSensorDataDiveO2* pDiveO2Data; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1378 const SDiveState* pDiveState = stateRealGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1379 SSettings* pSettings = settingsGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1380 uint8_t index = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1381 int8_t newOffset = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1382 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1383 char text[32]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1384 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1385 float orgpressure_surface; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1386 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1387 for (index = 0; index < 3; index++) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1388 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1389 if(settingsGetPointer()->ext_sensor_map[index] == SENSOR_DIGO2M) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1390 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1391 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1392 orgpressure_surface = pDiveState->lifeData.pressure_surface_bar - (settingsGetPointer()->offsetPressure_mbar / 1000.0); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1393 newOffset = ((pDiveO2Data->pressure/1000) - (orgpressure_surface * 1000)); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1394 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1395 if((pDiveState->lifeData.pressure_surface_bar * 1000 + newOffset) != (pDiveO2Data->pressure/1000)) /* there might be a rounding difference => compensate */ |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1396 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1397 newOffset += (pDiveO2Data->pressure/1000) - (pDiveState->lifeData.pressure_surface_bar * 1000 + newOffset); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1398 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1399 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1400 pSettings->offsetPressure_mbar = newOffset; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1401 snprintf(text,32,"%c%c (%1.3lf => %1.3f)\016\016Bar",TXT_2BYTE,TXT2BYTE_AdjustAmbPressure,(float)(pDiveO2Data->pressure/1000000.0), |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1402 pDiveState->lifeData.pressure_surface_bar + pSettings->offsetPressure_mbar / 1000.0); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1403 tMenuEdit_newButtonText(StMSYS5_AdjustSurfPres,text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1404 break; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1405 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1406 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1407 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1408 return UNSPECIFIC_RETURN; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1409 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1410 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1411 |
38 | 1412 #ifdef SCREENTEST |
1413 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1414 { | |
1415 static uint8_t FrameCount = 1; // 0 is invisible frame | |
1416 char text[5]; | |
1417 GFX_DrawCfgScreen tTestScreen; | |
1418 tTestScreen.FBStartAdress = 0; | |
1419 tTestScreen.ImageHeight = 480; | |
1420 tTestScreen.ImageWidth = 800; | |
1421 tTestScreen.LayerIndex = 1; | |
1422 | |
520 | 1423 set_globalState(StMSYS5_ScreenTest); |
38 | 1424 tTestScreen.FBStartAdress = getFrameByNumber(FrameCount); |
1425 if(tTestScreen.FBStartAdress == 0) | |
1426 { | |
1427 extern uint8_t bootToBootloader; | |
1428 bootToBootloader = 1; | |
1429 } | |
1430 GFX_fill_buffer(tTestScreen.FBStartAdress, 0xFF, FrameCount); | |
1431 snprintf(text,5,"%u",FrameCount); | |
1432 Gfx_write_label_var(&tTestScreen, 10,100,10,&FontT48,CLUT_Font027,text); | |
1433 GFX_SetFramesTopBottom(tTestScreen.FBStartAdress, NULL,480); | |
1434 FrameCount++; | |
1435 } | |
1436 #endif | |
1437 /* | |
1438 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1439 { | |
1440 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1441 | |
1442 test_log_only(20, 5); | |
1443 test_log_only(30, 10); | |
1444 ext_flash_write_settings(); | |
1445 return EXIT_TO_MENU; | |
1446 } | |
1447 */ | |
1448 |