Mercurial > public > ostc4
annotate Discovery/Src/show_logbook.c @ 859:d32901746950 Evo_2_23
Improvment battery charger visualization:
In the previous version the green flash (charge complete) was shown even battery had not reached 100% charge. Root cause was that the pin signaling the end of charge could be raised for other reasons then a full battery. The new version will show the green flash only in case the battery is rated as full.
In addition the graph visualization has been updated to continously progress. In the previous version it only progressed in case the charge value changed. Especially at charging start the charger is doing some battery evaluation which does not increase the charge state. In such a case the graph seemed to be frozen.
author | Ideenmodellierer |
---|---|
date | Tue, 07 May 2024 21:20:33 +0200 |
parents | aa6006975e76 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/show_logbook.c | |
5 /// \brief show_logbook_logbook_show_log_page1 / | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 07-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 #include "base.h" | |
30 #include "logbook.h" | |
31 #include "gfx_colors.h" | |
32 #include "gfx_engine.h" | |
33 #include "gfx_fonts.h" | |
34 #include "show_logbook.h" | |
35 #include "unit.h" | |
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
36 #include "configuration.h" |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
37 #include "logbook_miniLive.h" |
662 | 38 #include "text_multilanguage.h" |
38 | 39 |
40 #include <stdint.h> | |
41 #include <stdio.h> | |
42 #include <stdlib.h> // for abs() | |
43 | |
484 | 44 #define LOG_BORDER_OFFSET (50u) /* text offset from left / right display to text start/end */ |
45 | |
38 | 46 /* Private variables ---------------------------------------------------------*/ |
47 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
48 static GFX_DrawCfgScreen tLOGscreen; |
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
49 static GFX_DrawCfgScreen tLOGbackground; |
38 | 50 |
51 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
52 static void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium); |
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
53 static int16_t get_colour(int16_t color); |
38 | 54 |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
55 static uint8_t active_log_page = 1; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
56 static uint8_t active_log_offset = 0; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
57 |
38 | 58 /* Overview */ |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
59 static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); |
38 | 60 /* Temperature */ |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
61 static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); |
38 | 62 /* Gas List */ |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
63 static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); |
38 | 64 /* ppO2 */ |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
65 static void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); |
38 | 66 |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
67 static inline uint32_t MaxU32LOG(uint32_t a, uint32_t b) |
38 | 68 { |
69 return((a>b)?a:b); | |
70 } | |
71 | |
72 /** | |
73 ****************************************************************************** | |
74 * @brief GFX write label. / print coordinate system & depth graph | |
763
aa6006975e76
increase HAL_Delay to 10ms for cold-start-button reset
heinrichsweikamp
parents:
662
diff
changeset
|
75 * @author heinrichs weikamp gmbh |
38 | 76 * @version V0.0.1 |
77 * @date 07-July-2014 | |
78 ****************************************************************************** | |
79 * | |
80 * @param hgfx: | |
81 * @param window: WindowGimpStyle | |
82 * @param mode: different modes depending witch page uses the function | |
83 * @param dataLength: | |
84 * @param depthdata: | |
85 * @param colordata: 1 | |
86 * @retval None | |
87 */ | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
88 static void show_logbook_draw_depth_graph(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards, SWindowGimpStyle* window, short mode, uint16_t dataLength, uint16_t* depthdata, uint8_t * colordata, uint16_t * decostopdata) |
38 | 89 { |
90 SLogbookHeader logbookHeader; | |
91 SWindowGimpStyle wintemp = *window; | |
92 SWindowGimpStyle winsmal; | |
93 logbook_getHeader(StepBackwards, &logbookHeader); | |
94 int divetime = logbookHeader.diveTimeMinutes; | |
95 int maxDepth = logbookHeader.maxDepth/100; | |
96 | |
97 int16_t saveBottom = wintemp.bottom; | |
98 int16_t saveTop = 0 - wintemp.top; | |
99 | |
100 //*** Horisontal (depth) *************************************************** | |
101 | |
102 //--- calc depth lines and labels -- | |
103 int vscale = 0; | |
104 int vstep = 0; | |
105 | |
106 vstep = maxDepth / 5; | |
107 vscale = vstep * 5; | |
108 if(vscale < maxDepth) | |
109 { | |
110 vstep += 1; | |
111 vscale += 5; | |
112 } | |
113 /* | |
114 if(vscale < | |
115 for(int i=1; i <= 20; i++) | |
116 { | |
117 vscale = i * 25; | |
118 vstep = i * 5; | |
119 if( vscale > maxDepth) | |
120 break; | |
121 } | |
122 */ | |
123 //--- print depth labels --- | |
124 winsmal.left = wintemp.left - 48; | |
125 winsmal.top = wintemp.top - 3; | |
126 winsmal.right = wintemp.left -1; | |
127 winsmal.bottom = winsmal.top + 16; | |
128 | |
567 | 129 if(settingsGetPointer()->nonMetricalSystem) |
130 { | |
131 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[ft]"); | |
132 } | |
133 else | |
134 { | |
135 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]"); | |
136 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
137 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
138 // winsmal.left = wintemp.left - 48; |
632 | 139 char msg[10]; |
38 | 140 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; |
141 for(int i = 1; i<=5; i++) | |
142 { | |
143 winsmal.top = wintemp.top + deltaline * i - 14; | |
144 winsmal.bottom = winsmal.top + 16; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
145 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
146 // winsmal.right = wintemp.left - 2; |
632 | 147 snprintf(msg,10,"%i",unit_depth_integer(i * vstep)); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
148 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); |
38 | 149 } |
150 | |
151 //vertical (Time) ******************************************************************* | |
152 //--- calc time lines and labels -- | |
153 int timestep = 0; | |
154 int lines = 0; | |
155 for(int i=1; i <= 60; i++) | |
156 { | |
157 timestep = i * 5; | |
158 lines = divetime/timestep; | |
159 if(lines < 7) | |
160 { | |
161 break; | |
162 } | |
163 } | |
164 //*** print coordinate system grit *** | |
165 int winwidth = wintemp.right - wintemp.left; | |
166 float vdeltaline = ((float)(winwidth * timestep))/divetime; | |
167 GFX_draw_Grid( &tLOGbackground,wintemp, 0, vdeltaline, 5,0, CLUT_LogbookGrid); | |
168 | |
169 | |
170 //--- print time labels --- | |
171 winsmal.left = wintemp.left; | |
172 winsmal.top = wintemp.top - 40; | |
173 winsmal.right = winsmal.left + 60; | |
174 winsmal.bottom = winsmal.top + 16; | |
175 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
176 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"min"); |
38 | 177 for(int i = 1; i<=lines; i++) |
178 { | |
179 winsmal.left= wintemp.left + vdeltaline * i - 15; | |
180 winsmal.right = winsmal.left + 30; | |
632 | 181 snprintf(msg,10,"%3i",i * timestep); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
182 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); |
38 | 183 } |
184 winsmal.left = wintemp.left;// - 9; | |
185 winsmal.top = wintemp.top - 40; | |
186 winsmal.right = winsmal.left + 60; | |
187 | |
188 //--- print depth graph --- | |
189 //adapt window | |
190 int winhight = wintemp.bottom - wintemp.top; | |
191 int newhight = (winhight * maxDepth)/vscale; | |
192 wintemp.bottom = wintemp.top + newhight; | |
193 //wintemp.fontcolor = LOGBOOK_GRAPH_DEPTH; | |
194 | |
195 int datamax = 0; | |
196 for(int i=0;i<dataLength;i++) | |
197 { | |
198 if(depthdata[i]>datamax) | |
199 datamax = depthdata[i]; | |
200 } | |
201 | |
202 if(decostopdata) | |
203 { | |
204 if(dataLength <= 1000) | |
205 { | |
206 uint8_t colortemp[1000]; | |
207 | |
208 for(int i = 0; i<dataLength; i++) | |
209 { | |
210 if(decostopdata[i] > depthdata[i]) | |
211 { | |
212 colortemp[i] = CLUT_WarningRed; | |
213 } | |
214 else | |
215 { | |
216 colortemp[i] = CLUT_NiceGreen; | |
217 } | |
218 } | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
150
diff
changeset
|
219 GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, 0, colortemp); |
38 | 220 } |
221 else | |
222 GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, CLUT_NiceGreen, NULL); | |
223 } | |
224 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
225 if(settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
226 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
227 winsmal.right = 800 - wintemp.left; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
228 winsmal.left = 800 - wintemp.right; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
229 winsmal.bottom = wintemp.bottom; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
230 winsmal.top = wintemp.top; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
231 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
232 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
233 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
234 winsmal.right = wintemp.right; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
235 winsmal.left = wintemp.left; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
236 winsmal.bottom = wintemp.bottom; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
237 winsmal.top = wintemp.top; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
238 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
239 |
38 | 240 switch(mode) |
241 { | |
242 case 0: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
243 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); |
38 | 244 break; |
245 case 1: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
246 GFX_graph_print(hgfx,&winsmal,saveBottom,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); |
38 | 247 break; |
248 case 2: | |
249 if(*colordata) | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
250 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); |
38 | 251 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
252 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); |
38 | 253 } |
254 } | |
255 | |
256 | |
257 | |
258 /** | |
259 ****************************************************************************** | |
260 * @brief scaleAdapt | |
261 * @author heinrichs weikamp gmbh | |
262 * @version V0.0.1 | |
263 * @date 29-Nov-2016 | |
264 ****************************************************************************** | |
265 * | |
266 * @param ... | |
267 * @retval *OutputStepOfScale, *OutputMaxValueOnScale, *OutputTop, *OutputBottom | |
268 | |
269 * fit to multiples of 1�C (data format is 1/10�C) | |
270 */ | |
271 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
272 static void scaleAdapt( int InputTop, int InputBottom, |
38 | 273 int16_t *OutputMinValue, int16_t *OutputMaxValue, int *OutputTop, int *OutputBottom, |
274 uint16_t *OutputStepOfScale, int16_t *OutputMaxValueOnScale) | |
275 { | |
276 // uint16_t oldScale; | |
277 uint16_t newScale; | |
278 // uint16_t diff_newScale; | |
279 | |
280 // int16_t oldMaxOnScale; | |
281 int16_t newMaxOnScale; | |
282 // int16_t diff_newMaxOnScale; | |
283 _Bool negativeMaxValue = 0; | |
284 | |
285 // float oldRange; | |
286 float newRange; | |
287 | |
288 float sizeOfScreen; | |
289 // float InputTopValue; | |
290 // float InputBottomValue; | |
291 float screenToRangeRatio; | |
292 float diffOutMaxToMaxOnScale; | |
293 float diffOutMinToMaxOnScale; | |
294 int positonOutputMaxValue; | |
295 int positonOutputMinValue; | |
296 | |
297 | |
298 // scale | |
299 // oldScale = *OutputStepOfScale; | |
300 newScale = *OutputStepOfScale + 9; | |
301 newScale /= 10; | |
302 newScale *= 10; | |
303 // diff_newScale = newScale - *OutputStepOfScale; | |
304 // oldRange = 5 * oldScale; | |
305 newRange = 5 * newScale; | |
306 *OutputStepOfScale = newScale; | |
307 | |
308 // MaxValueOnScale | |
309 // oldMaxOnScale = *OutputMaxValueOnScale; | |
310 if(OutputMaxValueOnScale < 0) | |
311 { | |
312 negativeMaxValue = 1; | |
313 newMaxOnScale = 0 - *OutputMaxValueOnScale; | |
314 } | |
315 else | |
316 { | |
317 negativeMaxValue = 0; | |
318 newMaxOnScale = *OutputMaxValueOnScale; | |
319 } | |
320 newMaxOnScale += 9; | |
321 newMaxOnScale /= 10; | |
322 newMaxOnScale *= 10; | |
323 if(negativeMaxValue) | |
324 { | |
325 // diff_newMaxOnScale = newMaxOnScale + *OutputMaxValueOnScale; | |
326 *OutputMaxValueOnScale = 0 - newMaxOnScale; | |
327 } | |
328 else | |
329 { | |
330 // diff_newMaxOnScale = newMaxOnScale - *OutputMaxValueOnScale; | |
331 *OutputMaxValueOnScale = newMaxOnScale; | |
332 } | |
333 | |
334 | |
335 // new coordinates | |
336 sizeOfScreen = 1 + InputBottom - InputTop; | |
337 // InputTopValue = *OutputMaxValueOnScale; | |
338 // InputBottomValue = InputTopValue + (6 * *OutputStepOfScale); | |
339 | |
340 screenToRangeRatio = sizeOfScreen / newRange; | |
341 diffOutMaxToMaxOnScale = abs(*OutputMaxValueOnScale) - abs(*OutputMaxValue); | |
342 // diffOutMinToMax = abs(*OutputMinValue - *OutputMaxValue); | |
343 diffOutMinToMaxOnScale = abs(*OutputMaxValueOnScale - *OutputMinValue); | |
344 | |
345 positonOutputMaxValue = (int)(diffOutMaxToMaxOnScale * screenToRangeRatio); | |
346 positonOutputMaxValue += *OutputTop; | |
347 positonOutputMinValue = (int)(diffOutMinToMaxOnScale * screenToRangeRatio); | |
348 positonOutputMinValue += *OutputTop; | |
349 // positonOutputMinValue = (int)(diffOutMinToMax * screenToRangeRatio); | |
350 // positonOutputMinValue += positonOutputMaxValue; | |
351 *OutputTop = positonOutputMaxValue; | |
352 *OutputBottom = positonOutputMinValue; | |
353 } | |
354 | |
355 | |
356 /** | |
357 ****************************************************************************** | |
358 * @brief scaleHelper | |
359 * @author heinrichs weikamp gmbh | |
360 * @version V0.0.1 | |
361 * @date 13-Oct-2016 | |
362 ****************************************************************************** | |
363 * | |
364 * @param hgfx: | |
365 * @retval None | |
366 | |
367 * pixel 50 oben | |
368 * pixel 439 unten | |
369 * pixel 390 gesamt h�he | |
370 | |
371 * for temperature, input is �C * 10 | |
372 */ | |
373 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
374 static void scaleHelper( uint16_t InputDataLength, int16_t *InputDataArray, int InputTop, int InputBottom, |
38 | 375 int16_t *OutputMinValue, int16_t *OutputMaxValue, int *OutputTop, int *OutputBottom, |
376 uint16_t *OutputStepOfScale, int16_t *OutputMaxValueOnScale) | |
377 { | |
378 int32_t datamin = INT16_MAX; // 32 bit for delta calculation ( delta is unsigned -> value can be 2x INT16_MAX) | |
379 int32_t datamax = INT16_MIN; | |
380 uint16_t deltaMinMax = 1; | |
381 // uint16_t deltaMinMaxUsed = 1; | |
382 // uint16_t digits = 1; | |
383 // uint16_t scaler = 1; | |
384 uint32_t step = 1; | |
385 const int sizeOfScreen = InputBottom - InputTop; | |
386 float pixel2range = 1.0; | |
387 | |
388 // min, max, deltaMinMax, OutputMinValue, OutputMaxValue | |
389 for(uint16_t i = 0; i < InputDataLength; i++) | |
390 { | |
391 if(InputDataArray[i] > datamax) | |
392 datamax = InputDataArray[i]; | |
393 | |
394 if(InputDataArray[i] < datamin) | |
395 datamin = InputDataArray[i]; | |
396 } | |
397 | |
398 deltaMinMax = (uint16_t)(datamax - datamin); | |
399 | |
400 *OutputMinValue = (int16_t)datamin; | |
401 *OutputMaxValue = (int16_t)datamax; | |
402 | |
403 // step | |
404 step = deltaMinMax / 5; | |
405 while(deltaMinMax > (step * 5)) | |
406 { | |
407 step += 1; | |
408 } | |
409 pixel2range = ((float)sizeOfScreen) / (step * 5); | |
410 | |
411 *OutputStepOfScale = (uint16_t)step; | |
412 *OutputMaxValueOnScale = *OutputMaxValue; | |
413 *OutputTop = InputTop; | |
414 *OutputBottom = ((int)(pixel2range * deltaMinMax)) + *OutputTop; | |
415 } | |
416 | |
417 /** | |
418 ****************************************************************************** | |
419 * @brief show_logbook_logbook_show_log_page1 / | |
763
aa6006975e76
increase HAL_Delay to 10ms for cold-start-button reset
heinrichsweikamp
parents:
662
diff
changeset
|
420 * @author heinrichs weikamp gmbh |
38 | 421 * @version V0.0.1 |
422 * @date 07-July-2014 | |
423 ****************************************************************************** | |
424 * | |
425 * @param hgfx: | |
426 * @retval None | |
427 */ | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
428 static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx,uint8_t StepBackwards) |
38 | 429 { |
430 SWindowGimpStyle wintemp; | |
431 SWindowGimpStyle winsmal; | |
484 | 432 wintemp.left = LOG_BORDER_OFFSET; |
38 | 433 wintemp.right = 799 - wintemp.left; |
484 | 434 wintemp.top = LOG_BORDER_OFFSET; |
38 | 435 wintemp.bottom = 479 - 40; |
567 | 436 char timeSuffix; |
437 uint8_t hoursToDisplay; | |
38 | 438 |
439 SLogbookHeader logbookHeader; | |
440 logbook_getHeader(StepBackwards ,&logbookHeader); | |
441 | |
442 uint16_t depthdata[1000] = { 0 }; | |
443 uint8_t gasdata[1000] = { 0 }; | |
444 int16_t tempdata[1000] = { 0 }; | |
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
445 uint16_t tankdata[1000] = { 0 }; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
446 |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
447 #ifdef ENABLE_BOTTLE_SENSOR |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
448 uint16_t bottlePressureStart = 0; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
449 uint16_t bottlePressureEnd = 0; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
450 uint16_t loop = 0; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
451 #endif |
38 | 452 |
453 uint16_t dataLength = 0; | |
610 | 454 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tankdata,NULL); |
38 | 455 |
456 //Print Date | |
457 uint8_t year = logbookHeader.dateYear; | |
458 uint8_t month = logbookHeader.dateMonth; | |
459 uint8_t day = logbookHeader.dateDay; | |
460 char text[40]; | |
461 snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
462 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
463 Gfx_write_label_var(hgfx, 30, 250,10, &FontT42,CLUT_GasSensor1,text); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
464 |
38 | 465 |
466 // Print logbook number with offset | |
467 if(settingsGetPointer()->logbookOffset) | |
468 { | |
469 int32_t logNumber; | |
470 logNumber = settingsGetPointer()->logbookOffset - StepBackwards; | |
471 if(logNumber < 0) | |
472 logNumber = 0; | |
473 else | |
474 if(logNumber > 9999) | |
475 logNumber = 9999; | |
476 | |
457 | 477 snprintf(text,20,"#%ld",logNumber); |
38 | 478 Gfx_write_label_var(hgfx, 300, 590,10, &FontT42,CLUT_GasSensor1,text); |
479 } | |
480 | |
481 //Print time | |
482 uint8_t minute = logbookHeader.timeMinute; | |
567 | 483 |
484 if (settingsGetPointer()->amPMTime) | |
485 { | |
486 if (logbookHeader.timeHour > 11) | |
487 { | |
488 timeSuffix = 'P'; | |
489 } | |
490 else | |
491 { | |
492 timeSuffix = 'A'; | |
493 } | |
494 | |
495 if (logbookHeader.timeHour % 12 == 0) | |
496 { | |
497 hoursToDisplay = 12; | |
498 } | |
499 else | |
500 { | |
501 hoursToDisplay = (logbookHeader.timeHour % 12); | |
502 } | |
503 | |
504 snprintf(text,20,"\002%02i:%02i %cM",hoursToDisplay,minute,timeSuffix); | |
505 } | |
506 else | |
507 { | |
508 hoursToDisplay = logbookHeader.timeHour; | |
509 snprintf(text,20,"\002%02i:%02i",hoursToDisplay,minute); | |
510 } | |
511 | |
512 | |
484 | 513 Gfx_write_label_var(hgfx, 600, wintemp.right,10, &FontT42,CLUT_GasSensor1,text); |
38 | 514 |
515 //Print Dive Mode (OC/CCR/...) | |
516 switch(logbookHeader.diveMode) | |
517 { | |
518 case DIVEMODE_OC: | |
662 | 519 snprintf(text,20,"%c",TXT_OpenCircuit); |
38 | 520 break; |
521 case DIVEMODE_CCR: | |
662 | 522 snprintf(text,20,"%c",TXT_ClosedCircuit); |
38 | 523 break; |
524 case DIVEMODE_Gauge: | |
662 | 525 snprintf(text,20,"%c",TXT_Gauge); |
38 | 526 break; |
527 case DIVEMODE_Apnea: | |
662 | 528 snprintf(text,20,"%c",TXT_Apnoe); |
529 break; | |
530 case DIVEMODE_PSCR: | |
531 snprintf(text,20,"%c",TXT_PSClosedCircuit); | |
38 | 532 break; |
533 } | |
534 Gfx_write_label_var(hgfx, 30, 250,60, &FontT42,CLUT_GasSensor4,text); | |
535 | |
536 // Decomodel | |
537 if(logbookHeader.diveMode <= DIVEMODE_CCR) | |
538 { | |
539 switch(logbookHeader.decoModel) | |
540 { | |
541 case GF_MODE: | |
542 snprintf(text,20,"\002GF%u/%u",logbookHeader.gfLow_or_Vpm_conservatism,logbookHeader.gfHigh); | |
484 | 543 break; |
38 | 544 case VPM_MODE: |
545 snprintf(text,20,"\002VPM +%u",logbookHeader.gfLow_or_Vpm_conservatism); | |
484 | 546 break; |
547 default: | |
548 snprintf(text,20," "); /* no information to be displayed */ | |
549 break; | |
38 | 550 } |
484 | 551 Gfx_write_label_var(hgfx, 500, wintemp.right,60, &FontT42,CLUT_GasSensor1,text); |
38 | 552 } |
553 | |
554 //Write Dive Time | |
555 int minutes = logbookHeader.diveTimeMinutes; | |
556 int seconds = logbookHeader.diveTimeSeconds; | |
557 int hours = minutes/60; | |
558 minutes -= hours * 60; | |
559 snprintf(text,20,"%02i:%02i:%02i",hours,minutes,seconds); | |
560 Gfx_write_label_var(hgfx, 30, 250,360, &FontT42,CLUT_GasSensor1,text); | |
561 Gfx_write_label_var(hgfx, 200, 250,360, &FontT42,CLUT_GasSensor4,"s"); | |
562 | |
563 // Max Depth | |
564 int maxdepth =logbookHeader.maxDepth/100; | |
565 int maxdepth_dcm = logbookHeader.maxDepth/10 - maxdepth * 10; | |
566 int top = 150; | |
567 if(settingsGetPointer()->nonMetricalSystem) | |
568 { | |
569 float maxDepthFeet = 0; | |
570 maxDepthFeet = unit_depth_float(((float)logbookHeader.maxDepth)/100); | |
571 snprintf(text,20,"%.0f",maxDepthFeet); | |
572 } | |
573 else | |
574 { | |
575 snprintf(text,20,"%i.%i",maxdepth,maxdepth_dcm); | |
576 } | |
577 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | |
578 winsmal.left = 30; | |
579 winsmal.top = top -3; | |
580 winsmal.bottom = winsmal.top + FontT42.height; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
581 |
38 | 582 if(maxdepth < 10) |
583 { | |
584 winsmal.left = 137; | |
585 } | |
586 else if(maxdepth < 100) | |
587 { | |
588 winsmal.left = 151; | |
589 } | |
590 else | |
591 { | |
592 winsmal.left = 147; | |
593 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
594 winsmal.right = winsmal.left + 50; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
595 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
596 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,top, &FontT24,CLUT_GasSensor4,"max"); |
38 | 597 snprintf(text,3,"%c%c" |
598 , unit_depth_char1() | |
599 , unit_depth_char2() | |
600 ); | |
601 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | |
602 | |
603 // Average Depth | |
604 int avrdepth =logbookHeader.averageDepth_mbar/100; | |
605 int avrdepth_dcm = logbookHeader.averageDepth_mbar/10 - avrdepth * 10; | |
606 top = 200; | |
607 if(settingsGetPointer()->nonMetricalSystem) | |
608 { | |
609 float avgDepthFeet = 0; | |
610 avgDepthFeet = unit_depth_float(((float)logbookHeader.averageDepth_mbar)/100); | |
611 snprintf(text,20,"%.0f",avgDepthFeet); | |
612 } | |
613 else | |
614 { | |
615 snprintf(text,20,"%i.%i",avrdepth,avrdepth_dcm); | |
616 } | |
617 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
618 |
38 | 619 winsmal.left = 30; |
620 winsmal.top = top -3; | |
621 winsmal.bottom = winsmal.top + FontT42.height; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
622 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
623 /* put avg behind previous string */ |
38 | 624 if(avrdepth < 10) |
625 { | |
626 winsmal.left = 137 ; | |
627 } | |
628 else if(avrdepth < 100) | |
629 { | |
630 winsmal.left = 151; | |
631 } | |
632 else | |
633 { | |
634 winsmal.left = 147; | |
635 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
636 winsmal.right = winsmal.left + 50; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
637 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
638 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor4,"avg"); |
38 | 639 snprintf(text,3,"%c%c" |
640 , unit_depth_char1() | |
641 , unit_depth_char2() | |
642 ); | |
643 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | |
644 // Temperature | |
645 top+= 50; | |
646 float temp_Temperature; | |
647 uint16_t start; | |
648 temp_Temperature = ((float)logbookHeader.minTemp)/10; | |
649 snprintf(text,20,"%.1f",unit_temperature_float(temp_Temperature)); | |
650 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | |
651 | |
652 if(settingsGetPointer()->nonMetricalSystem) | |
653 start = 121; | |
654 else if((logbookHeader.minTemp >= 0) && (logbookHeader.minTemp < 10)) | |
655 start = 100; | |
656 else if((logbookHeader.minTemp >= -10) && (logbookHeader.minTemp < 100)) | |
657 start = 114; | |
658 else | |
659 start = 121; | |
660 | |
661 text[0] = '\140'; | |
662 if(settingsGetPointer()->nonMetricalSystem) | |
663 text[1] = 'F'; | |
664 else | |
665 text[1] = 'C'; | |
666 text[2] = 0; | |
667 | |
668 Gfx_write_label_var(hgfx, start, 300,top, &FontT42,CLUT_GasSensor4,text); | |
669 | |
670 // CNS | |
671 snprintf(text,20,"CNS: %i %%",logbookHeader.maxCNS); | |
150
097d7146b779
Place CNS and pressure within the screen (avoid clipping)
Ideenmodellierer
parents:
115
diff
changeset
|
672 Gfx_write_label_var(hgfx, 30, 250,440, &FontT42,CLUT_GasSensor1,text); |
38 | 673 |
674 // Surface Pressure | |
675 // snprintf(text,20,"\001%i\016\016 mbar",logbookHeader.surfacePressure_mbar); | |
676 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text); | |
677 // snprintf(text,40,"%i\016\016 mbar\017 (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar)); | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
38
diff
changeset
|
678 snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar); |
150
097d7146b779
Place CNS and pressure within the screen (avoid clipping)
Ideenmodellierer
parents:
115
diff
changeset
|
679 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text); |
38 | 680 |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
681 |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
682 /* show symbol in case log entry is marked for usage in profile custom view */ |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
683 snprintf(text,10,"\002>"); |
616
a594a778c883
Development bugfix: show replay symbol only for the selected dive:
Ideenmodellierer
parents:
610
diff
changeset
|
684 if(StepBackwards == getReplayOffset()) |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
685 { |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
686 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_GasSensor1,text); |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
687 } |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
688 else |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
689 { |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
690 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_MenuTopBackground,text); |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
691 } |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
692 |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
693 |
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
694 /* Show tank info */ |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
695 #ifdef ENABLE_BOTTLE_SENSOR |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
696 for(loop = 0; loop < dataLength; loop++) |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
697 { |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
698 if((bottlePressureStart == 0) && (tankdata[loop] != 0)) /* find first pressure value */ |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
699 { |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
700 bottlePressureStart = tankdata[loop]; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
701 } |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
702 if((tankdata[loop] != 0)) /* store last pressure value */ |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
703 { |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
704 bottlePressureEnd = tankdata[loop]; |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
705 } |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
706 } |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
707 if(bottlePressureStart != 0) |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
708 { |
484 | 709 snprintf(text,40,"\002%i | %i\016\016 Bar\017",bottlePressureStart,bottlePressureEnd); |
710 Gfx_write_label_var(hgfx,450,wintemp.right,440, &FontT42,CLUT_GasSensor1,text); | |
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
711 } |
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
712 #endif |
38 | 713 //--- print coordinate system & depth graph with gaschanges --- |
714 wintemp.left = 330; | |
715 wintemp.top = 160; | |
716 wintemp.bottom -= 40; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
717 |
38 | 718 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); |
719 } | |
720 | |
721 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
722 static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
38 | 723 { |
724 //*** Page2: Depth and Temperature **** | |
725 | |
726 SWindowGimpStyle wintemp; | |
727 SWindowGimpStyle winsmal; | |
728 wintemp.left = 50; | |
729 wintemp.right = 799 - wintemp.left; | |
730 wintemp.top = 50; | |
731 wintemp.bottom = 479 - 40; | |
732 | |
733 SLogbookHeader logbookHeader; | |
734 | |
735 logbook_getHeader(StepBackwards,&logbookHeader); | |
736 uint16_t dataLength = 0; | |
737 uint16_t depthdata[1000]; | |
738 uint8_t gasdata[1000]; | |
739 int16_t tempdata[1000]; | |
740 uint16_t decoDepthdata[1000]; | |
741 uint16_t *pDecoDepthData = 0; | |
742 | |
610 | 743 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata, NULL, NULL); |
38 | 744 |
745 for(int i = 0; i<dataLength; i++) | |
746 { | |
747 if(decoDepthdata[i] >= 300) | |
748 { | |
749 pDecoDepthData = decoDepthdata; | |
750 break; | |
751 } | |
752 } | |
753 //--- print coordinate system & depth graph --- | |
754 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, pDecoDepthData); | |
755 | |
756 //*** Temperature ************************************************* | |
757 | |
758 //--- print temperature labels --- | |
759 // input maxtmpline, tmpstep, deltaline | |
760 | |
761 winsmal.left = wintemp.right +6; | |
762 winsmal.top = wintemp.top - 3; | |
763 winsmal.right = wintemp.right + 30; | |
764 winsmal.bottom = winsmal.top + 16; | |
765 | |
567 | 766 if(settingsGetPointer()->nonMetricalSystem) |
767 { | |
768 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[F]"); | |
769 } | |
770 else | |
771 { | |
772 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]"); | |
773 } | |
38 | 774 |
775 int16_t minVal = 0; | |
776 int16_t maxVal = 0; | |
777 int newTop = 0; | |
778 int newBottom = 0; | |
779 uint16_t step = 0; | |
780 int16_t maxValTop = 0; | |
653 | 781 int16_t tmp = 0; |
38 | 782 |
783 scaleHelper(dataLength, tempdata, wintemp.top, wintemp.bottom, | |
784 &minVal, &maxVal, &newTop, &newBottom, | |
785 &step, &maxValTop); // newTop is wintemp.top | |
786 | |
787 scaleAdapt( wintemp.top, wintemp.bottom, | |
788 &minVal, &maxVal, &newTop, &newBottom, | |
789 &step, &maxValTop); | |
790 | |
791 // temperature in 1/10 �C | |
792 int deltaline = (1 + wintemp.bottom - wintemp.top)/5; | |
632 | 793 char msg[15]; |
653 | 794 |
795 /* temperature is provided in centi scaling => convert */ | |
796 maxValTop /= 10; | |
797 step /= 10; | |
798 | |
799 tmp = maxValTop; | |
38 | 800 for(int i = 1; i<=5; i++) |
801 { | |
802 tmp -= step; | |
803 winsmal.top = wintemp.top + deltaline * i - 14; | |
804 winsmal.bottom = winsmal.top + 16; | |
653 | 805 snprintf(msg,15,"%2i",unit_temperature_integer(tmp)); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
806 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); |
38 | 807 } |
808 | |
809 | |
810 //--- print temperature graph --- | |
811 // input tempdata[i], maxtmpline, mintmpline, maxTmp, minTmp, deltaline, wintemp.top, dataLength, datamax, | |
812 | |
813 //adapt window | |
814 wintemp.bottom = newBottom; | |
815 wintemp.top = newTop; | |
816 GFX_graph_print(hgfx,&wintemp,0,1,maxVal,minVal, (uint16_t *)tempdata,dataLength,CLUT_LogbookTemperature, NULL); | |
817 } | |
818 | |
819 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
820 static void build_logbook_test(uint8_t page, uint8_t StepBackwards) |
38 | 821 { |
822 uint32_t lastScreen,lastBackground; | |
823 | |
824 lastScreen = tLOGscreen.FBStartAdress; | |
825 lastBackground = tLOGbackground.FBStartAdress; | |
826 | |
827 tLOGscreen.FBStartAdress = getFrame(16); | |
828 tLOGscreen.ImageHeight = 480; | |
829 tLOGscreen.ImageWidth = 800; | |
830 tLOGscreen.LayerIndex = 1; | |
831 | |
832 tLOGbackground.FBStartAdress = getFrame(17); | |
833 tLOGbackground.ImageHeight = 480; | |
834 tLOGbackground.ImageWidth = 800; | |
835 tLOGbackground.LayerIndex = 0; | |
836 switch(page) | |
837 { | |
838 case 1: | |
839 show_logbook_logbook_show_log_page1(&tLOGscreen,StepBackwards); | |
840 break; | |
841 case 2: | |
842 show_logbook_logbook_show_log_page2(&tLOGscreen,StepBackwards); | |
843 break; | |
844 case 3: | |
845 show_logbook_logbook_show_log_page3(&tLOGscreen,StepBackwards); | |
846 break; | |
847 case 4: | |
848 show_logbook_logbook_show_log_page4(&tLOGscreen,StepBackwards); | |
849 break; | |
850 } | |
851 | |
852 releaseFrame(16,lastScreen); | |
853 releaseFrame(17,lastBackground); | |
854 } | |
855 | |
856 | |
857 void show_logbook_test(_Bool firstPage, uint8_t StepBackwards) | |
858 { | |
859 if(firstPage) | |
860 { | |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
861 active_log_page = 1; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
862 active_log_offset = StepBackwards; |
38 | 863 } |
864 else | |
865 { | |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
866 active_log_page++; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
867 if(active_log_page > 4) |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
868 { |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
869 active_log_page = 1; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
870 } |
38 | 871 } |
872 | |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
873 build_logbook_test(active_log_page,StepBackwards); |
38 | 874 // GFX_ResetLayer(TOP_LAYER); |
875 // GFX_ResetLayer(BACKGRD_LAYER); | |
876 | |
877 set_globalState(StILOGSHOW); | |
878 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480); | |
879 } | |
880 | |
881 | |
882 void show_logbook_exit(void) | |
883 { | |
884 releaseFrame(16,tLOGscreen.FBStartAdress); | |
885 releaseFrame(17,tLOGbackground.FBStartAdress); | |
886 } | |
887 | |
888 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
889 static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
38 | 890 { |
891 SWindowGimpStyle wintemp; | |
892 SWindowGimpStyle winsmal; | |
662 | 893 uint8_t gasWasUsed[NUM_GASES * 2]; |
894 int16_t index = 0; | |
895 uint8_t loopMode = 0; | |
896 | |
38 | 897 wintemp.left = 50; |
898 wintemp.right = 799 - wintemp.left; | |
899 wintemp.top = 50; | |
900 wintemp.bottom = 479 - 40; | |
901 | |
902 SLogbookHeader logbookHeader; | |
903 | |
904 logbook_getHeader(StepBackwards, &logbookHeader); | |
905 uint16_t dataLength = 0; | |
906 uint16_t depthdata[1000]; | |
907 uint8_t gasdata[1000]; | |
610 | 908 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
38 | 909 |
662 | 910 char msg[15]; |
911 char gas_name[15]; | |
912 int j = 0; | |
913 | |
914 loopMode = isLoopMode(logbookHeader.diveMode); | |
915 | |
916 /* check if gas was used, independent from its active state */ | |
917 for(index = 0; index < NUM_GASES * 2; index++) | |
918 { | |
919 gasWasUsed[index] = 0; | |
920 } | |
921 for(index = 0; index < dataLength; index++) | |
922 { | |
923 if(loopMode) | |
924 { | |
925 if(gasdata[index] < NUM_GASES) /* the log entry starts with a ID in range 1..4 independend if diluent is used at start */ | |
926 { | |
927 gasdata[index] += NUM_GASES; | |
928 } | |
929 else | |
930 { | |
931 loopMode = 0; /* after the first gas change, no matter if diluent or bailout, the correct ID will be stored */ | |
932 } | |
933 } | |
934 if(gasdata[index] > 0) | |
935 { | |
936 gasWasUsed[gasdata[index]-1] = 1; /* The ID stored in the samples is starting with 1 (array[0] = gasID1) */ | |
937 } | |
938 else | |
939 { | |
940 gasWasUsed[0] = 1; | |
941 } | |
942 } | |
943 | |
38 | 944 //--- print coordinate system & depth graph with gaschanges --- |
945 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); | |
946 | |
947 //--- print gas list --- | |
948 winsmal.left = wintemp.right - 190; | |
949 winsmal.right = winsmal.left + 150; | |
950 | |
662 | 951 loopMode = isLoopMode(logbookHeader.diveMode); |
952 for(index = (2 * NUM_GASES) -1; index >= 0; index--) | |
38 | 953 { |
662 | 954 if(gasWasUsed[index]) |
38 | 955 { |
956 j++; | |
662 | 957 if(j > 5) /* limit number of gases displayed to 5 */ |
958 { | |
959 break; | |
960 } | |
38 | 961 winsmal.top = wintemp.bottom - 5 - j * 26 ; |
962 winsmal.bottom = winsmal.top + 21 ; | |
662 | 963 uint8_t color = get_colour(index); |
38 | 964 |
662 | 965 if(loopMode) |
966 { | |
967 if(index < NUM_GASES) /* Switch to Bailout is not covered by log gas list */ | |
968 { | |
969 snprintf(gas_name,15,"Bailout"); | |
970 snprintf(msg,15,"G%d: %s",index +1, gas_name); | |
971 } | |
972 else | |
973 { | |
974 print_gas_name(gas_name,15,logbookHeader.gasordil[index-NUM_GASES].oxygen_percentage,logbookHeader.gasordil[index-NUM_GASES].helium_percentage); | |
975 snprintf(msg,15,"D%d: %s",index +1 - NUM_GASES, gas_name); | |
976 } | |
977 } | |
978 else | |
979 { | |
980 print_gas_name(gas_name,15,logbookHeader.gasordil[index].oxygen_percentage,logbookHeader.gasordil[index].helium_percentage); | |
981 snprintf(msg,15,"G%d: %s",index +1, gas_name); | |
982 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
983 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
38 | 984 } |
985 } | |
986 | |
987 //--- define buttons --- | |
988 /*if(*ghost_char_logfile_oxydata) | |
989 button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page4, surf1_menu_logbook_show_log_next); | |
990 else | |
991 button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page1, surf1_menu_logbook_show_log_next); | |
992 */ | |
993 } | |
994 | |
662 | 995 static uint8_t check_data_array_empty(uint16_t* pdata) |
996 { | |
997 uint8_t ret = 0; | |
998 uint8_t index = 0; | |
999 uint8_t emptyCnt = 0; | |
1000 | |
1001 for (index=0; index < 10; index++) /* read the first 10 data points. If all are 0 then the array is rated as empty */ | |
1002 { | |
1003 if(*(pdata+index) == 0) | |
1004 { | |
1005 emptyCnt++; | |
1006 } | |
1007 } | |
1008 if(emptyCnt == 10) | |
1009 { | |
1010 ret = 1; | |
1011 } | |
1012 return ret; | |
1013 } | |
1014 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1015 static void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
38 | 1016 { SWindowGimpStyle wintemp; |
1017 SWindowGimpStyle winsmal; | |
1018 wintemp.left = 50; | |
1019 wintemp.right = 799 - wintemp.left; | |
1020 wintemp.top = 50; | |
1021 wintemp.bottom = 479 - 40; | |
1022 uint8_t color = 0; | |
1023 SLogbookHeader logbookHeader; | |
1024 | |
1025 logbook_getHeader(StepBackwards, &logbookHeader); | |
1026 uint16_t dataLength = 0; | |
1027 uint16_t depthdata[1000]; | |
1028 uint8_t gasdata[1000]; | |
1029 uint16_t ppO2data[1000]; | |
1030 uint16_t sensor2[1000]; | |
1031 uint16_t sensor3[1000]; | |
662 | 1032 uint16_t *setpoint = ppO2data; |
1033 uint16_t *sensor1 = ppO2data; | |
1034 uint8_t sensorDataAvailable[] = {0,0,0}; | |
38 | 1035 |
1036 | |
662 | 1037 if(!isLoopMode(logbookHeader.diveMode)) |
610 | 1038 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
38 | 1039 else |
1040 { | |
662 | 1041 switch(logbookHeader.CCRmode) |
1042 { | |
1043 case CCRMODE_FixedSetpoint: | |
1044 default: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1045 break; | |
1046 case CCRMODE_Sensors: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL, NULL, NULL); | |
1047 if(!check_data_array_empty(sensor1)) | |
1048 { | |
1049 sensorDataAvailable[0] = 1; | |
1050 } | |
1051 if(!check_data_array_empty(sensor2)) | |
1052 { | |
1053 sensorDataAvailable[1] = 1; | |
1054 } | |
1055 if(!check_data_array_empty(sensor3)) | |
1056 { | |
1057 sensorDataAvailable[2] = 1; | |
1058 } | |
1059 if((logbookHeader.diveMode == DIVEMODE_PSCR) && (sensorDataAvailable[0] + sensorDataAvailable[1] + sensorDataAvailable[2] != 3)) /*insert sim data if not all three sensors are in use*/ | |
1060 { | |
1061 if(sensorDataAvailable[0] == 0) | |
1062 { | |
1063 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1064 sensorDataAvailable[0] = 1; | |
1065 } | |
1066 else if(sensorDataAvailable[1] == 0) | |
1067 { | |
1068 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1069 sensorDataAvailable[1] = 1; | |
1070 } | |
1071 else if(sensorDataAvailable[2] == 0) | |
1072 { | |
1073 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1074 sensorDataAvailable[2] = 1; | |
1075 } | |
1076 } | |
1077 break; | |
1078 case CCRMODE_Simulation: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1079 break; | |
1080 } | |
38 | 1081 } |
1082 | |
1083 | |
1084 //--- print coordinate system & depth graph with bailout--- | |
1085 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, NULL); | |
1086 | |
1087 | |
1088 | |
1089 //*** Desciption at bottom of page *************************** | |
1090 winsmal.top = wintemp.bottom +2 ; | |
1091 winsmal.bottom = winsmal.top + 16; | |
1092 | |
1093 | |
1094 /*if(strcmp( (char*)ghost_char_logfile_text_oc_ccr,"ccr/bailout") == 0) | |
1095 { | |
1096 winsmal.left = wintemp.left + 2; | |
1097 winsmal.right = winsmal.left + 55; | |
1098 | |
1099 oled_write(OVERLAY, &winsmal,"CCR -",false,true); | |
1100 | |
1101 winsmal.left = winsmal.right; | |
1102 winsmal.right = winsmal.left + 90; | |
1103 //winsmal.fontcolor = oled_get_colour(15); | |
1104 oled_write(OVERLAY, &winsmal,"bailout",false,true); | |
1105 } | |
1106 else*/ | |
1107 { | |
1108 winsmal.left = wintemp.left + 2; | |
1109 winsmal.right = winsmal.left + 55; | |
1110 color = CLUT_GasSensor1;//LOGBOOK_GRAPH_DEPTH; | |
1111 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1112 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"depth"); |
38 | 1113 |
1114 } | |
1115 winsmal.left = 799 - 67;//wintemp.right -67; | |
1116 winsmal.right = winsmal.left;// + 45; | |
1117 | |
662 | 1118 color = CLUT_LogbookTemperature; |
1119 | |
1120 if(!isLoopMode(logbookHeader.diveMode)) | |
1121 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1122 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002PP O2"); |
662 | 1123 } |
38 | 1124 else |
662 | 1125 { |
1126 switch(logbookHeader.CCRmode) | |
1127 { | |
1128 case CCRMODE_FixedSetpoint: | |
1129 default: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SETPOINT"); | |
1130 break; | |
1131 case CCRMODE_Sensors: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SENSORS"); | |
1132 break; | |
1133 case CCRMODE_Simulation: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SIM PPO2"); | |
1134 break; | |
1135 } | |
1136 } | |
38 | 1137 |
1138 //*** PP O2 **************************************************** | |
1139 //calc lines and labels | |
1140 int datamax = 0; | |
1141 int datamin = 10000; | |
1142 for(int i=1;i<dataLength;i++) | |
1143 { | |
1144 if(ppO2data[i]>datamax) | |
1145 datamax = ppO2data[i]; | |
1146 if(ppO2data[i]<datamin) | |
1147 datamin = ppO2data[i]; | |
1148 } | |
662 | 1149 if(isLoopMode(logbookHeader.diveMode) && (logbookHeader.CCRmode == CCRMODE_Sensors)) |
38 | 1150 { |
1151 for(int i=1;i<dataLength;i++) | |
1152 { | |
1153 if(sensor2[i]>datamax) | |
1154 datamax = sensor2[i]; | |
1155 if(sensor2[i]<datamin) | |
1156 datamin = sensor2[i]; | |
1157 if(sensor3[i]>datamax) | |
1158 datamax = sensor3[i]; | |
1159 if(sensor3[i]<datamin) | |
1160 datamin = sensor3[i]; | |
1161 } | |
1162 } | |
1163 float maxoxy = ((float)datamax)/100; | |
1164 float minoxy = ((float)datamin)/100; | |
1165 float oxystep = 0.5; | |
1166 float maxoxyline = 2.5; | |
1167 | |
1168 //--- print PP O2 labels ---- | |
1169 winsmal.left = wintemp.right + 2; | |
1170 winsmal.top = wintemp.top ; | |
1171 winsmal.right = wintemp.right + 30; | |
1172 winsmal.bottom = winsmal.top + 16; | |
1173 //winsmal.font = ft_tiny + ft_SLIM; | |
1174 color = CLUT_LogbookTemperature;// = LOGBOOK_GRAPH_TEMP; | |
1175 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1176 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"bar"); |
38 | 1177 |
1178 int deltaline = (wintemp.bottom - wintemp.top)/5; | |
1179 char msg[4]; | |
1180 float oxy = maxoxyline; | |
1181 for(int i = 1; i<=5; i++) | |
1182 { | |
1183 oxy -= oxystep; | |
1184 if(oxy < 0) | |
1185 break; | |
1186 winsmal.top = wintemp.top + deltaline * i - 8; | |
1187 winsmal.bottom = winsmal.top + 16; | |
1188 snprintf(msg,4,"%1.1f",oxy); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1189 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
38 | 1190 //oled_write(OVERLAY, &winsmal,msg,false,true); |
1191 } | |
1192 | |
1193 //--- print PP O2 graph --- | |
1194 //Adapt window | |
1195 float ftmp = ((maxoxyline - minoxy) * deltaline) /oxystep + wintemp.top; | |
1196 wintemp.bottom = ftmp; | |
1197 if((ftmp - (int)ftmp) >= 0.5f) | |
1198 wintemp.bottom++; | |
1199 | |
1200 ftmp = wintemp.top + ((maxoxyline - maxoxy) * deltaline) /oxystep; | |
1201 wintemp.top = ftmp; | |
1202 if((ftmp - (int)ftmp) >= 0.5f) | |
1203 wintemp.top++; | |
1204 wintemp.top = MaxU32LOG(wintemp.top ,0); | |
1205 if(wintemp.top < wintemp.bottom) | |
1206 { | |
662 | 1207 if(isLoopMode(logbookHeader.diveMode) && (logbookHeader.CCRmode == CCRMODE_Sensors)) |
38 | 1208 { |
662 | 1209 if(sensorDataAvailable[0]) |
1210 { | |
1211 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, ppO2data,dataLength,CLUT_GasSensor2, NULL); | |
1212 } | |
1213 if(sensorDataAvailable[1]) | |
1214 { | |
1215 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, sensor2,dataLength,CLUT_GasSensor3, NULL); | |
1216 } | |
1217 if(sensorDataAvailable[2]) | |
1218 { | |
1219 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, sensor3,dataLength,CLUT_GasSensor4, NULL); | |
1220 } | |
38 | 1221 } |
1222 else | |
1223 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, ppO2data,dataLength,CLUT_LogbookTemperature, NULL); | |
1224 } | |
1225 else | |
1226 { | |
1227 point_t startPoint, stopPoint; | |
1228 startPoint.x = wintemp.left; | |
1229 stopPoint.x = wintemp.right; | |
1230 stopPoint.y = startPoint.y = 479 - wintemp.top; | |
1231 GFX_draw_colorline(hgfx, startPoint, stopPoint, CLUT_LogbookTemperature); | |
1232 } | |
1233 | |
1234 //--- define buttons --- | |
1235 //button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page1, surf1_menu_logbook_show_log_next); | |
1236 } | |
1237 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1238 static void print_gas_name(char* output,uint8_t length,uint8_t oxygen,uint8_t helium) |
38 | 1239 { |
1240 if(helium == 0) | |
1241 { | |
1242 if(oxygen == 21) | |
1243 snprintf(output, length, "Air"); | |
1244 else if(oxygen == 100) | |
1245 snprintf(output, length, "Oxy"); | |
1246 else | |
1247 snprintf(output, length, "NX%i",oxygen); | |
1248 } | |
1249 else | |
1250 { | |
1251 if((oxygen + helium) == 100) | |
1252 snprintf(output, length, "HX%i",oxygen); | |
1253 else | |
1254 snprintf(output, length, "TMX%i/%i", oxygen, helium); | |
1255 } | |
1256 | |
1257 } | |
1258 | |
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1259 static int16_t get_colour(int16_t color) |
38 | 1260 { |
1261 return CLUT_GasSensor1 + color; | |
1262 } | |
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1263 |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1264 uint8_t getActiveLogPage() |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1265 { |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1266 return active_log_page; |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1267 } |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1268 |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1269 void updateReplayIncdicator(GFX_DrawCfgScreen *hgfx) |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1270 { |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1271 build_logbook_test(1,active_log_offset); |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1272 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480); |
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1273 } |