Mercurial > public > ostc4
annotate Discovery/Src/show_logbook.c @ 1061:f501d7c35c8f Icon_Integration
Show/ edit bottle size and pressure:
The function to visualize bottle data was already present in an earlier implementation. The functions have be reactivated and may now be added using the compile switch "ENABLE_ADVANCED_GAS". The size of a bottle may be selected and pressure information will be displayed if it is available.
| author | Ideenmodellierer |
|---|---|
| date | Sat, 07 Feb 2026 21:39:40 +0100 |
| parents | 3c73180fde1d |
| 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; | |
| 1058 | 438 uint8_t fw_first = 0; |
| 439 uint8_t fw_second = 0; | |
| 440 uint8_t fw_third = 0; | |
| 38 | 441 |
| 442 SLogbookHeader logbookHeader; | |
| 443 logbook_getHeader(StepBackwards ,&logbookHeader); | |
| 444 | |
| 445 uint16_t depthdata[1000] = { 0 }; | |
| 446 uint8_t gasdata[1000] = { 0 }; | |
| 447 int16_t tempdata[1000] = { 0 }; | |
|
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
448 uint16_t tankdata[1000] = { 0 }; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
449 |
| 941 | 450 SGnssCoord posCoord; |
| 451 posCoord.fLat = 0.0; | |
| 452 posCoord.fLon = 0.0; | |
| 453 | |
|
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
454 #ifdef ENABLE_BOTTLE_SENSOR |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
455 uint16_t bottlePressureStart = 0; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
456 uint16_t bottlePressureEnd = 0; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
457 uint16_t loop = 0; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
458 #endif |
| 38 | 459 |
| 460 uint16_t dataLength = 0; | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
461 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tankdata, NULL, &posCoord, NULL, NULL); |
| 38 | 462 |
| 463 //Print Date | |
| 464 uint8_t year = logbookHeader.dateYear; | |
| 465 uint8_t month = logbookHeader.dateMonth; | |
| 466 uint8_t day = logbookHeader.dateDay; | |
| 467 char text[40]; | |
| 468 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
|
469 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
470 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
|
471 |
| 988 | 472 #if defined ENABLE_GNSS_INTERN || defined ENABLE_GNSS_EXTERN |
| 941 | 473 if((posCoord.fLat != 0.0) || (posCoord.fLon != 0.0)) |
| 474 { | |
| 475 snprintf(text, 20, "%2.4f - %2.4f", posCoord.fLat, posCoord.fLon ); | |
| 476 Gfx_write_label_var(hgfx, 300, 500,10, &FontT42,CLUT_GasSensor1,text); | |
| 477 } | |
| 478 #endif | |
| 479 | |
| 38 | 480 |
| 481 // Print logbook number with offset | |
| 482 if(settingsGetPointer()->logbookOffset) | |
| 483 { | |
| 484 int32_t logNumber; | |
| 485 logNumber = settingsGetPointer()->logbookOffset - StepBackwards; | |
| 486 if(logNumber < 0) | |
| 487 logNumber = 0; | |
| 488 else | |
| 489 if(logNumber > 9999) | |
| 490 logNumber = 9999; | |
| 491 | |
| 457 | 492 snprintf(text,20,"#%ld",logNumber); |
| 38 | 493 Gfx_write_label_var(hgfx, 300, 590,10, &FontT42,CLUT_GasSensor1,text); |
| 494 } | |
| 495 | |
| 496 //Print time | |
| 497 uint8_t minute = logbookHeader.timeMinute; | |
| 567 | 498 |
| 499 if (settingsGetPointer()->amPMTime) | |
| 500 { | |
| 501 if (logbookHeader.timeHour > 11) | |
| 502 { | |
| 503 timeSuffix = 'P'; | |
| 504 } | |
| 505 else | |
| 506 { | |
| 507 timeSuffix = 'A'; | |
| 508 } | |
| 509 | |
| 510 if (logbookHeader.timeHour % 12 == 0) | |
| 511 { | |
| 512 hoursToDisplay = 12; | |
| 513 } | |
| 514 else | |
| 515 { | |
| 516 hoursToDisplay = (logbookHeader.timeHour % 12); | |
| 517 } | |
| 518 | |
| 519 snprintf(text,20,"\002%02i:%02i %cM",hoursToDisplay,minute,timeSuffix); | |
| 520 } | |
| 521 else | |
| 522 { | |
| 523 hoursToDisplay = logbookHeader.timeHour; | |
| 524 snprintf(text,20,"\002%02i:%02i",hoursToDisplay,minute); | |
| 525 } | |
| 526 | |
| 527 | |
| 484 | 528 Gfx_write_label_var(hgfx, 600, wintemp.right,10, &FontT42,CLUT_GasSensor1,text); |
| 38 | 529 |
| 530 //Print Dive Mode (OC/CCR/...) | |
| 531 switch(logbookHeader.diveMode) | |
| 532 { | |
| 533 case DIVEMODE_OC: | |
| 662 | 534 snprintf(text,20,"%c",TXT_OpenCircuit); |
| 38 | 535 break; |
| 536 case DIVEMODE_CCR: | |
| 662 | 537 snprintf(text,20,"%c",TXT_ClosedCircuit); |
| 38 | 538 break; |
| 539 case DIVEMODE_Gauge: | |
| 662 | 540 snprintf(text,20,"%c",TXT_Gauge); |
| 38 | 541 break; |
| 542 case DIVEMODE_Apnea: | |
| 662 | 543 snprintf(text,20,"%c",TXT_Apnoe); |
| 544 break; | |
| 545 case DIVEMODE_PSCR: | |
| 546 snprintf(text,20,"%c",TXT_PSClosedCircuit); | |
| 38 | 547 break; |
| 548 } | |
| 549 Gfx_write_label_var(hgfx, 30, 250,60, &FontT42,CLUT_GasSensor4,text); | |
| 550 | |
| 551 // Decomodel | |
| 552 if(logbookHeader.diveMode <= DIVEMODE_CCR) | |
| 553 { | |
| 554 switch(logbookHeader.decoModel) | |
| 555 { | |
| 556 case GF_MODE: | |
| 557 snprintf(text,20,"\002GF%u/%u",logbookHeader.gfLow_or_Vpm_conservatism,logbookHeader.gfHigh); | |
| 484 | 558 break; |
| 38 | 559 case VPM_MODE: |
| 560 snprintf(text,20,"\002VPM +%u",logbookHeader.gfLow_or_Vpm_conservatism); | |
| 484 | 561 break; |
| 562 default: | |
| 563 snprintf(text,20," "); /* no information to be displayed */ | |
| 564 break; | |
| 38 | 565 } |
| 484 | 566 Gfx_write_label_var(hgfx, 500, wintemp.right,60, &FontT42,CLUT_GasSensor1,text); |
| 38 | 567 } |
| 568 | |
| 569 //Write Dive Time | |
| 570 int minutes = logbookHeader.diveTimeMinutes; | |
| 571 int seconds = logbookHeader.diveTimeSeconds; | |
| 572 int hours = minutes/60; | |
| 573 minutes -= hours * 60; | |
| 574 snprintf(text,20,"%02i:%02i:%02i",hours,minutes,seconds); | |
| 575 Gfx_write_label_var(hgfx, 30, 250,360, &FontT42,CLUT_GasSensor1,text); | |
| 576 Gfx_write_label_var(hgfx, 200, 250,360, &FontT42,CLUT_GasSensor4,"s"); | |
| 577 | |
| 578 // Max Depth | |
| 579 int maxdepth =logbookHeader.maxDepth/100; | |
| 580 int maxdepth_dcm = logbookHeader.maxDepth/10 - maxdepth * 10; | |
| 581 int top = 150; | |
| 582 if(settingsGetPointer()->nonMetricalSystem) | |
| 583 { | |
| 584 float maxDepthFeet = 0; | |
| 585 maxDepthFeet = unit_depth_float(((float)logbookHeader.maxDepth)/100); | |
| 586 snprintf(text,20,"%.0f",maxDepthFeet); | |
| 587 } | |
| 588 else | |
| 589 { | |
| 590 snprintf(text,20,"%i.%i",maxdepth,maxdepth_dcm); | |
| 591 } | |
| 592 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | |
| 593 winsmal.left = 30; | |
| 594 winsmal.top = top -3; | |
| 595 winsmal.bottom = winsmal.top + FontT42.height; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
596 |
| 38 | 597 if(maxdepth < 10) |
| 598 { | |
| 599 winsmal.left = 137; | |
| 600 } | |
| 601 else if(maxdepth < 100) | |
| 602 { | |
| 603 winsmal.left = 151; | |
| 604 } | |
| 605 else | |
| 606 { | |
| 607 winsmal.left = 147; | |
| 608 } | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
609 winsmal.right = winsmal.left + 50; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
610 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
611 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,top, &FontT24,CLUT_GasSensor4,"max"); |
| 38 | 612 snprintf(text,3,"%c%c" |
| 613 , unit_depth_char1() | |
| 614 , unit_depth_char2() | |
| 615 ); | |
| 616 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | |
| 617 | |
| 618 // Average Depth | |
| 619 int avrdepth =logbookHeader.averageDepth_mbar/100; | |
| 620 int avrdepth_dcm = logbookHeader.averageDepth_mbar/10 - avrdepth * 10; | |
| 621 top = 200; | |
| 622 if(settingsGetPointer()->nonMetricalSystem) | |
| 623 { | |
| 624 float avgDepthFeet = 0; | |
| 625 avgDepthFeet = unit_depth_float(((float)logbookHeader.averageDepth_mbar)/100); | |
| 626 snprintf(text,20,"%.0f",avgDepthFeet); | |
| 627 } | |
| 628 else | |
| 629 { | |
| 630 snprintf(text,20,"%i.%i",avrdepth,avrdepth_dcm); | |
| 631 } | |
| 632 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
|
633 |
| 38 | 634 winsmal.left = 30; |
| 635 winsmal.top = top -3; | |
| 636 winsmal.bottom = winsmal.top + FontT42.height; | |
|
110
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 /* put avg behind previous string */ |
| 38 | 639 if(avrdepth < 10) |
| 640 { | |
| 641 winsmal.left = 137 ; | |
| 642 } | |
| 643 else if(avrdepth < 100) | |
| 644 { | |
| 645 winsmal.left = 151; | |
| 646 } | |
| 647 else | |
| 648 { | |
| 649 winsmal.left = 147; | |
| 650 } | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
651 winsmal.right = winsmal.left + 50; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
652 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
653 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor4,"avg"); |
| 38 | 654 snprintf(text,3,"%c%c" |
| 655 , unit_depth_char1() | |
| 656 , unit_depth_char2() | |
| 657 ); | |
| 658 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | |
| 659 // Temperature | |
| 660 top+= 50; | |
| 661 float temp_Temperature; | |
| 662 uint16_t start; | |
| 663 temp_Temperature = ((float)logbookHeader.minTemp)/10; | |
| 664 snprintf(text,20,"%.1f",unit_temperature_float(temp_Temperature)); | |
| 665 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | |
| 666 | |
| 667 if(settingsGetPointer()->nonMetricalSystem) | |
| 668 start = 121; | |
| 669 else if((logbookHeader.minTemp >= 0) && (logbookHeader.minTemp < 10)) | |
| 670 start = 100; | |
| 671 else if((logbookHeader.minTemp >= -10) && (logbookHeader.minTemp < 100)) | |
| 672 start = 114; | |
| 673 else | |
| 674 start = 121; | |
| 675 | |
| 676 text[0] = '\140'; | |
| 677 if(settingsGetPointer()->nonMetricalSystem) | |
| 678 text[1] = 'F'; | |
| 679 else | |
| 680 text[1] = 'C'; | |
| 681 text[2] = 0; | |
| 682 | |
| 683 Gfx_write_label_var(hgfx, start, 300,top, &FontT42,CLUT_GasSensor4,text); | |
| 684 | |
| 1058 | 685 if(logbookHeader.decoModel == GF_MODE) |
| 686 { | |
| 687 firmwareVersionfrom16bit(logbookHeader.firmwareVersionHigh, logbookHeader.firmwareVersionLow, &fw_first, &fw_second, &fw_third); | |
| 688 if((fw_first >= GF_SURF_FW_FIRST) && (fw_second >= GF_SURF_FW_SECOND) && (fw_third >= GF_SURF_FW_THIRD)) | |
| 689 { | |
| 690 top+= 50; | |
| 691 start = 30; | |
| 692 snprintf(text,20,"%u",logbookHeader.gfAtEnd); | |
| 693 Gfx_write_label_var(hgfx, start, 300,top, &FontT42,CLUT_GasSensor1,text); | |
| 694 start += FontT42.spacesize2Monospaced + 5; | |
| 695 if(logbookHeader.gfAtEnd > 99) | |
| 696 { | |
| 697 start += FontT42.spacesize2Monospaced * 2; | |
| 698 } | |
| 699 if(logbookHeader.gfAtEnd > 9) | |
| 700 { | |
| 701 start += FontT42.spacesize2Monospaced; | |
| 702 } | |
| 703 snprintf(text,20,"%c%c",TXT_2BYTE,TXT2BYTE_GFSurf); | |
| 704 Gfx_write_label_var(hgfx, start, 300,top, &FontT24,CLUT_GasSensor4,text); | |
| 705 } | |
| 706 } | |
| 707 | |
| 38 | 708 // CNS |
| 709 snprintf(text,20,"CNS: %i %%",logbookHeader.maxCNS); | |
|
150
097d7146b779
Place CNS and pressure within the screen (avoid clipping)
Ideenmodellierer
parents:
115
diff
changeset
|
710 Gfx_write_label_var(hgfx, 30, 250,440, &FontT42,CLUT_GasSensor1,text); |
| 38 | 711 |
| 712 // Surface Pressure | |
| 713 // snprintf(text,20,"\001%i\016\016 mbar",logbookHeader.surfacePressure_mbar); | |
| 714 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text); | |
| 715 // 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
|
716 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
|
717 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text); |
| 38 | 718 |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
719 |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
720 /* 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
|
721 snprintf(text,10,"\002>"); |
|
616
a594a778c883
Development bugfix: show replay symbol only for the selected dive:
Ideenmodellierer
parents:
610
diff
changeset
|
722 if(StepBackwards == getReplayOffset()) |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
723 { |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
724 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
|
725 } |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
726 else |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
727 { |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
728 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
|
729 } |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
730 |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
731 |
|
454
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
732 /* Show tank info */ |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
733 #ifdef ENABLE_BOTTLE_SENSOR |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
734 for(loop = 0; loop < dataLength; loop++) |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
735 { |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
736 if((bottlePressureStart == 0) && (tankdata[loop] != 0)) /* find first pressure value */ |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
737 { |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
738 bottlePressureStart = tankdata[loop]; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
739 } |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
740 if((tankdata[loop] != 0)) /* store last pressure value */ |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
741 { |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
742 bottlePressureEnd = tankdata[loop]; |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
743 } |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
744 } |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
745 if(bottlePressureStart != 0) |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
746 { |
| 484 | 747 snprintf(text,40,"\002%i | %i\016\016 Bar\017",bottlePressureStart,bottlePressureEnd); |
| 748 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
|
749 } |
|
5a633dece17a
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
186
diff
changeset
|
750 #endif |
| 38 | 751 //--- print coordinate system & depth graph with gaschanges --- |
| 752 wintemp.left = 330; | |
| 753 wintemp.top = 160; | |
| 754 wintemp.bottom -= 40; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
755 |
| 38 | 756 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); |
| 757 } | |
| 758 | |
| 759 | |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
760 static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
| 38 | 761 { |
| 762 //*** Page2: Depth and Temperature **** | |
| 763 | |
| 764 SWindowGimpStyle wintemp; | |
| 765 SWindowGimpStyle winsmal; | |
| 766 wintemp.left = 50; | |
| 767 wintemp.right = 799 - wintemp.left; | |
| 768 wintemp.top = 50; | |
| 769 wintemp.bottom = 479 - 40; | |
| 770 | |
| 771 SLogbookHeader logbookHeader; | |
| 772 | |
| 773 logbook_getHeader(StepBackwards,&logbookHeader); | |
| 774 uint16_t dataLength = 0; | |
| 775 uint16_t depthdata[1000]; | |
| 776 uint8_t gasdata[1000]; | |
| 777 int16_t tempdata[1000]; | |
| 778 uint16_t decoDepthdata[1000]; | |
| 779 uint16_t *pDecoDepthData = 0; | |
| 780 | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
781 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata, NULL, NULL, NULL, NULL, NULL); |
| 38 | 782 |
| 783 for(int i = 0; i<dataLength; i++) | |
| 784 { | |
| 785 if(decoDepthdata[i] >= 300) | |
| 786 { | |
| 787 pDecoDepthData = decoDepthdata; | |
| 788 break; | |
| 789 } | |
| 790 } | |
| 791 //--- print coordinate system & depth graph --- | |
| 792 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, pDecoDepthData); | |
| 793 | |
| 794 //*** Temperature ************************************************* | |
| 795 | |
| 796 //--- print temperature labels --- | |
| 797 // input maxtmpline, tmpstep, deltaline | |
| 798 | |
| 799 winsmal.left = wintemp.right +6; | |
| 800 winsmal.top = wintemp.top - 3; | |
| 801 winsmal.right = wintemp.right + 30; | |
| 802 winsmal.bottom = winsmal.top + 16; | |
| 803 | |
| 567 | 804 if(settingsGetPointer()->nonMetricalSystem) |
| 805 { | |
| 806 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[F]"); | |
| 807 } | |
| 808 else | |
| 809 { | |
| 810 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]"); | |
| 811 } | |
| 38 | 812 |
| 813 int16_t minVal = 0; | |
| 814 int16_t maxVal = 0; | |
| 815 int newTop = 0; | |
| 816 int newBottom = 0; | |
| 817 uint16_t step = 0; | |
| 818 int16_t maxValTop = 0; | |
| 653 | 819 int16_t tmp = 0; |
| 38 | 820 |
| 821 scaleHelper(dataLength, tempdata, wintemp.top, wintemp.bottom, | |
| 822 &minVal, &maxVal, &newTop, &newBottom, | |
| 823 &step, &maxValTop); // newTop is wintemp.top | |
| 824 | |
| 825 scaleAdapt( wintemp.top, wintemp.bottom, | |
| 826 &minVal, &maxVal, &newTop, &newBottom, | |
| 827 &step, &maxValTop); | |
| 828 | |
| 829 // temperature in 1/10 �C | |
| 830 int deltaline = (1 + wintemp.bottom - wintemp.top)/5; | |
| 632 | 831 char msg[15]; |
| 653 | 832 |
| 833 /* temperature is provided in centi scaling => convert */ | |
| 834 maxValTop /= 10; | |
| 835 step /= 10; | |
| 836 | |
| 837 tmp = maxValTop; | |
| 38 | 838 for(int i = 1; i<=5; i++) |
| 839 { | |
| 840 tmp -= step; | |
| 841 winsmal.top = wintemp.top + deltaline * i - 14; | |
| 842 winsmal.bottom = winsmal.top + 16; | |
| 653 | 843 snprintf(msg,15,"%2i",unit_temperature_integer(tmp)); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
844 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); |
| 38 | 845 } |
| 846 | |
| 847 | |
| 848 //--- print temperature graph --- | |
| 849 // input tempdata[i], maxtmpline, mintmpline, maxTmp, minTmp, deltaline, wintemp.top, dataLength, datamax, | |
| 850 | |
| 851 //adapt window | |
| 852 wintemp.bottom = newBottom; | |
| 853 wintemp.top = newTop; | |
| 854 GFX_graph_print(hgfx,&wintemp,0,1,maxVal,minVal, (uint16_t *)tempdata,dataLength,CLUT_LogbookTemperature, NULL); | |
| 855 } | |
| 856 | |
| 857 | |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
858 static void build_logbook_test(uint8_t page, uint8_t StepBackwards) |
| 38 | 859 { |
| 860 uint32_t lastScreen,lastBackground; | |
| 861 | |
| 862 lastScreen = tLOGscreen.FBStartAdress; | |
| 863 lastBackground = tLOGbackground.FBStartAdress; | |
| 864 | |
| 865 tLOGscreen.FBStartAdress = getFrame(16); | |
| 866 tLOGscreen.ImageHeight = 480; | |
| 867 tLOGscreen.ImageWidth = 800; | |
| 868 tLOGscreen.LayerIndex = 1; | |
| 869 | |
| 870 tLOGbackground.FBStartAdress = getFrame(17); | |
| 871 tLOGbackground.ImageHeight = 480; | |
| 872 tLOGbackground.ImageWidth = 800; | |
| 873 tLOGbackground.LayerIndex = 0; | |
| 874 switch(page) | |
| 875 { | |
| 876 case 1: | |
| 877 show_logbook_logbook_show_log_page1(&tLOGscreen,StepBackwards); | |
| 878 break; | |
| 879 case 2: | |
| 880 show_logbook_logbook_show_log_page2(&tLOGscreen,StepBackwards); | |
| 881 break; | |
| 882 case 3: | |
| 883 show_logbook_logbook_show_log_page3(&tLOGscreen,StepBackwards); | |
| 884 break; | |
| 885 case 4: | |
| 886 show_logbook_logbook_show_log_page4(&tLOGscreen,StepBackwards); | |
| 887 break; | |
| 888 } | |
| 889 | |
| 890 releaseFrame(16,lastScreen); | |
| 891 releaseFrame(17,lastBackground); | |
| 892 } | |
| 893 | |
| 894 | |
| 895 void show_logbook_test(_Bool firstPage, uint8_t StepBackwards) | |
| 896 { | |
| 897 if(firstPage) | |
| 898 { | |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
899 active_log_page = 1; |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
900 active_log_offset = StepBackwards; |
| 38 | 901 } |
| 902 else | |
| 903 { | |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
904 active_log_page++; |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
905 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
|
906 { |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
907 active_log_page = 1; |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
908 } |
| 38 | 909 } |
| 910 | |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
911 build_logbook_test(active_log_page,StepBackwards); |
| 38 | 912 // GFX_ResetLayer(TOP_LAYER); |
| 913 // GFX_ResetLayer(BACKGRD_LAYER); | |
| 914 | |
| 915 set_globalState(StILOGSHOW); | |
| 916 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480); | |
| 917 } | |
| 918 | |
| 919 | |
| 920 void show_logbook_exit(void) | |
| 921 { | |
| 922 releaseFrame(16,tLOGscreen.FBStartAdress); | |
| 923 releaseFrame(17,tLOGbackground.FBStartAdress); | |
| 924 } | |
| 925 | |
|
994
bad5561c0c59
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
heinrichsweikamp
parents:
988
diff
changeset
|
926 #define MSG_LENGTH 30 |
| 38 | 927 |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
928 static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
| 38 | 929 { |
| 930 SWindowGimpStyle wintemp; | |
| 931 SWindowGimpStyle winsmal; | |
| 662 | 932 uint8_t gasWasUsed[NUM_GASES * 2]; |
| 933 int16_t index = 0; | |
| 934 uint8_t loopMode = 0; | |
| 935 | |
| 38 | 936 wintemp.left = 50; |
| 937 wintemp.right = 799 - wintemp.left; | |
| 938 wintemp.top = 50; | |
| 939 wintemp.bottom = 479 - 40; | |
| 940 | |
| 941 SLogbookHeader logbookHeader; | |
| 942 | |
| 943 logbook_getHeader(StepBackwards, &logbookHeader); | |
| 944 uint16_t dataLength = 0; | |
| 945 uint16_t depthdata[1000]; | |
| 946 uint8_t gasdata[1000]; | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
947 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 38 | 948 |
|
994
bad5561c0c59
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
heinrichsweikamp
parents:
988
diff
changeset
|
949 char msg[MSG_LENGTH]; |
| 662 | 950 char gas_name[15]; |
| 951 int j = 0; | |
| 952 | |
| 953 loopMode = isLoopMode(logbookHeader.diveMode); | |
| 954 | |
| 955 /* check if gas was used, independent from its active state */ | |
| 956 for(index = 0; index < NUM_GASES * 2; index++) | |
| 957 { | |
| 958 gasWasUsed[index] = 0; | |
| 959 } | |
| 960 for(index = 0; index < dataLength; index++) | |
| 961 { | |
| 962 if(loopMode) | |
| 963 { | |
| 964 if(gasdata[index] < NUM_GASES) /* the log entry starts with a ID in range 1..4 independend if diluent is used at start */ | |
| 965 { | |
| 966 gasdata[index] += NUM_GASES; | |
| 967 } | |
| 968 else | |
| 969 { | |
| 970 loopMode = 0; /* after the first gas change, no matter if diluent or bailout, the correct ID will be stored */ | |
| 971 } | |
| 972 } | |
| 973 if(gasdata[index] > 0) | |
| 974 { | |
| 975 gasWasUsed[gasdata[index]-1] = 1; /* The ID stored in the samples is starting with 1 (array[0] = gasID1) */ | |
| 976 } | |
| 977 else | |
| 978 { | |
| 979 gasWasUsed[0] = 1; | |
| 980 } | |
| 981 } | |
| 982 | |
| 38 | 983 //--- print coordinate system & depth graph with gaschanges --- |
| 984 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); | |
| 985 | |
| 986 //--- print gas list --- | |
| 987 winsmal.left = wintemp.right - 190; | |
| 988 winsmal.right = winsmal.left + 150; | |
| 989 | |
| 662 | 990 loopMode = isLoopMode(logbookHeader.diveMode); |
| 991 for(index = (2 * NUM_GASES) -1; index >= 0; index--) | |
| 38 | 992 { |
| 662 | 993 if(gasWasUsed[index]) |
| 38 | 994 { |
| 995 j++; | |
| 662 | 996 if(j > 5) /* limit number of gases displayed to 5 */ |
| 997 { | |
| 998 break; | |
| 999 } | |
| 38 | 1000 winsmal.top = wintemp.bottom - 5 - j * 26 ; |
| 1001 winsmal.bottom = winsmal.top + 21 ; | |
| 662 | 1002 uint8_t color = get_colour(index); |
| 38 | 1003 |
| 662 | 1004 if(loopMode) |
| 1005 { | |
| 1006 if(index < NUM_GASES) /* Switch to Bailout is not covered by log gas list */ | |
| 1007 { | |
| 1008 snprintf(gas_name,15,"Bailout"); | |
|
994
bad5561c0c59
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
heinrichsweikamp
parents:
988
diff
changeset
|
1009 snprintf(msg, MSG_LENGTH, "G%d: %s", index +1, gas_name); |
| 662 | 1010 } |
| 1011 else | |
| 1012 { | |
| 1013 print_gas_name(gas_name,15,logbookHeader.gasordil[index-NUM_GASES].oxygen_percentage,logbookHeader.gasordil[index-NUM_GASES].helium_percentage); | |
|
994
bad5561c0c59
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
heinrichsweikamp
parents:
988
diff
changeset
|
1014 snprintf(msg, MSG_LENGTH, "D%d: %s", index + 1 - NUM_GASES, gas_name); |
| 662 | 1015 } |
| 1016 } | |
| 1017 else | |
| 1018 { | |
| 1019 print_gas_name(gas_name,15,logbookHeader.gasordil[index].oxygen_percentage,logbookHeader.gasordil[index].helium_percentage); | |
|
994
bad5561c0c59
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
heinrichsweikamp
parents:
988
diff
changeset
|
1020 snprintf(msg, MSG_LENGTH, "G%d: %s", index + 1, gas_name); |
| 662 | 1021 } |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1022 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
| 38 | 1023 } |
| 1024 } | |
| 1025 | |
| 1026 //--- define buttons --- | |
| 1027 /*if(*ghost_char_logfile_oxydata) | |
| 1028 button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page4, surf1_menu_logbook_show_log_next); | |
| 1029 else | |
| 1030 button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page1, surf1_menu_logbook_show_log_next); | |
| 1031 */ | |
| 1032 } | |
| 1033 | |
| 662 | 1034 static uint8_t check_data_array_empty(uint16_t* pdata) |
| 1035 { | |
| 1036 uint8_t ret = 0; | |
| 1037 uint8_t index = 0; | |
| 1038 uint8_t emptyCnt = 0; | |
| 1039 | |
| 1040 for (index=0; index < 10; index++) /* read the first 10 data points. If all are 0 then the array is rated as empty */ | |
| 1041 { | |
| 1042 if(*(pdata+index) == 0) | |
| 1043 { | |
| 1044 emptyCnt++; | |
| 1045 } | |
| 1046 } | |
| 1047 if(emptyCnt == 10) | |
| 1048 { | |
| 1049 ret = 1; | |
| 1050 } | |
| 1051 return ret; | |
| 1052 } | |
| 1053 | |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1054 static void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
| 38 | 1055 { SWindowGimpStyle wintemp; |
| 1056 SWindowGimpStyle winsmal; | |
| 1057 wintemp.left = 50; | |
| 1058 wintemp.right = 799 - wintemp.left; | |
| 1059 wintemp.top = 50; | |
| 1060 wintemp.bottom = 479 - 40; | |
| 1061 uint8_t color = 0; | |
| 1062 SLogbookHeader logbookHeader; | |
| 1063 | |
| 1064 logbook_getHeader(StepBackwards, &logbookHeader); | |
| 1065 uint16_t dataLength = 0; | |
| 1066 uint16_t depthdata[1000]; | |
| 1067 uint8_t gasdata[1000]; | |
| 1068 uint16_t ppO2data[1000]; | |
| 1069 uint16_t sensor2[1000]; | |
| 1070 uint16_t sensor3[1000]; | |
| 662 | 1071 uint16_t *setpoint = ppO2data; |
| 1072 uint16_t *sensor1 = ppO2data; | |
| 1073 uint8_t sensorDataAvailable[] = {0,0,0}; | |
| 38 | 1074 |
| 1075 | |
| 662 | 1076 if(!isLoopMode(logbookHeader.diveMode)) |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1077 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 38 | 1078 else |
| 1079 { | |
| 662 | 1080 switch(logbookHeader.CCRmode) |
| 1081 { | |
| 1082 case CCRMODE_FixedSetpoint: | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1083 default: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1084 break; |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1085 case CCRMODE_Sensors: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1086 if(!check_data_array_empty(sensor1)) |
| 1087 { | |
| 1088 sensorDataAvailable[0] = 1; | |
| 1089 } | |
| 1090 if(!check_data_array_empty(sensor2)) | |
| 1091 { | |
| 1092 sensorDataAvailable[1] = 1; | |
| 1093 } | |
| 1094 if(!check_data_array_empty(sensor3)) | |
| 1095 { | |
| 1096 sensorDataAvailable[2] = 1; | |
| 1097 } | |
| 1098 if((logbookHeader.diveMode == DIVEMODE_PSCR) && (sensorDataAvailable[0] + sensorDataAvailable[1] + sensorDataAvailable[2] != 3)) /*insert sim data if not all three sensors are in use*/ | |
| 1099 { | |
| 1100 if(sensorDataAvailable[0] == 0) | |
| 1101 { | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1102 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1103 sensorDataAvailable[0] = 1; |
| 1104 } | |
| 1105 else if(sensorDataAvailable[1] == 0) | |
| 1106 { | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1107 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1108 sensorDataAvailable[1] = 1; |
| 1109 } | |
| 1110 else if(sensorDataAvailable[2] == 0) | |
| 1111 { | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1112 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1113 sensorDataAvailable[2] = 1; |
| 1114 } | |
| 1115 } | |
| 1116 break; | |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
994
diff
changeset
|
1117 case CCRMODE_Simulation: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 662 | 1118 break; |
| 1119 } | |
| 38 | 1120 } |
| 1121 | |
| 1122 | |
| 1123 //--- print coordinate system & depth graph with bailout--- | |
| 1124 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, NULL); | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 //*** Desciption at bottom of page *************************** | |
| 1129 winsmal.top = wintemp.bottom +2 ; | |
| 1130 winsmal.bottom = winsmal.top + 16; | |
| 1131 | |
| 1132 | |
| 1133 /*if(strcmp( (char*)ghost_char_logfile_text_oc_ccr,"ccr/bailout") == 0) | |
| 1134 { | |
| 1135 winsmal.left = wintemp.left + 2; | |
| 1136 winsmal.right = winsmal.left + 55; | |
| 1137 | |
| 1138 oled_write(OVERLAY, &winsmal,"CCR -",false,true); | |
| 1139 | |
| 1140 winsmal.left = winsmal.right; | |
| 1141 winsmal.right = winsmal.left + 90; | |
| 1142 //winsmal.fontcolor = oled_get_colour(15); | |
| 1143 oled_write(OVERLAY, &winsmal,"bailout",false,true); | |
| 1144 } | |
| 1145 else*/ | |
| 1146 { | |
| 1147 winsmal.left = wintemp.left + 2; | |
| 1148 winsmal.right = winsmal.left + 55; | |
| 1149 color = CLUT_GasSensor1;//LOGBOOK_GRAPH_DEPTH; | |
| 1150 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1151 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"depth"); |
| 38 | 1152 |
| 1153 } | |
| 1154 winsmal.left = 799 - 67;//wintemp.right -67; | |
| 1155 winsmal.right = winsmal.left;// + 45; | |
| 1156 | |
| 662 | 1157 color = CLUT_LogbookTemperature; |
| 1158 | |
| 1159 if(!isLoopMode(logbookHeader.diveMode)) | |
| 1160 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1161 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002PP O2"); |
| 662 | 1162 } |
| 38 | 1163 else |
| 662 | 1164 { |
| 1165 switch(logbookHeader.CCRmode) | |
| 1166 { | |
| 1167 case CCRMODE_FixedSetpoint: | |
| 1168 default: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SETPOINT"); | |
| 1169 break; | |
| 1170 case CCRMODE_Sensors: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SENSORS"); | |
| 1171 break; | |
| 1172 case CCRMODE_Simulation: Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SIM PPO2"); | |
| 1173 break; | |
| 1174 } | |
| 1175 } | |
| 38 | 1176 |
| 1177 //*** PP O2 **************************************************** | |
| 1178 //calc lines and labels | |
| 1179 int datamax = 0; | |
| 1180 int datamin = 10000; | |
| 1181 for(int i=1;i<dataLength;i++) | |
| 1182 { | |
| 1183 if(ppO2data[i]>datamax) | |
| 1184 datamax = ppO2data[i]; | |
| 1185 if(ppO2data[i]<datamin) | |
| 1186 datamin = ppO2data[i]; | |
| 1187 } | |
| 662 | 1188 if(isLoopMode(logbookHeader.diveMode) && (logbookHeader.CCRmode == CCRMODE_Sensors)) |
| 38 | 1189 { |
| 1190 for(int i=1;i<dataLength;i++) | |
| 1191 { | |
| 1192 if(sensor2[i]>datamax) | |
| 1193 datamax = sensor2[i]; | |
| 1194 if(sensor2[i]<datamin) | |
| 1195 datamin = sensor2[i]; | |
| 1196 if(sensor3[i]>datamax) | |
| 1197 datamax = sensor3[i]; | |
| 1198 if(sensor3[i]<datamin) | |
| 1199 datamin = sensor3[i]; | |
| 1200 } | |
| 1201 } | |
| 1202 float maxoxy = ((float)datamax)/100; | |
| 1203 float minoxy = ((float)datamin)/100; | |
| 1204 float oxystep = 0.5; | |
| 1205 float maxoxyline = 2.5; | |
| 1206 | |
| 1207 //--- print PP O2 labels ---- | |
| 1208 winsmal.left = wintemp.right + 2; | |
| 1209 winsmal.top = wintemp.top ; | |
| 1210 winsmal.right = wintemp.right + 30; | |
| 1211 winsmal.bottom = winsmal.top + 16; | |
| 1212 //winsmal.font = ft_tiny + ft_SLIM; | |
| 1213 color = CLUT_LogbookTemperature;// = LOGBOOK_GRAPH_TEMP; | |
| 1214 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1215 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"bar"); |
| 38 | 1216 |
| 1217 int deltaline = (wintemp.bottom - wintemp.top)/5; | |
| 1218 char msg[4]; | |
| 1219 float oxy = maxoxyline; | |
| 1220 for(int i = 1; i<=5; i++) | |
| 1221 { | |
| 1222 oxy -= oxystep; | |
| 1223 if(oxy < 0) | |
| 1224 break; | |
| 1225 winsmal.top = wintemp.top + deltaline * i - 8; | |
| 1226 winsmal.bottom = winsmal.top + 16; | |
| 1227 snprintf(msg,4,"%1.1f",oxy); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1228 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
| 38 | 1229 //oled_write(OVERLAY, &winsmal,msg,false,true); |
| 1230 } | |
| 1231 | |
| 1232 //--- print PP O2 graph --- | |
| 1233 //Adapt window | |
| 1234 float ftmp = ((maxoxyline - minoxy) * deltaline) /oxystep + wintemp.top; | |
| 1235 wintemp.bottom = ftmp; | |
| 1236 if((ftmp - (int)ftmp) >= 0.5f) | |
| 1237 wintemp.bottom++; | |
| 1238 | |
| 1239 ftmp = wintemp.top + ((maxoxyline - maxoxy) * deltaline) /oxystep; | |
| 1240 wintemp.top = ftmp; | |
| 1241 if((ftmp - (int)ftmp) >= 0.5f) | |
| 1242 wintemp.top++; | |
| 1243 wintemp.top = MaxU32LOG(wintemp.top ,0); | |
| 1244 if(wintemp.top < wintemp.bottom) | |
| 1245 { | |
| 662 | 1246 if(isLoopMode(logbookHeader.diveMode) && (logbookHeader.CCRmode == CCRMODE_Sensors)) |
| 38 | 1247 { |
| 662 | 1248 if(sensorDataAvailable[0]) |
| 1249 { | |
| 1250 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, ppO2data,dataLength,CLUT_GasSensor2, NULL); | |
| 1251 } | |
| 1252 if(sensorDataAvailable[1]) | |
| 1253 { | |
| 1254 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, sensor2,dataLength,CLUT_GasSensor3, NULL); | |
| 1255 } | |
| 1256 if(sensorDataAvailable[2]) | |
| 1257 { | |
| 1258 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, sensor3,dataLength,CLUT_GasSensor4, NULL); | |
| 1259 } | |
| 38 | 1260 } |
| 1261 else | |
| 1262 GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, ppO2data,dataLength,CLUT_LogbookTemperature, NULL); | |
| 1263 } | |
| 1264 else | |
| 1265 { | |
| 1266 point_t startPoint, stopPoint; | |
| 1267 startPoint.x = wintemp.left; | |
| 1268 stopPoint.x = wintemp.right; | |
| 1269 stopPoint.y = startPoint.y = 479 - wintemp.top; | |
| 1270 GFX_draw_colorline(hgfx, startPoint, stopPoint, CLUT_LogbookTemperature); | |
| 1271 } | |
| 1272 | |
| 1273 //--- define buttons --- | |
| 1274 //button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page1, surf1_menu_logbook_show_log_next); | |
| 1275 } | |
| 1276 | |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1277 static void print_gas_name(char* output,uint8_t length,uint8_t oxygen,uint8_t helium) |
| 38 | 1278 { |
| 1279 if(helium == 0) | |
| 1280 { | |
| 1281 if(oxygen == 21) | |
| 1282 snprintf(output, length, "Air"); | |
| 1283 else if(oxygen == 100) | |
| 1284 snprintf(output, length, "Oxy"); | |
| 1285 else | |
| 1286 snprintf(output, length, "NX%i",oxygen); | |
| 1287 } | |
| 1288 else | |
| 1289 { | |
| 1290 if((oxygen + helium) == 100) | |
| 1291 snprintf(output, length, "HX%i",oxygen); | |
| 1292 else | |
| 1293 snprintf(output, length, "TMX%i/%i", oxygen, helium); | |
| 1294 } | |
| 1295 | |
| 1296 } | |
| 1297 | |
|
186
f11f0bf6ef2d
cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
1298 static int16_t get_colour(int16_t color) |
| 38 | 1299 { |
| 1300 return CLUT_GasSensor1 + color; | |
| 1301 } | |
|
596
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1302 |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1303 uint8_t getActiveLogPage() |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1304 { |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1305 return active_log_page; |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1306 } |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1307 |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1308 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
|
1309 { |
|
16e369eae6e5
Added functionality to select a dive to be shown in the T3 profile view:
Ideenmodellierer
parents:
583
diff
changeset
|
1310 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
|
1311 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
|
1312 } |
