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