Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSystem.c @ 960:a8c0e6d07b8e Evo_2_23 tip
Minor: fix some typos in the bootloader code
author | heinrichsweikamp |
---|---|
date | Sat, 11 Jan 2025 17:12:39 +0100 |
parents | 5d5fa0a3b409 |
children |
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" |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
44 #include "math.h" |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
45 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
468
diff
changeset
|
46 |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
47 /*#define HAVE_DEBUG_VIEW */ |
379 | 48 static uint8_t infoPage = 0; |
38 | 49 |
50 /* Private function prototypes -----------------------------------------------*/ | |
51 void openEdit_DateTime(void); | |
944 | 52 void openEdit_DateFormat(void); |
38 | 53 void openEdit_Language(void); |
54 void openEdit_Design(void); | |
55 void openEdit_Information(void); | |
56 void openEdit_Reset(void); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
57 void openEdit_Maintenance(void); |
38 | 58 //void openEdit_ShowDebugInfo(void); |
59 //void openEdit_Salinity(void); | |
60 | |
61 /* Announced function prototypes -----------------------------------------------*/ | |
62 uint8_t OnAction_Date (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
63 uint8_t OnAction_Time (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
567 | 64 uint8_t OnAction_12HR (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
944 | 65 uint8_t OnAction_Format (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 66 uint8_t OnAction_DDMMYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
67 uint8_t OnAction_MMDDYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 uint8_t OnAction_YYMMDD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
69 uint8_t OnAction_DST (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
949 | 70 uint8_t OnAction_UTC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
71 uint8_t OnAction_SetGnss (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
38 | 72 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
73 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
74 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
75 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
76 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
77 //uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
78 //uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
79 //uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
80 | |
81 uint8_t OnAction_Units (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
82 uint8_t OnAction_Colorscheme (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
83 uint8_t OnAction_DebugInfo (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
84 | |
85 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
86 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
|
87 uint8_t OnAction_Maintenance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 88 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
89 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
90 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
91 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
92 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
93 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
94 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
95 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
96 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
|
97 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
|
98 #ifdef ENABLE_ANALYSE_SAMPLES |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
99 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
|
100 #endif |
38 | 101 #ifdef SCREENTEST |
102 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
103 #endif | |
104 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
105 /* | |
106 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
107 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
108 */ | |
109 | |
110 /* Exported functions --------------------------------------------------------*/ | |
111 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
112 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
|
113 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
114 SSettings *settings = settingsGetPointer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
115 uint8_t digitContentNew; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
116 switch (action) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
117 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
|
118 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
119 return digitContent; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
120 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
|
121 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
122 uint32_t timerM; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
123 uint32_t timerS; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
124 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
|
125 if (timerM > 9) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
126 timerM = 9; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
127 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
128 if (timerS > 59) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
129 timerS = 59; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
130 } |
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 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
|
133 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
134 if (timerDurationS < 1) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
135 timerDurationS = 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
136 } |
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 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
|
139 settings->timerDurationS = timerDurationS; |
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 disableTimer(); |
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 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
|
144 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
145 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
146 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
|
147 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
148 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
|
149 digitContentNew = digitContent + 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
150 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
|
151 digitContentNew = '0'; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
152 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
153 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
154 return digitContentNew; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
155 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
|
156 digitContentNew = digitContent - 1; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
157 if (digitContentNew < '0') { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
158 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
|
159 digitContentNew = '5'; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
160 } else { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
161 digitContentNew = '9'; |
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 } |
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 return digitContentNew; |
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 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
168 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
|
169 } |
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 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
172 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
|
173 { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
174 SSettings *settings = settingsGetPointer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
175 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
176 char text[32]; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
177 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
|
178 write_topline(text); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
179 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
186 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
|
187 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
188 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
|
189 startEdit(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
190 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
191 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
192 |
38 | 193 void openEdit_System(uint8_t line) |
194 { | |
195 set_globalState_Menu_Line(line); | |
196 resetMenuEdit(CLUT_MenuPageSystem); | |
197 | |
198 if(actual_menu_content == MENU_SURFACE) | |
199 { | |
200 switch(line) | |
201 { | |
202 case 1: | |
203 default: | |
204 openEdit_DateTime(); | |
205 break; | |
206 case 2: | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
207 openEdit_Timer(); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
208 break; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
209 case 3: |
38 | 210 openEdit_Language(); |
211 break; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
212 case 4: |
38 | 213 openEdit_Design(); |
214 break; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
215 case 5: |
520 | 216 openEdit_Information(); |
38 | 217 break; |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
730
diff
changeset
|
218 case 6: |
38 | 219 openEdit_Reset(); |
220 break; | |
221 /* | |
222 case 3: | |
223 openEdit_DecoFutureTTS(); | |
224 break; | |
225 case 4: | |
226 openEdit_DecoLastStop(); | |
227 break; | |
228 */ | |
229 } | |
230 } | |
231 else | |
232 { | |
520 | 233 openEdit_CustomviewDivemodeMenu(line); |
38 | 234 } |
235 | |
236 } | |
237 | |
238 /* Private functions ---------------------------------------------------------*/ | |
239 | |
240 | |
949 | 241 void refresh_DateTime() |
242 { | |
243 RTC_DateTypeDef Sdate; | |
244 RTC_TimeTypeDef Stime; | |
245 uint8_t day,month,year,hour,minute; | |
246 char text[32]; | |
247 char formatStr[20]; | |
248 SSettings *pSettings; | |
249 const SFirmwareData *pFirmwareInfo; | |
250 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 | |
251 uint8_t localHours = 0; | |
252 uint8_t localMinutes = 0; | |
253 #endif | |
254 pFirmwareInfo = firmwareDataGetPointer(); | |
255 const SDiveState * pStateReal = stateRealGetPointer(); | |
256 | |
257 pSettings = settingsGetPointer(); | |
258 | |
259 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
260 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
261 year = Sdate.Year; | |
262 month = Sdate.Month; | |
263 day = Sdate.Date; | |
264 hour = Stime.Hours; | |
265 minute= Stime.Minutes; | |
266 | |
267 if(year < pFirmwareInfo->release_year) | |
268 year = pFirmwareInfo->release_year; | |
269 | |
270 if(month < 1) | |
271 month = 1; | |
272 | |
273 if(day < 1) | |
274 day = 1; | |
275 | |
276 getStringOfFormat_DDMMYY(formatStr, 20); | |
277 | |
278 text[0] = '\001'; | |
279 text[1] = TXT_DateAndTime; | |
280 text[2] = 0; | |
281 | |
282 write_topline(text); | |
283 | |
284 write_label_fix( 20, 340, ME_Y_LINE1, &FontT42, TXT_TimeConfig); | |
285 write_label_fix( 20, 340, ME_Y_LINE2, &FontT42, TXT_Format); | |
286 write_label_fix( 20, 340, ME_Y_LINE3, &FontT42, TXT_DateConfig); | |
287 write_label_fix( 20, 790, ME_Y_LINE4, &FontT42, TXT_Format); | |
288 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 | |
289 write_label_var( 20, 340, ME_Y_LINE5, &FontT42, "GNSS"); | |
290 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_TIMEZONE); | |
291 write_label_var( 20, 340, ME_Y_LINE6, &FontT42, text); | |
292 #endif | |
293 | |
294 | |
295 tMenuEdit_newInput(StMSYS1_Time, hour, minute, 0, 0); | |
296 tMenuEdit_set_on_off(StMSYS1_12HR, pSettings->amPMTime); | |
297 | |
298 switch(pSettings->date_format) | |
299 { | |
300 default: | |
301 case DDMMYY: tMenuEdit_newInput(StMSYS1_Date, day, month, year, 0); | |
302 break; | |
303 case MMDDYY: tMenuEdit_newInput(StMSYS1_Date, month, day, year, 0); | |
304 break; | |
305 case YYMMDD: tMenuEdit_newInput(StMSYS1_Date, year, month, day, 0); | |
306 break; | |
307 } | |
308 tMenuEdit_newButtonText(StMSYS1_FORMAT, formatStr); | |
309 | |
310 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 | |
311 if(pStateReal->lifeData.gnssData.alive & GNSS_ALIVE_STATE_TIME) | |
312 { | |
313 convertUTCToLocal(pStateReal->lifeData.gnssData.DateTime.hour, pStateReal->lifeData.gnssData.DateTime.min, &localHours, &localMinutes); | |
314 convertStringOfDate_DDMMYY(formatStr, 20, pStateReal->lifeData.gnssData.DateTime.day | |
315 , pStateReal->lifeData.gnssData.DateTime.month | |
316 , pStateReal->lifeData.gnssData.DateTime.year); | |
317 snprintf(text, 32, "%02d:%02d - %s", localHours, localMinutes, formatStr); | |
318 tMenuEdit_newButtonText(StMSYS1_GNSSDT, text); | |
319 } | |
320 else | |
321 { | |
322 snprintf(text, 32, "--:--"); | |
323 write_label_var( 320, 790, ME_Y_LINE5, &FontT42, text); | |
324 } | |
325 tMenuEdit_newInput(StMSYS1_ZONE, pSettings->timeZone.hours, pSettings->timeZone.minutes, 0, 0); | |
326 #endif | |
327 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
328 } | |
38 | 329 void openEdit_DateTime(void) |
330 { | |
331 RTC_DateTypeDef Sdate; | |
332 RTC_TimeTypeDef Stime; | |
944 | 333 uint8_t day,month,year,hour,minute; |
38 | 334 char text[32]; |
949 | 335 char formatStr[20]; |
38 | 336 SSettings *pSettings; |
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
720
diff
changeset
|
337 const SFirmwareData *pFirmwareInfo; |
949 | 338 |
720 | 339 pFirmwareInfo = firmwareDataGetPointer(); |
38 | 340 const SDiveState * pStateReal = stateRealGetPointer(); |
341 | |
342 pSettings = settingsGetPointer(); | |
944 | 343 |
344 set_globalState(StMSYS1_DateTime); | |
345 resetMenuEdit(CLUT_MenuPageSystem); | |
346 | |
38 | 347 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); |
348 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
349 year = Sdate.Year; | |
350 month = Sdate.Month; | |
351 day = Sdate.Date; | |
352 hour = Stime.Hours; | |
353 minute= Stime.Minutes; | |
354 | |
720 | 355 if(year < pFirmwareInfo->release_year) |
356 year = pFirmwareInfo->release_year; | |
38 | 357 |
358 if(month < 1) | |
359 month = 1; | |
360 | |
361 if(day < 1) | |
362 day = 1; | |
363 | |
949 | 364 getStringOfFormat_DDMMYY(formatStr, 20); |
38 | 365 |
366 text[0] = '\001'; | |
367 text[1] = TXT_DateAndTime; | |
368 text[2] = 0; | |
369 | |
370 write_topline(text); | |
371 | |
372 write_label_fix( 20, 340, ME_Y_LINE1, &FontT42, TXT_TimeConfig); | |
567 | 373 write_label_fix( 20, 340, ME_Y_LINE2, &FontT42, TXT_Format); |
374 write_label_fix( 20, 340, ME_Y_LINE3, &FontT42, TXT_DateConfig); | |
944 | 375 write_label_fix( 20, 790, ME_Y_LINE4, &FontT42, TXT_Format); |
949 | 376 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 |
377 write_label_var( 20, 340, ME_Y_LINE5, &FontT42, "GNSS"); | |
378 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_TIMEZONE); | |
379 write_label_var( 20, 340, ME_Y_LINE6, &FontT42, text); | |
380 #endif | |
38 | 381 |
382 write_field_2digit(StMSYS1_Time, 320, 780, ME_Y_LINE1, &FontT48, "##:##", (uint32_t)hour, (uint32_t)minute, 0, 0); | |
944 | 383 write_field_on_off(StMSYS1_12HR, 320, 790, ME_Y_LINE2, &FontT48, "12 HR", pSettings->amPMTime); |
384 | |
385 switch(pSettings->date_format) | |
386 { | |
387 default: | |
388 case DDMMYY: write_field_2digit(StMSYS1_Date, 320, 780, ME_Y_LINE3, &FontT48, "##-##-20##", (uint32_t)day, (uint32_t)month, (uint32_t)year, 0); | |
389 break; | |
390 case MMDDYY: write_field_2digit(StMSYS1_Date, 320, 780, ME_Y_LINE3, &FontT48, "##-##-20##", (uint32_t)month, (uint32_t)day, (uint32_t)year, 0); | |
391 break; | |
392 case YYMMDD: write_field_2digit(StMSYS1_Date, 320, 780, ME_Y_LINE3, &FontT48, "20##-##-##", (uint32_t)year, (uint32_t)month, (uint32_t)day, 0); | |
393 break; | |
394 } | |
395 | |
949 | 396 write_field_button(StMSYS1_FORMAT, 320, 790, ME_Y_LINE4, &FontT48, formatStr); |
944 | 397 |
949 | 398 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 |
399 snprintf(text, 32, "--:--"); | |
400 write_field_button(StMSYS1_GNSSDT, 320, 790, ME_Y_LINE5, &FontT48, text); | |
401 write_field_sdigit(StMSYS1_ZONE, 320, 780, ME_Y_LINE6, &FontT48, "UTC: ###:###", pSettings->timeZone.hours, pSettings->timeZone.minutes,0,0); | |
402 #endif | |
38 | 403 |
404 setEvent(StMSYS1_Date, (uint32_t)OnAction_Date); | |
405 setEvent(StMSYS1_Time, (uint32_t)OnAction_Time); | |
567 | 406 setEvent(StMSYS1_12HR, (uint32_t)OnAction_12HR); |
944 | 407 setEvent(StMSYS1_FORMAT, (uint32_t)OnAction_Format); |
949 | 408 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 |
409 setEvent(StMSYS1_GNSSDT, (uint32_t)OnAction_SetGnss); | |
410 setEvent(StMSYS1_ZONE, (uint32_t)OnAction_UTC); | |
411 #endif | |
38 | 412 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
413 } | |
414 | |
415 | |
416 uint8_t OnAction_Date(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
417 { | |
418 uint8_t digitContentNew; | |
419 uint32_t newDay, newMonth, newYear; | |
420 RTC_DateTypeDef sdatestructure; | |
421 | |
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
720
diff
changeset
|
422 const SFirmwareData *pFirmwareInfo; |
720 | 423 pFirmwareInfo = firmwareDataGetPointer(); |
38 | 424 |
944 | 425 uint8_t mapDMY[3]; |
426 switch(settingsGetPointer()->date_format) | |
427 { | |
428 default: | |
429 case DDMMYY: mapDMY[0] = 0; | |
430 mapDMY[1] = 1; | |
431 mapDMY[2] = 2; | |
432 break; | |
433 case MMDDYY: mapDMY[0] = 1; | |
434 mapDMY[1] = 0; | |
435 mapDMY[2] = 2; | |
436 break; | |
437 case YYMMDD: mapDMY[0] = 2; | |
438 mapDMY[1] = 1; | |
439 mapDMY[2] = 0; | |
440 break; | |
441 } | |
442 | |
38 | 443 if(action == ACTION_BUTTON_ENTER) |
444 { | |
445 return digitContent; | |
446 } | |
447 if(action == ACTION_BUTTON_ENTER_FINAL) | |
448 { | |
944 | 449 switch(settingsGetPointer()->date_format) |
450 { | |
451 default: | |
452 case DDMMYY: evaluateNewString(editId, &newDay, &newMonth, &newYear, 0); | |
453 break; | |
454 case MMDDYY: evaluateNewString(editId, &newMonth, &newDay, &newYear, 0); | |
455 break; | |
456 case YYMMDD: evaluateNewString(editId, &newYear, &newMonth, &newDay, 0); | |
457 break; | |
458 } | |
459 | |
38 | 460 if(newDay == 0) |
461 newDay = 1; | |
462 if(newDay > 31) | |
463 newDay = 31; | |
464 if(newMonth == 0) | |
465 newMonth = 1; | |
466 if(newMonth > 12) | |
467 newMonth = 12; | |
468 if((newMonth == 2) && (newDay > 29)) | |
469 newDay = 29; | |
470 if((newDay > 30) && ((newMonth == 4) ||(newMonth == 6) ||(newMonth == 9) ||(newMonth == 11))) | |
471 newDay = 30; | |
472 if(newYear < 17) | |
473 newYear = 17; | |
474 if(newYear > 99) | |
475 newYear = 99; | |
476 | |
477 sdatestructure.Date = newDay; | |
478 sdatestructure.Month = newMonth; | |
479 sdatestructure.Year = newYear; | |
480 setWeekday(&sdatestructure); | |
481 | |
482 setDate(sdatestructure); | |
483 | |
944 | 484 switch(settingsGetPointer()->date_format) |
485 { | |
486 default: | |
487 case DDMMYY: tMenuEdit_newInput(editId, newDay, newMonth, newYear, 0); | |
488 break; | |
489 case MMDDYY: tMenuEdit_newInput(editId, newMonth, newDay, newYear, 0); | |
490 break; | |
491 case YYMMDD: tMenuEdit_newInput(editId, newYear, newMonth, newDay, 0); | |
492 break; | |
493 } | |
494 | |
38 | 495 return UNSPECIFIC_RETURN; |
496 } | |
720 | 497 if(action == ACTION_BUTTON_NEXT) /* clip values to a specific range e.g. 12 months */ |
38 | 498 { |
499 digitContentNew = digitContent + 1; | |
944 | 500 |
501 if((blockNumber == mapDMY[0]) && (digitContentNew > '0' + 31)) | |
502 { | |
38 | 503 digitContentNew = '1'; |
944 | 504 } |
505 if((blockNumber == mapDMY[1]) && (digitContentNew > '0' + 12)) | |
506 { | |
38 | 507 digitContentNew = '1'; |
944 | 508 } |
509 if((blockNumber == mapDMY[2]) && (digitContentNew > '0' + pFirmwareInfo->release_year + 10)) | |
510 { | |
720 | 511 digitContentNew = '0' + pFirmwareInfo->release_year; |
944 | 512 } |
38 | 513 return digitContentNew; |
514 } | |
720 | 515 if(action == ACTION_BUTTON_BACK) /* clip values to a specific range e.g. 12 months */ |
38 | 516 { |
517 digitContentNew = digitContent - 1; | |
944 | 518 if((blockNumber == mapDMY[0]) && (digitContentNew < '1')) |
519 { | |
38 | 520 digitContentNew = '0' + 31; |
944 | 521 } |
522 if((blockNumber == mapDMY[1]) && (digitContentNew < '1')) | |
523 { | |
38 | 524 digitContentNew = '0' + 12; |
944 | 525 } |
526 if((blockNumber == mapDMY[2]) && (digitContentNew < '0' + pFirmwareInfo->release_year)) | |
527 { | |
720 | 528 digitContentNew = '0' + pFirmwareInfo->release_year + 10; |
944 | 529 } |
38 | 530 return digitContentNew; |
531 } | |
532 /* | |
533 if(action == ACTION_BUTTON_NEXT) | |
534 { | |
535 digitContentNew = digitContent + 1; | |
536 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew > '2')) | |
537 digitContentNew = '1'; | |
538 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '3')) | |
539 digitContentNew = '0'; | |
540 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '1')) | |
541 digitContentNew = '0'; | |
542 if(digitContentNew > '9') | |
543 digitContentNew = '0'; | |
544 return digitContentNew; | |
545 } | |
546 if(action == ACTION_BUTTON_BACK) | |
547 { | |
548 digitContentNew = digitContent - 1; | |
549 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew < '1')) | |
550 digitContentNew = '2'; | |
551 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
552 digitContentNew = '3'; | |
553 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
554 digitContentNew = '1'; | |
555 if(digitContentNew < '0') | |
556 digitContentNew = '9'; | |
557 return digitContentNew; | |
558 } | |
559 */ | |
560 return UNSPECIFIC_RETURN; | |
561 } | |
562 | |
563 | |
564 uint8_t OnAction_Time(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
565 { | |
566 uint8_t digitContentNew; | |
567 uint32_t newHour, newMinute; | |
568 RTC_TimeTypeDef stimestructure; | |
569 | |
570 if(action == ACTION_BUTTON_ENTER) | |
571 { | |
572 return digitContent; | |
573 } | |
574 if(action == ACTION_BUTTON_ENTER_FINAL) | |
575 { | |
576 evaluateNewString(editId, &newHour, &newMinute, 0, 0); | |
577 if(newHour > 23) | |
578 newHour = 23; | |
579 if(newMinute > 59) | |
580 newMinute = 59; | |
581 | |
582 stimestructure.Hours = newHour; | |
583 stimestructure.Minutes = newMinute; | |
584 stimestructure.Seconds = 0; | |
585 | |
586 setTime(stimestructure); | |
587 | |
588 tMenuEdit_newInput(editId, newHour, newMinute, 0, 0); | |
589 return UNSPECIFIC_RETURN; | |
590 } | |
591 if(action == ACTION_BUTTON_NEXT) | |
592 { | |
593 digitContentNew = digitContent + 1; | |
594 if((blockNumber == 0) && (digitContentNew > '0' + 23)) | |
595 digitContentNew = '0'; | |
596 if((blockNumber == 1) && (digitContentNew > '0' + 59)) | |
597 digitContentNew = '0'; | |
598 return digitContentNew; | |
599 } | |
600 if(action == ACTION_BUTTON_BACK) | |
601 { | |
602 digitContentNew = digitContent - 1; | |
603 if((blockNumber == 0) && (digitContentNew < '0')) | |
604 digitContentNew = '0' + 23; | |
605 if((blockNumber == 1) && (digitContentNew < '0')) | |
606 digitContentNew = '0' + 59; | |
607 return digitContentNew; | |
608 } | |
609 /* | |
610 if(action == ACTION_BUTTON_NEXT) | |
611 { | |
612 digitContentNew = digitContent + 1; | |
613 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '2')) | |
614 digitContentNew = '0'; | |
615 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '5')) | |
616 digitContentNew = '0'; | |
617 if(digitContentNew > '9') | |
618 digitContentNew = '0'; | |
619 return digitContentNew; | |
620 } | |
621 if(action == ACTION_BUTTON_BACK) | |
622 { | |
623 digitContentNew = digitContent - 1; | |
624 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
625 digitContentNew = '2'; | |
626 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
627 digitContentNew = '5'; | |
628 if(digitContentNew < '0') | |
629 digitContentNew = '9'; | |
630 return digitContentNew; | |
631 } | |
632 */ | |
633 return UNSPECIFIC_RETURN; | |
634 } | |
635 | |
567 | 636 uint8_t OnAction_12HR(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
637 { | |
638 SSettings *pSettings; | |
639 | |
640 pSettings = settingsGetPointer(); | |
641 pSettings->amPMTime = !(pSettings->amPMTime); | |
642 | |
643 tMenuEdit_set_on_off(editId, pSettings->amPMTime); | |
644 | |
645 return UNSPECIFIC_RETURN; | |
646 } | |
38 | 647 |
949 | 648 uint8_t OnAction_SetGnss(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
649 { | |
650 RTC_DateTypeDef sdatestructure; | |
651 RTC_TimeTypeDef stimestructure; | |
652 uint8_t localHours = 0; | |
653 uint8_t localMinutes = 0; | |
654 | |
655 const SDiveState * pStateReal = stateRealGetPointer(); | |
656 | |
657 if(pStateReal->lifeData.gnssData.alive & GNSS_ALIVE_STATE_TIME) | |
658 { | |
659 convertUTCToLocal(pStateReal->lifeData.gnssData.DateTime.hour, pStateReal->lifeData.gnssData.DateTime.min, &localHours, &localMinutes); | |
660 stimestructure.Hours = localHours; | |
661 stimestructure.Minutes = localMinutes; | |
662 stimestructure.Seconds = 0; | |
663 setTime(stimestructure); | |
664 | |
665 sdatestructure.Date = pStateReal->lifeData.gnssData.DateTime.day; | |
666 sdatestructure.Month = pStateReal->lifeData.gnssData.DateTime.month; | |
667 sdatestructure.Year = pStateReal->lifeData.gnssData.DateTime.year; | |
668 setWeekday(&sdatestructure); | |
669 setDate(sdatestructure); | |
670 } | |
671 return UNSPECIFIC_RETURN; | |
672 } | |
673 | |
944 | 674 void openEdit_DateFormat(void) |
675 { | |
676 char text[32]; | |
677 SSettings *pSettings; | |
678 | |
679 uint8_t ddmmyy = 0; | |
680 uint8_t mmddyy= 0; | |
681 uint8_t yymmdd = 0; | |
682 | |
683 pSettings = settingsGetPointer(); | |
684 | |
685 | |
686 set_globalState(StMSYS1_FORMAT); | |
687 resetMenuEdit(CLUT_MenuPageSystem); | |
688 setBackMenu((uint32_t)openEdit_DateTime,0,4); | |
689 | |
690 switch(pSettings->date_format) | |
691 { | |
692 default: | |
693 case DDMMYY: ddmmyy = 1; | |
694 break; | |
695 case MMDDYY: mmddyy = 1; | |
696 break; | |
697 case YYMMDD: yymmdd = 1; | |
698 break; | |
699 }; | |
700 | |
701 text[0] = '\001'; | |
702 text[1] = TXT_Format; | |
703 text[2] = 0; | |
704 | |
705 write_topline(text); | |
706 | |
707 write_label_fix( 20, 790, ME_Y_LINE2, &FontT42, TXT_Format); | |
708 | |
709 write_field_on_off(StMSYS1_DDMMYY, 320, 790, ME_Y_LINE1, &FontT48, "DDMMYY", ddmmyy); | |
710 write_field_on_off(StMSYS1_MMDDYY, 320, 790, ME_Y_LINE2, &FontT48, "MMDDYY", mmddyy); | |
711 write_field_on_off(StMSYS1_YYMMDD, 320, 790, ME_Y_LINE3, &FontT48, "YYMMDD", yymmdd); | |
712 | |
713 setEvent(StMSYS1_DDMMYY, (uint32_t)OnAction_DDMMYY); | |
714 setEvent(StMSYS1_MMDDYY, (uint32_t)OnAction_MMDDYY); | |
715 setEvent(StMSYS1_YYMMDD, (uint32_t)OnAction_YYMMDD); | |
716 | |
717 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
718 } | |
719 | |
720 uint8_t OnAction_Format(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
721 { | |
722 openEdit_DateFormat(); | |
723 | |
724 return UNSPECIFIC_RETURN; | |
725 } | |
726 | |
38 | 727 uint8_t OnAction_DDMMYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
728 { | |
729 SSettings *pSettings; | |
730 | |
731 pSettings = settingsGetPointer(); | |
732 pSettings->date_format = DDMMYY; | |
733 | |
734 tMenuEdit_set_on_off(editId, 1); | |
735 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
736 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
737 | |
738 return UNSPECIFIC_RETURN; | |
739 } | |
740 | |
741 | |
742 uint8_t OnAction_MMDDYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
743 { | |
744 SSettings *pSettings; | |
745 | |
746 pSettings = settingsGetPointer(); | |
747 pSettings->date_format = MMDDYY; | |
748 | |
749 tMenuEdit_set_on_off(editId, 1); | |
750 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
751 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
752 | |
753 return UNSPECIFIC_RETURN; | |
754 } | |
755 | |
756 | |
757 uint8_t OnAction_YYMMDD(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
758 { | |
759 SSettings *pSettings; | |
760 | |
761 pSettings = settingsGetPointer(); | |
762 pSettings->date_format = YYMMDD; | |
763 | |
764 tMenuEdit_set_on_off(editId, 1); | |
765 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
766 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
767 | |
768 return UNSPECIFIC_RETURN; | |
769 } | |
770 | |
949 | 771 uint8_t OnAction_UTC(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
772 { | |
773 SSettings *settings = settingsGetPointer(); | |
774 const SDiveState * pStateReal = stateRealGetPointer(); | |
775 int32_t utcHour; | |
776 uint32_t utcMinutes; | |
777 uint8_t digitContentNew; | |
778 uint8_t localHours = 0; | |
779 uint8_t localMinutes = 0; | |
780 char text[32]; | |
781 char timeStr[20]; | |
782 | |
783 switch (action) { | |
784 case ACTION_BUTTON_ENTER: | |
785 | |
786 return digitContent; | |
787 case ACTION_BUTTON_ENTER_FINAL: | |
788 { | |
789 | |
790 evaluateNewString(editId, (uint32_t *)&utcHour, &utcMinutes, NULL, NULL); | |
791 | |
792 if (utcHour > 14) { | |
793 utcHour = 14; | |
794 } else if (utcHour < -12) { | |
795 utcHour = -12; | |
796 } | |
797 | |
798 if (utcMinutes % 15 != 0) | |
799 { | |
800 utcMinutes = (utcMinutes / 15) * 15; | |
801 } | |
802 if(utcMinutes > 45) | |
803 { | |
804 utcMinutes = 45; | |
805 } else if (utcMinutes < 0) { | |
806 utcMinutes = 0; | |
807 } | |
808 settings->timeZone.hours = utcHour; | |
809 settings->timeZone.minutes = utcMinutes; | |
810 | |
811 tMenuEdit_newInput(editId, ((input_u)utcHour).uint32, utcMinutes, 0, 0); | |
812 convertUTCToLocal(pStateReal->lifeData.gnssData.DateTime.hour, pStateReal->lifeData.gnssData.DateTime.min, &localHours, &localMinutes); | |
813 convertStringOfDate_DDMMYY(timeStr, 20, pStateReal->lifeData.gnssData.DateTime.day | |
814 , pStateReal->lifeData.gnssData.DateTime.month | |
815 , pStateReal->lifeData.gnssData.DateTime.year); | |
816 snprintf(text, 32, "%2d:%2d - %s", localHours, localMinutes, timeStr); | |
817 tMenuEdit_newButtonText(StMSYS1_GNSSDT, text); | |
818 } | |
819 | |
820 break; | |
821 case ACTION_BUTTON_NEXT: | |
822 if ((blockNumber == 0) && (digitNumber == 0)) { | |
823 digitContentNew = togglePlusMinus(digitContent); | |
824 } else { | |
825 digitContentNew = digitContent + 1; | |
826 if (digitContentNew > '9') { | |
827 digitContentNew = '0'; | |
828 } | |
829 } | |
830 | |
831 return digitContentNew; | |
832 case ACTION_BUTTON_BACK: | |
833 if ((blockNumber == 0) && (digitNumber == 0)) { | |
834 digitContentNew = togglePlusMinus(digitContent); | |
835 } else { | |
836 digitContentNew = digitContent - 1; | |
837 if (digitContentNew < '0') { | |
838 digitContentNew = '9'; | |
839 } | |
840 } | |
841 return digitContentNew; | |
842 } | |
843 return UNSPECIFIC_RETURN; | |
844 } | |
845 | |
38 | 846 |
847 uint8_t OnAction_DST(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
848 { | |
849 RTC_TimeTypeDef stimestructure; | |
850 uint8_t newDST; | |
851 | |
852 get_RTC_DateTime(0, &stimestructure); | |
853 newDST = stimestructure.DayLightSaving; | |
854 if(newDST) | |
855 newDST = 0; | |
856 else | |
857 newDST = 1; | |
858 stimestructure.DayLightSaving = newDST; | |
859 set_RTC_DateTime(0, &stimestructure); | |
860 | |
861 tMenuEdit_set_on_off(editId, newDST); | |
862 | |
863 return UNSPECIFIC_RETURN; | |
864 } | |
865 | |
866 | |
867 void openEdit_Language(void) | |
868 { | |
869 char text[32]; | |
870 uint8_t actualLanguage, active; | |
871 SSettings *pSettings; | |
872 | |
873 pSettings = settingsGetPointer(); | |
874 actualLanguage = pSettings->selected_language; | |
875 | |
876 text[0] = '\001'; | |
877 text[1] = TXT_Language; | |
878 text[2] = 0; | |
879 write_topline(text); | |
880 | |
881 text[0] = TXT_LanguageName; | |
882 text[1] = 0; | |
883 | |
884 pSettings->selected_language = LANGUAGE_English; | |
885 if( actualLanguage == pSettings->selected_language) | |
886 active = 1; | |
887 else | |
888 active = 0; | |
889 write_field_on_off(StMSYS2_English, 30, 500, ME_Y_LINE1, &FontT48, text, active); | |
890 | |
891 pSettings->selected_language = LANGUAGE_German; | |
892 if( actualLanguage == pSettings->selected_language) | |
893 active = 1; | |
894 else | |
895 active = 0; | |
896 write_field_on_off(StMSYS2_German, 30, 800, ME_Y_LINE2, &FontT48, text, active); | |
897 | |
898 pSettings->selected_language = LANGUAGE_French; | |
899 if( actualLanguage == pSettings->selected_language) | |
900 active = 1; | |
901 else | |
902 active = 0; | |
903 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
|
904 |
38 | 905 |
906 pSettings->selected_language = LANGUAGE_Italian; | |
907 if( actualLanguage == pSettings->selected_language) | |
908 active = 1; | |
909 else | |
910 active = 0; | |
911 write_field_on_off(StMSYS2_Italian, 30, 800, ME_Y_LINE4, &FontT48, text, active); | |
912 | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
913 |
38 | 914 pSettings->selected_language = LANGUAGE_Espanol; |
915 if( actualLanguage == pSettings->selected_language) | |
916 active = 1; | |
917 else | |
918 active = 0; | |
919 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
|
920 |
38 | 921 pSettings->selected_language = actualLanguage; |
922 | |
923 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
924 | |
925 setEvent(StMSYS2_English, (uint32_t)OnAction_English); | |
926 setEvent(StMSYS2_German, (uint32_t)OnAction_German); | |
927 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
|
928 setEvent(StMSYS2_Italian, (uint32_t)OnAction_Italian); |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
929 setEvent(StMSYS2_Espanol, (uint32_t)OnAction_Espanol); |
38 | 930 } |
931 | |
932 | |
933 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
934 { | |
935 SSettings *pSettings = settingsGetPointer(); | |
936 pSettings->selected_language = LANGUAGE_English; | |
937 return EXIT_TO_MENU_WITH_LOGO; | |
938 } | |
939 | |
940 | |
941 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
942 { | |
943 SSettings *pSettings = settingsGetPointer(); | |
944 pSettings->selected_language = LANGUAGE_German; | |
945 return EXIT_TO_MENU_WITH_LOGO; | |
946 } | |
947 | |
948 | |
949 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
950 { | |
951 SSettings *pSettings = settingsGetPointer(); | |
952 pSettings->selected_language = LANGUAGE_French; | |
953 return EXIT_TO_MENU_WITH_LOGO; | |
954 } | |
955 | |
956 | |
957 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
958 { | |
959 SSettings *pSettings = settingsGetPointer(); | |
960 pSettings->selected_language = LANGUAGE_Italian; | |
961 return EXIT_TO_MENU_WITH_LOGO; | |
962 } | |
963 | |
964 | |
965 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
966 { | |
967 SSettings *pSettings = settingsGetPointer(); | |
968 pSettings->selected_language = LANGUAGE_Espanol; | |
969 return EXIT_TO_MENU_WITH_LOGO; | |
970 } | |
971 | |
972 | |
973 void openEdit_Design(void) | |
974 { | |
975 refresh_Design(); | |
976 | |
977 write_field_button(StMSYS3_Units, 400, 700, ME_Y_LINE1, &FontT48, ""); | |
978 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
|
979 #ifdef HAVE_DEBUG_VIEW |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
980 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
|
981 #endif |
38 | 982 setEvent(StMSYS3_Units, (uint32_t)OnAction_Units); |
983 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
|
984 #ifdef HAVE_DEBUG_VIEW |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
985 setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo); |
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
986 #endif |
38 | 987 } |
988 | |
989 | |
990 void refresh_Design(void) | |
991 { | |
992 char text[32]; | |
993 | |
994 // header | |
995 text[0] = '\001'; | |
996 text[1] = TXT_2BYTE; | |
997 text[2] = TXT2BYTE_Layout; | |
998 text[3] = 0; | |
999 write_topline(text); | |
1000 | |
1001 // units | |
1002 text[0] = TXT_2BYTE; | |
1003 text[1] = TXT2BYTE_Units; | |
1004 text[2] = 0; | |
1005 write_label_var( 30, 200, ME_Y_LINE1, &FontT48, text); | |
1006 | |
1007 if(settingsGetPointer()->nonMetricalSystem) | |
1008 { | |
1009 text[1] = TXT2BYTE_Units_feet; | |
1010 } | |
1011 else | |
1012 { | |
1013 text[1] = TXT2BYTE_Units_metric; | |
1014 } | |
1015 write_label_var( 400, 700, ME_Y_LINE1, &FontT48, text); | |
1016 | |
1017 // colorscheme | |
1018 text[0] = TXT_2BYTE; | |
1019 text[1] = TXT2BYTE_Farbschema; | |
1020 text[2] = 0; | |
118
ee7f2cd9b9b4
Enlarge text limits to get string displayed completly
Ideenmodellierer
parents:
103
diff
changeset
|
1021 write_label_var( 30, 300, ME_Y_LINE2, &FontT48, text); |
38 | 1022 |
1023 text[0] = '0' + settingsGetPointer()->tX_colorscheme; | |
1024 text[1] = 0; | |
1025 write_label_var( 400, 700, ME_Y_LINE2, &FontT48, text); | |
1026 | |
343
c9d217b110cc
Added compile switch to enable debug view option in system menu
ideenmodellierer
parents:
259
diff
changeset
|
1027 #ifdef HAVE_DEBUG_VIEW |
38 | 1028 // specials |
1029 text[0] = TXT_2BYTE; | |
1030 text[1] = TXT2BYTE_ShowDebug; | |
1031 text[2] = 0; | |
1032 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
1033 | |
1034 if(settingsGetPointer()->showDebugInfo) | |
1035 text[0] = '\005'; | |
1036 else | |
1037 text[0] = '\006'; | |
1038 text[1] = 0; | |
1039 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
|
1040 #endif |
38 | 1041 |
1042 // design | |
1043 text[0] = TXT_Depth; | |
1044 text[1] = 0; | |
1045 write_content( 30, 700, ME_Y_LINE4, &FontT24, text, CLUT_Font031); | |
1046 write_content( 30, 700, ME_Y_LINE4 + 30 + 70, &FontT48, "___________", CLUT_DIVE_FieldSeperatorLines); | |
1047 write_content(280, 700, ME_Y_LINE4 + 30 + 70 - 3, &FontT48, "|", CLUT_DIVE_pluginbox); | |
1048 write_content(290, 700, ME_Y_LINE4 + 30 + 70 - 37, &FontT48, "_______________", CLUT_DIVE_pluginbox); | |
884 | 1049 write_content( 30, 700, ME_Y_LINE4 + 42, &FontT144, "24.7", CLUT_Font027); |
38 | 1050 |
1051 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1052 } | |
1053 | |
1054 | |
1055 uint8_t OnAction_Units(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1056 { | |
1057 settingsGetPointer()->nonMetricalSystem = !(settingsGetPointer()->nonMetricalSystem); | |
1058 return EXIT_TO_MENU_WITH_LOGO;//UPDATE_DIVESETTINGS; | |
1059 } | |
1060 | |
1061 | |
1062 uint8_t OnAction_Colorscheme(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1063 { | |
1064 uint8_t newColorscheme; | |
1065 | |
1066 newColorscheme = settingsGetPointer()->tX_colorscheme + 1; | |
1067 | |
1068 if(newColorscheme > 3) | |
1069 newColorscheme = 0; | |
1070 | |
1071 settingsGetPointer()->tX_colorscheme = newColorscheme; | |
1072 GFX_use_colorscheme(newColorscheme); | |
1073 tHome_init_compass(); | |
1074 return UNSPECIFIC_RETURN; | |
1075 } | |
1076 | |
1077 | |
1078 uint8_t OnAction_DebugInfo(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1079 { | |
1080 settingsGetPointer()->showDebugInfo = !(settingsGetPointer()->showDebugInfo); | |
1081 return UPDATE_DIVESETTINGS; | |
1082 } | |
1083 | |
1084 | |
1085 | |
1086 | |
1087 /* | |
1088 uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1089 { | |
1090 SSettings *pSettings = settingsGetPointer(); | |
1091 if((pSettings->design == 7) && pSettings->nonMetricalSystem) | |
1092 return EXIT_TO_MENU; | |
1093 pSettings->design = 7; | |
1094 pSettings->nonMetricalSystem = 1; | |
1095 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
1096 tMenuEdit_set_on_off(StMSYS3_t7ft, 1); | |
1097 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
1098 return UPDATE_DIVESETTINGS; | |
1099 } | |
1100 | |
1101 | |
1102 uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1103 { | |
1104 SSettings *pSettings = settingsGetPointer(); | |
1105 if((pSettings->design == 7) && (pSettings->nonMetricalSystem == 0)) | |
1106 return EXIT_TO_MENU; | |
1107 pSettings->design = 7; | |
1108 pSettings->nonMetricalSystem = 0; | |
1109 tMenuEdit_set_on_off(StMSYS3_t7, 1); | |
1110 tMenuEdit_set_on_off(StMSYS3_t7ft, 0); | |
1111 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
1112 return UPDATE_DIVESETTINGS; | |
1113 } | |
1114 | |
1115 | |
1116 uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1117 { | |
1118 SSettings *pSettings = settingsGetPointer(); | |
1119 if(pSettings->design == 3) | |
1120 return EXIT_TO_MENU; | |
1121 pSettings->design = 3; | |
1122 pSettings->nonMetricalSystem = 0; | |
1123 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
1124 tMenuEdit_set_on_off(StMSYS3_t7ft,0); | |
1125 tMenuEdit_set_on_off(StMSYS3_t3, 1); | |
1126 return UPDATE_DIVESETTINGS; | |
1127 } | |
1128 */ | |
1129 | |
1130 | |
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
|
1131 |
38 | 1132 void openEdit_Information(void) |
1133 { | |
1134 char text[70]; | |
1135 | |
1136 infoPage = 0; | |
1137 | |
1138 text[0] = '\001'; | |
1139 text[1] = TXT_Information; | |
1140 text[2] = 0; | |
1141 write_topline(text); | |
1142 | |
1143 text[0] = TXT_2BYTE; | |
1144 text[1] = TXT2BYTE_ButtonNext; | |
1145 text[2] = 0; | |
1146 | |
520 | 1147 write_field_button(StMSYS4_Info, 30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 1148 |
520 | 1149 setEvent(StMSYS4_Info, (uint32_t)OnAction_Information); |
854 | 1150 tMenuEdit_select(StMSYS4_Info); |
38 | 1151 } |
1152 | |
1153 | |
1154 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1155 { | |
1156 resetEnterPressedToStateBeforeButtonAction(); | |
1157 | |
1158 infoPage++; | |
1159 if(infoPage > 3) | |
1160 return EXIT_TO_MENU; | |
1161 else | |
1162 return UNSPECIFIC_RETURN; | |
1163 } | |
1164 | |
1165 | |
1166 void refresh_InformationPage(void) | |
1167 { | |
1168 char text_header[5]; | |
1169 char text_button[5]; | |
1170 char text_content[256]; | |
1171 uint8_t date[3], year,month,day; | |
1172 | |
1173 RTC_DateTypeDef Sdate, Sdate2; | |
1174 float temperature1, temperature2, voltage, offsetTemperature; | |
1175 | |
1176 //RTC_TimeTypeDef Stime; | |
1177 | |
1178 /* | |
1179 SDeviceLine batteryChargeCycles; | |
1180 SDeviceLine batteryChargeCompleteCycles; | |
1181 SDeviceLine temperatureMinimum; | |
1182 SDeviceLine temperatureMaximum; | |
1183 SDeviceLine depthMaximum; | |
1184 SDeviceLine diveCycles; | |
1185 SDeviceLine voltageMinimum; | |
1186 */ | |
1187 | |
1188 switch(infoPage) | |
1189 { | |
1190 case 0: | |
1191 text_header[0] = '\001'; | |
1192 text_header[1] = TXT_Information; | |
1193 text_header[2] = 0; | |
1194 | |
1195 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, "Dive Computer OSTC4"); | |
1196 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, "Design heinrichs/weikamp"); | |
1197 | |
1198 Sdate.Year = firmwareDataGetPointer()->release_year; | |
1199 Sdate.Month = firmwareDataGetPointer()->release_month; | |
1200 Sdate.Date = firmwareDataGetPointer()->release_day; | |
1201 | |
1202 if(settingsGetPointer()->date_format == DDMMYY) | |
1203 { | |
1204 day = 0; | |
1205 month = 1; | |
1206 year = 2; | |
1207 } | |
1208 else | |
1209 if(settingsGetPointer()->date_format == MMDDYY) | |
1210 { | |
1211 day = 1; | |
1212 month = 0; | |
1213 year = 2; | |
1214 } | |
1215 else | |
1216 { | |
1217 day = 2; | |
1218 month = 1; | |
1219 year = 0; | |
1220 } | |
1221 date[day] = Sdate.Date; | |
1222 date[month] = Sdate.Month; | |
1223 date[year] = Sdate.Year; | |
1224 snprintf(text_content,40,"Firmware release date: %02d.%02d.%02d",date[0],date[1],date[2]); | |
1225 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1226 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, "for more information"); | |
64 | 1227 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, "info@heinrichsweikamp.com"); |
38 | 1228 |
1229 text_button[0] = TXT_2BYTE; | |
1230 text_button[1] = TXT2BYTE_ButtonNext; | |
1231 text_button[2] = 0; | |
1232 break; | |
1233 | |
1234 case 1: | |
1235 text_header[0] = '\001'; | |
1236 text_header[1] = TXT_2BYTE; | |
1237 text_header[2] = TXT2BYTE_Usage_Battery; | |
1238 text_header[3] = 0; | |
1239 | |
1240 text_content[0] = TXT_2BYTE; | |
1241 text_content[1] = TXT2BYTE_ChargeCycles; | |
1242 text_content[2] = 0; | |
1243 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
|
1244 /* 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
|
1245 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); */ |
38 | 1246 |
1247 translateDate(stateDeviceGetPointer()->batteryChargeCycles.date_rtc_dr, &Sdate); | |
1248 translateDate(stateDeviceGetPointer()->batteryChargeCompleteCycles.date_rtc_dr, &Sdate2); | |
1249 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
|
1250 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
38 | 1251 |
1252 text_content[0] = TXT_2BYTE; | |
1253 text_content[1] = TXT2BYTE_LowestVoltage; | |
1254 text_content[2] = 0; | |
1255 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1256 | |
404
e729b8e7654d
Bugfix: display of time of minimum voltag:
ideenmodellierer
parents:
389
diff
changeset
|
1257 translateDate(stateDeviceGetPointer()->voltageMinimum.date_rtc_dr, &Sdate); |
38 | 1258 voltage = ((float)stateDeviceGetPointer()->voltageMinimum.value_int32) / 1000; |
1259 snprintf(text_content,80,"%0.3fV (%u.%u.20%02u)",voltage, Sdate.Date,Sdate.Month,Sdate.Year); | |
1260 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); | |
1261 | |
1262 text_button[0] = TXT_2BYTE; | |
1263 text_button[1] = TXT2BYTE_ButtonNext; | |
1264 text_button[2] = 0; | |
1265 break; | |
1266 | |
1267 case 2: | |
1268 text_header[0] = '\001'; | |
1269 text_header[1] = TXT_2BYTE; | |
1270 text_header[2] = TXT2BYTE_Usage_Dives; | |
1271 text_header[3] = 0; | |
1272 | |
1273 text_content[0] = TXT_2BYTE; | |
1274 text_content[1] = TXT2BYTE_NumberOfDives; | |
1275 text_content[2] = 0; | |
1276 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1277 | |
57 | 1278 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->diveCycles.value_int32,(stateDeviceGetPointer()->depthMaximum.value_int32 - 1000) / 100); |
38 | 1279 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
1280 | |
1281 translateDate(stateDeviceGetPointer()->diveCycles.date_rtc_dr, &Sdate); | |
1282 translateDate(stateDeviceGetPointer()->depthMaximum.date_rtc_dr, &Sdate2); | |
1283 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1284 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1285 | |
1286 text_content[0] = TXT_2BYTE; | |
1287 text_content[1] = TXT2BYTE_HoursOfOperation; | |
1288 text_content[2] = 0; | |
1289 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1290 | |
57 | 1291 snprintf(text_content,80,"%ld",(stateDeviceGetPointer()->hoursOfOperation.value_int32)/3600); |
38 | 1292 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1293 | |
1294 text_button[0] = TXT_2BYTE; | |
1295 text_button[1] = TXT2BYTE_ButtonNext; | |
1296 text_button[2] = 0; | |
1297 break; | |
1298 | |
1299 case 3: | |
1300 text_header[0] = '\001'; | |
1301 text_header[1] = TXT_2BYTE; | |
1302 text_header[2] = TXT2BYTE_Usage_Environment; | |
1303 text_header[3] = 0; | |
1304 | |
1305 text_content[0] = TXT_2BYTE; | |
1306 text_content[1] = TXT2BYTE_AmbientTemperature; | |
1307 text_content[2] = 0; | |
1308 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1309 | |
1310 temperature1 = ((float)stateDeviceGetPointer()->temperatureMinimum.value_int32) / 100; | |
1311 temperature2 = ((float)stateDeviceGetPointer()->temperatureMaximum.value_int32) / 100; | |
1312 snprintf(text_content,80,"%0.2f\140C / %0.2f\140C",temperature1,temperature2); | |
1313 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); | |
1314 | |
1315 translateDate(stateDeviceGetPointer()->temperatureMinimum.date_rtc_dr, &Sdate); | |
1316 translateDate(stateDeviceGetPointer()->temperatureMaximum.date_rtc_dr, &Sdate2); | |
1317 snprintf(text_content,80,"(%u.%u.20%02u / %u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1318 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1319 | |
1320 text_content[0] = TXT_2BYTE; | |
1321 text_content[1] = TXT2BYTE_Korrekturwerte; | |
1322 text_content[2] = 0; | |
1323 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1324 | |
1325 offsetTemperature = ((float)settingsGetPointer()->offsetTemperature_centigrad) / 10; | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1326 snprintf(text_content,80,"%i %s / %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, TEXT_PRESSURE_UNIT, offsetTemperature); |
38 | 1327 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1328 | |
1329 text_button[0] = TXT_2BYTE; | |
1330 text_button[1] = TXT2BYTE_Exit; | |
1331 text_button[2] = 0; | |
1332 break; | |
1333 } | |
1334 | |
1335 write_topline(text_header); | |
520 | 1336 tMenuEdit_newButtonText(StMSYS4_Info, text_button); |
38 | 1337 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonNext,0); |
1338 } | |
1339 | |
1340 | |
1341 void openEdit_Reset(void) | |
1342 { | |
1343 char text[32]; | |
1344 | |
1345 text[0] = '\001'; | |
1346 text[1] = TXT_2BYTE; | |
1347 text[2] = TXT2BYTE_ResetMenu; | |
1348 text[3] = 0; | |
1349 write_topline(text); | |
1350 | |
1351 text[0] = TXT_2BYTE; | |
1352 text[1] = TXT2BYTE_LogbookOffset; | |
1353 text[7] = 0; | |
1354 | |
1355 write_label_var( 30, 400, ME_Y_LINE1, &FontT48, text); | |
1356 | |
520 | 1357 write_field_udigit(StMSYS5_LogbookOffset,420, 800, ME_Y_LINE1, &FontT48, "####", settingsGetPointer()->logbookOffset,0,0,0); |
38 | 1358 |
1359 text[0] = TXT_2BYTE; | |
1360 text[2] = 0; | |
1361 | |
1362 text[1] = TXT2BYTE_ResetAll; | |
520 | 1363 write_field_button(StMSYS5_ResetAll, 30, 800, ME_Y_LINE2, &FontT48, text); |
38 | 1364 |
1365 text[1] = TXT2BYTE_ResetDeco; | |
520 | 1366 write_field_button(StMSYS5_ResetDeco, 30, 800, ME_Y_LINE3, &FontT48, text); |
38 | 1367 |
1368 text[1] = TXT2BYTE_Reboot; | |
520 | 1369 write_field_button(StMSYS5_Reboot, 30, 800, ME_Y_LINE4, &FontT48, text); |
38 | 1370 |
1371 text[1] = TXT2BYTE_Maintenance; | |
520 | 1372 write_field_button(StMSYS5_Maintenance, 30, 800, ME_Y_LINE5, &FontT48, text); |
38 | 1373 |
1374 #ifndef RESETLOGBLOCK | |
1375 text[1] = TXT2BYTE_ResetLogbook; | |
520 | 1376 write_field_button(StMSYS5_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 1377 #else |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
520
diff
changeset
|
1378 text[0] = '\031'; |
38 | 1379 text[1] = TXT_2BYTE; |
1380 text[2] = TXT2BYTE_ResetLogbook; | |
1381 text[3] = 0; | |
520 | 1382 write_field_button(StMSYS5_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); |
38 | 1383 text[0] = TXT_2BYTE; |
1384 text[2] = 0; | |
1385 #endif | |
1386 | |
520 | 1387 setEvent(StMSYS5_LogbookOffset, (uint32_t)OnAction_LogbookOffset); |
1388 setEvent(StMSYS5_ResetAll, (uint32_t)OnAction_Confirm); | |
1389 setEvent(StMSYS5_ResetDeco, (uint32_t)OnAction_Confirm); | |
1390 setEvent(StMSYS5_Reboot, (uint32_t)OnAction_Confirm); | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1391 setEvent(StMSYS5_Maintenance, (uint32_t)OnAction_Maintenance); |
38 | 1392 #ifndef RESETLOGBLOCK |
520 | 1393 setEvent(StMSYS5_ResetLogbook, (uint32_t)OnAction_Confirm); |
38 | 1394 #else |
520 | 1395 setEvent(StMSYS5_ResetLogbook, (uint32_t)OnAction_Nothing); |
38 | 1396 #endif |
1397 | |
1398 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1399 } | |
1400 | |
1401 | |
1402 void openEdit_ResetConfirmation(uint32_t editIdOfCaller) | |
1403 { | |
1404 char text[32]; | |
1405 | |
1406 resetMenuEdit(CLUT_MenuPageSystem); | |
1407 | |
1408 text[0] = '\001'; | |
1409 text[1] = TXT_2BYTE; | |
1410 text[2] = TXT2BYTE_AreYouSure; | |
1411 text[3] = 0; | |
1412 write_topline(text); | |
1413 | |
1414 text[0] = TXT_2BYTE; | |
1415 text[2] = 0; | |
1416 text[1] = TXT2BYTE_Abort; | |
1417 | |
520 | 1418 write_field_button(StMSYS5_Exit, 30, 800, ME_Y_LINE1, &FontT48, text); |
38 | 1419 |
1420 text[2] = 0; | |
1421 text[3] = 0; | |
1422 switch(editIdOfCaller) | |
1423 { | |
520 | 1424 case StMSYS5_Reboot: |
1425 case StMSYS5_RebootRTE: | |
1426 case StMSYS5_RebootMainCPU: | |
38 | 1427 text[1] = TXT2BYTE_RebootMainCPU; |
520 | 1428 write_field_button(StMSYS5_RebootMainCPU, 30, 800, ME_Y_LINE2, &FontT48, text); |
38 | 1429 text[1] = TXT2BYTE_RebootRTE; |
520 | 1430 write_field_button(StMSYS5_RebootRTE, 30, 800, ME_Y_LINE3, &FontT48, text); |
1431 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); | |
1432 setEvent(StMSYS5_RebootMainCPU, (uint32_t)OnAction_RebootMainCPU); | |
1433 setEvent(StMSYS5_RebootRTE, (uint32_t)OnAction_RebootRTE); | |
38 | 1434 text[0] = '\025'; |
1435 text[1] = TXT_2BYTE; | |
1436 text[2] = TXT2BYTE_DecoDataLost; | |
1437 text[3] = 0; | |
1438 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1439 break; | |
1440 | |
520 | 1441 case StMSYS5_ResetDeco: |
38 | 1442 text[1] = TXT2BYTE_ResetDeco; |
1443 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1444 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1445 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetDeco); |
1446 text[0] = '\025'; | |
1447 text[1] = TXT_2BYTE; | |
1448 text[2] = TXT2BYTE_DecoDataLost; | |
1449 text[3] = 0; | |
1450 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1451 break; | |
1452 | |
520 | 1453 case StMSYS5_ResetAll: |
38 | 1454 text[1] = TXT2BYTE_ResetAll; |
1455 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1456 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1457 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetAll); |
1458 break; | |
1459 | |
520 | 1460 case StMSYS5_ResetLogbook: |
38 | 1461 text[1] = TXT2BYTE_ResetLogbook; |
1462 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
520 | 1463 setEvent(StMSYS5_Exit, (uint32_t)OnAction_Exit); |
38 | 1464 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); |
1465 break; | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1466 } |
38 | 1467 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1468 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1469 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1470 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1471 void openEdit_Maintenance(void) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1472 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1473 char text[32]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1474 unsigned char index = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1475 SSettings *pSettings = settingsGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1476 SSensorDataDiveO2* pDiveO2Data = NULL; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1477 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1478 resetMenuEdit(CLUT_MenuPageSystem); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1479 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1480 text[0] = '\001'; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1481 text[1] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1482 text[2] = TXT2BYTE_Maintenance; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1483 text[3] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1484 write_topline(text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1485 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1486 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1487 text[1] = TXT2BYTE_SetFactoryDefaults; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1488 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1489 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
|
1490 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1491 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1492 if(stateRealGetPointer()->lifeData.battery_charge <= 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1493 { |
38 | 1494 text[0] = TXT_2BYTE; |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1495 text[1] = TXT2BYTE_SetBatteryCharge; |
38 | 1496 text[2] = 0; |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1497 snprintf(&text[2],10,": %u%%",pSettings->lastKnownBatteryPercentage); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1498 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
|
1499 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1500 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1501 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
|
1502 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1503 for (index = 0; index < 3; index++) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1504 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1505 if(pSettings->ext_sensor_map[index] == SENSOR_DIGO2M) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1506 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1507 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1508 if(pDiveO2Data->pressure != 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1509 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1510 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
|
1511 stateRealGetPointer()->lifeData.pressure_surface_bar); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1512 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1513 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
|
1514 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1515 break; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1516 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1517 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1518 } |
38 | 1519 |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1520 #ifdef ENABLE_ANALYSE_SAMPLES |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1521 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1522 text[1] = TXT2BYTE_SetSampleIndex; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1523 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1524 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
|
1525 #endif |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1526 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1527 setEvent(StMSYS5_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1528 if(stateRealGetPointer()->lifeData.battery_charge <= 0) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1529 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1530 setEvent(StMSYS5_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1531 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1532 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
|
1533 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1534 if(pDiveO2Data != NULL) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1535 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1536 setEvent(StMSYS5_AdjustSurfPres, (uint32_t)OnAction_AdjustSurfacePressure); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1537 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1538 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1539 #ifdef ENABLE_ANALYSE_SAMPLES |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1540 setEvent(StMSYS5_SetSampleIndx, (uint32_t)OnAction_RecoverSampleIdx); |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1541 #endif |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1542 |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1543 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1544 text[0] = TXT_2BYTE; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1545 text[1] = TXT2BYTE_WarnBatteryLow; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1546 text[2] = 0; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1547 snprintf(&text[2],10,": %01.2fV",stateRealGetPointer()->lifeData.battery_voltage); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1548 write_label_var( 30, 800, ME_Y_LINE5, &FontT42, text); |
38 | 1549 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1550 snprintf(&text[0],30,"Code: %X",getLicence()); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1551 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); |
38 | 1552 |
1553 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1554 } | |
1555 | |
1556 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1557 { | |
1558 uint8_t digitContentNew; | |
1559 uint32_t newOffset; | |
1560 | |
1561 if(action == ACTION_BUTTON_ENTER) | |
1562 return digitContent; | |
1563 | |
1564 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1565 { | |
1566 evaluateNewString(editId, &newOffset, 0, 0, 0); | |
1567 if(newOffset > 9000) | |
1568 newOffset = 0; | |
1569 tMenuEdit_newInput(editId, newOffset, 0, 0, 0); | |
1570 settingsGetPointer()->logbookOffset = (uint16_t)newOffset; | |
1571 return UPDATE_DIVESETTINGS; | |
1572 } | |
1573 | |
1574 if(action == ACTION_BUTTON_NEXT) | |
1575 { | |
1576 digitContentNew = digitContent + 1; | |
1577 if(digitContentNew > '9') | |
1578 digitContentNew = '0'; | |
1579 return digitContentNew; | |
1580 } | |
1581 | |
1582 if(action == ACTION_BUTTON_BACK) | |
1583 { | |
1584 digitContentNew = digitContent - 1; | |
1585 if(digitContentNew < '0') | |
1586 digitContentNew = '9'; | |
1587 return digitContentNew; | |
1588 } | |
1589 return UNSPECIFIC_RETURN; | |
1590 } | |
1591 | |
1592 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1593 { | |
1594 return UNSPECIFIC_RETURN; | |
1595 } | |
1596 | |
1597 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1598 { | |
1599 return EXIT_TO_MENU; | |
1600 } | |
1601 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1602 { | |
1603 openEdit_ResetConfirmation(editId); | |
1604 return UNSPECIFIC_RETURN; | |
1605 } | |
1606 | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1607 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
|
1608 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1609 openEdit_Maintenance(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1610 return UNSPECIFIC_RETURN; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1611 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1612 |
38 | 1613 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
1614 { | |
1615 MX_SmallCPU_Reset_To_Standard(); | |
1616 return EXIT_TO_MENU; | |
1617 } | |
1618 | |
1619 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1620 { | |
1621 clearDeco(); | |
1622 return EXIT_TO_MENU; | |
1623 } | |
1624 | |
1625 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1626 { | |
1627 set_settings_to_Standard(); | |
1628 check_and_correct_settings(); | |
1629 | |
1630 return UPDATE_AND_EXIT_TO_HOME; | |
1631 } | |
1632 | |
1633 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1634 { | |
1635 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1636 ext_flash_erase_logbook(); | |
1637 | |
1638 SSettings * pSettings = settingsGetPointer(); | |
1639 pSettings->lastDiveLogId = 255; | |
1640 pSettings->logFlashNextSampleStartAddress = 0; | |
1641 | |
1642 return EXIT_TO_MENU; | |
1643 } | |
1644 | |
1645 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1646 { | |
1647 settingsGetPointer()->showDebugInfo = 0; | |
1648 extern uint8_t bootToBootloader; | |
1649 bootToBootloader = 1; | |
1650 return UNSPECIFIC_RETURN; | |
1651 } | |
1652 | |
1653 | |
1654 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1655 { | |
1656 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
1657 return EXIT_TO_MENU; | |
1658 } | |
1659 | |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
1660 #ifdef ENABLE_ANALYSE_SAMPLES |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1661 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
|
1662 { |
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1663 char text[32]; |
558
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1664 uint8_t openSec; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1665 uint8_t retval = UNSPECIFIC_RETURN; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1666 openSec = ext_flash_AnalyseSampleBuffer(); |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1667 snprintf(&text[0],30,"OpenSec: %d",openSec); |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1668 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
|
1669 |
558
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1670 if(openSec == 2) |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1671 { |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1672 retval = UPDATE_DIVESETTINGS; |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1673 } |
66aef216828b
Changed operation mode of RecoverSampleIndex:
Ideenmodellierer
parents:
528
diff
changeset
|
1674 return retval; |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1675 } |
468
aa1d71875e25
Moved and deactivated analyse sample buffer switch:
ideenmodellierer
parents:
446
diff
changeset
|
1676 #endif |
424
2b31cf1ebbcc
Added (optional) menu item to analyse log sample buffer:
ideenmodellierer
parents:
404
diff
changeset
|
1677 |
38 | 1678 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
1679 { | |
1680 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); | |
1681 // setBatteryPercentage(100); | |
1682 return EXIT_TO_MENU; | |
1683 } | |
1684 | |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1685 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
|
1686 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1687 SSensorDataDiveO2* pDiveO2Data; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1688 const SDiveState* pDiveState = stateRealGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1689 SSettings* pSettings = settingsGetPointer(); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1690 uint8_t index = 0; |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1691 float orgpressure_surface_mbar; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1692 float DiveO2_mbar; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1693 int8_t newOffset_mbar = 0; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1694 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1695 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1696 char text[32]; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1697 |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1698 |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1699 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1700 for (index = 0; index < 3; index++) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1701 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1702 if(settingsGetPointer()->ext_sensor_map[index] == SENSOR_DIGO2M) |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1703 { |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1704 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index]; |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1705 DiveO2_mbar = (pDiveO2Data->pressure/1000.0); |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1706 |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1707 orgpressure_surface_mbar = (pDiveState->lifeData.pressure_surface_bar * 1000) - (settingsGetPointer()->offsetPressure_mbar); |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1708 newOffset_mbar = DiveO2_mbar - orgpressure_surface_mbar; |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1709 |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1710 if(fabs(orgpressure_surface_mbar + ((float)newOffset_mbar) - DiveO2_mbar) > 0.5) /* there might be a rounding difference => compensate */ |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1711 { |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1712 if((orgpressure_surface_mbar + ((float)newOffset_mbar)) - (pDiveO2Data->pressure/1000.0) > 0.0) |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1713 { |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1714 newOffset_mbar -=1; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1715 } |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1716 else |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1717 { |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1718 newOffset_mbar +=1; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1719 } |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1720 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1721 |
959
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1722 pSettings->offsetPressure_mbar = newOffset_mbar; |
5d5fa0a3b409
Devbugfix: external surface pressure calibration:
Ideenmodellierer
parents:
949
diff
changeset
|
1723 snprintf(text,32,"%c%c (%1.3lf => %1.3f)\016\016Bar",TXT_2BYTE,TXT2BYTE_AdjustAmbPressure,(float)(pDiveO2Data->pressure/1000000.0), (orgpressure_surface_mbar + pSettings->offsetPressure_mbar) / 1000.0); |
844
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1724 tMenuEdit_newButtonText(StMSYS5_AdjustSurfPres,text); |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1725 break; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1726 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1727 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1728 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1729 return UNSPECIFIC_RETURN; |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1730 } |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1731 |
e04d7dd199fb
Added option to adjust pressure to diveO2 reference:
Ideenmodellierer
parents:
805
diff
changeset
|
1732 |
38 | 1733 #ifdef SCREENTEST |
1734 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1735 { | |
1736 static uint8_t FrameCount = 1; // 0 is invisible frame | |
1737 char text[5]; | |
1738 GFX_DrawCfgScreen tTestScreen; | |
1739 tTestScreen.FBStartAdress = 0; | |
1740 tTestScreen.ImageHeight = 480; | |
1741 tTestScreen.ImageWidth = 800; | |
1742 tTestScreen.LayerIndex = 1; | |
1743 | |
520 | 1744 set_globalState(StMSYS5_ScreenTest); |
38 | 1745 tTestScreen.FBStartAdress = getFrameByNumber(FrameCount); |
1746 if(tTestScreen.FBStartAdress == 0) | |
1747 { | |
1748 extern uint8_t bootToBootloader; | |
1749 bootToBootloader = 1; | |
1750 } | |
1751 GFX_fill_buffer(tTestScreen.FBStartAdress, 0xFF, FrameCount); | |
1752 snprintf(text,5,"%u",FrameCount); | |
1753 Gfx_write_label_var(&tTestScreen, 10,100,10,&FontT48,CLUT_Font027,text); | |
1754 GFX_SetFramesTopBottom(tTestScreen.FBStartAdress, NULL,480); | |
1755 FrameCount++; | |
1756 } | |
1757 #endif | |
1758 /* | |
1759 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1760 { | |
1761 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1762 | |
1763 test_log_only(20, 5); | |
1764 test_log_only(30, 10); | |
1765 ext_flash_write_settings(); | |
1766 return EXIT_TO_MENU; | |
1767 } | |
1768 */ | |
1769 |