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