annotate Discovery/Src/show_logbook.c @ 941:6d8ae8fbccf5 Evo_2_23

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