Mercurial > public > ostc4
annotate Discovery/Src/tMenuDeco.c @ 805:dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
This can be used to time safety stops, or to prebreathe a CCR (or to boil your breakfast eggs if you are so inclined). The duration of the timer is configurable from 1 second to 9:59 minutes in the System menu.
The timer is started by switching to the custom view, and remaining on it until a 10 second delay has elapsed. Once the timer has started the custom view can be changed and the timer will continue running in the background.
After the timer has run out 'Finished' will be shown for 10 seconds in the timer custom view, and then automatic switching of custom views (if configured) resumes.
In surface mode the dive computer will not go to sleep while the timer is running, and a mini timer will be shown when the timer custom view is not showing. (mikeller)
author | heinrichsweikamp |
---|---|
date | Mon, 21 Aug 2023 17:20:07 +0200 |
parents | e81afd727993 |
children | 608d3e918146 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuDeco.c | |
5 /// \brief Main Template file for Menu Page Deco | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 31-July-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 "tMenu.h" | |
31 #include "tMenuDeco.h" | |
32 #include "unit.h" | |
33 | |
34 /* Exported functions --------------------------------------------------------*/ | |
35 | |
36 uint32_t tMDeco_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
37 { | |
38 uint8_t textPointer; | |
39 uint8_t futureTTS; | |
40 double ppO2max_deco, ppO2max_std; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
41 char divemode; |
38 | 42 textPointer = 0; |
43 *tab = 370; | |
44 *subtext = 0; | |
45 | |
46 SSettings *data = settingsGetPointer(); | |
47 | |
48 futureTTS = data->future_TTS; | |
49 ppO2max_std = data->ppO2_max_std; | |
50 ppO2max_std /= 100.0; | |
51 ppO2max_deco = data->ppO2_max_deco; | |
52 ppO2max_deco /= 100.0; | |
53 | |
54 if((line == 0) || (line == 1)) | |
55 { | |
56 switch(data->dive_mode) | |
57 { | |
58 case DIVEMODE_OC: | |
59 divemode = TXT_OpenCircuit; | |
60 break; | |
61 case DIVEMODE_CCR: | |
62 divemode = TXT_ClosedCircuit; | |
63 break; | |
64 case DIVEMODE_Gauge: | |
65 divemode = TXT_Gauge; | |
66 break; | |
67 case DIVEMODE_Apnea: | |
68 divemode = TXT_Apnoe; | |
69 break; | |
662 | 70 case DIVEMODE_PSCR: |
71 divemode = TXT_PSClosedCircuit; | |
72 break; | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
73 default : |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
74 divemode = TXT_OpenCircuit; |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
75 break; |
38 | 76 } |
77 textPointer += snprintf(&text[textPointer], 60,\ | |
78 "%c" | |
79 "\t" | |
80 "%c" | |
81 , TXT_DiveMode, divemode | |
82 ); | |
83 } | |
84 strcpy(&text[textPointer],"\n\r"); | |
85 textPointer += 2; | |
86 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
87 if((line == 0) || (line == 2)) |
38 | 88 { |
89 textPointer += snprintf(&text[textPointer], 60,\ | |
90 "ppO2" | |
91 "\016\016" | |
92 "max" | |
93 "\017" | |
94 "\t" | |
95 "%0.2f" | |
96 "\016\016" | |
97 " bar " | |
98 " deco " | |
99 "\017" | |
100 "%0.2f" | |
101 "\016\016" | |
102 " bar" | |
103 "\017" | |
104 , ppO2max_std, ppO2max_deco | |
105 ); | |
106 } | |
107 strcpy(&text[textPointer],"\n\r"); | |
108 textPointer += 2; | |
109 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
110 if((line == 0) || (line == 3)) |
38 | 111 { |
112 textPointer += snprintf(&text[textPointer], 60,\ | |
113 "%c" | |
114 "\t" | |
115 "%u" | |
116 "\016\016" | |
117 " %c" | |
118 "\017" | |
119 " @ " | |
120 "%u" | |
121 "\016\016" | |
122 " %c%c" | |
123 "\017" | |
124 , TXT_SafetyStop | |
125 , settingsGetPointer()->safetystopDuration | |
126 ,TXT_Minutes | |
127 , unit_depth_integer(settingsGetPointer()->safetystopDepth) | |
128 , unit_depth_char1() | |
129 , unit_depth_char2() | |
130 ); | |
131 } | |
132 strcpy(&text[textPointer],"\n\r"); | |
133 textPointer += 2; | |
134 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
135 if((line == 0) || (line == 4)) |
38 | 136 { |
137 textPointer += snprintf(&text[textPointer], 60,\ | |
138 "%c" | |
139 "\t" | |
140 "%u" | |
141 "\016\016" | |
142 " %c" | |
143 "\017" | |
144 ,TXT_FutureTTS | |
145 ,futureTTS | |
146 ,TXT_Minutes | |
147 ); | |
148 } | |
149 strcpy(&text[textPointer],"\n\r"); | |
150 textPointer += 2; | |
151 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
152 if((line == 0) || (line == 5)) |
38 | 153 { |
154 textPointer += snprintf(&text[textPointer], 60,\ | |
155 "%c" | |
156 "\t" | |
157 "%u" | |
158 "\016\016" | |
159 " %%" | |
160 "\017" | |
161 , TXT_Salinity | |
162 , settingsGetPointer()->salinity | |
163 ); | |
164 } | |
165 strcpy(&text[textPointer],"\n\r"); | |
166 textPointer += 2; | |
167 | |
168 | |
169 return StMDECO; | |
170 } |