Mercurial > public > ostc4
annotate Discovery/Inc/logbook.h @ 496:9623f166b0c0
Bugfix display of disabled screen.
It is possible to select a screen as default which is in parallel disabled in the selection view. To avoid this the enable / disable state is not also checked when entering dive mode. The check function was depending on an ACTION. The functionality has been changed to allow the function call without ACTION.
Changed setting of compass circle position from constant position to variable
This was needed to reuse the same function in several views with different compass position
Added new views Navigation and Depth data
Both views were basically already available but the idea behind the layout is to combine all information needed for navigation dives (compass + timer) in one view. The classic maxdepth view just showed the maxdepth with a black box on the right side. this box is now used for display of average depth (shown in classic view Stopwatch)
Minor changes in compass paint function to improve code readability
Use same Y offset for all views
While switching across the views some number were shown ~20 pixel higher than others. This was caused by the usage of the line selection which works for some fonts but not for all => set linenumber to 0 for all views
author | Ideenmodellierer |
---|---|
date | Mon, 24 Aug 2020 19:53:27 +0200 |
parents | 3db9eba89e3c |
children | b33a8c1c72e5 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/logbook.h | |
5 /// \brief | |
6 /// \author Heinrichs Weikamp | |
7 /// \date 2018 | |
8 /// | |
9 /// $Id$ | |
10 /////////////////////////////////////////////////////////////////////////////// | |
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
12 /// | |
13 /// This program is free software: you can redistribute it and/or modify | |
14 /// it under the terms of the GNU General Public License as published by | |
15 /// the Free Software Foundation, either version 3 of the License, or | |
16 /// (at your option) any later version. | |
17 /// | |
18 /// This program is distributed in the hope that it will be useful, | |
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 /// GNU General Public License for more details. | |
22 /// | |
23 /// You should have received a copy of the GNU General Public License | |
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 ////////////////////////////////////////////////////////////////////////////// | |
26 | |
27 #ifndef LOGBOOK_H | |
28 #define LOGBOOK_H | |
29 | |
30 #include "data_central.h" | |
31 #include "settings.h" | |
32 | |
458 | 33 #define NUM_GAS (5) /* number of selectable gases */ |
34 | |
38 | 35 typedef struct |
36 { | |
37 uint8_t setpoint_cbar; | |
38 uint8_t depth_meter; | |
39 } SSetpointLog; | |
40 | |
41 typedef struct | |
42 { | |
43 uint8_t oxygen_percentage; | |
44 uint8_t helium_percentage; | |
45 uint8_t depth_meter; | |
46 gasbit8_Type note; | |
47 } SGasListLog; | |
48 | |
49 //Logbook | |
50 typedef struct | |
51 { | |
52 uint16_t diveHeaderStart; | |
53 uint8_t pBeginProfileData[3]; | |
54 uint8_t pEndProfileData[3]; | |
55 uint8_t profileLength[3]; | |
56 uint8_t logbookProfileVersion; | |
57 uint8_t dateYear; | |
58 uint8_t dateMonth; | |
59 uint8_t dateDay; | |
60 uint8_t timeHour; | |
61 uint8_t timeMinute; | |
62 uint8_t extraPagesWithData; /* from here on: changes in order with respect to OSTC3 */ | |
63 uint16_t maxDepth; | |
64 uint16_t diveTimeMinutes; | |
65 uint8_t diveTimeSeconds; | |
66 uint8_t samplingRate; | |
67 int16_t minTemp; | |
68 uint16_t surfacePressure_mbar; | |
69 uint16_t desaturationTime; | |
458 | 70 SGasListLog gasordil[NUM_GAS]; |
38 | 71 uint8_t firmwareVersionLow; |
72 uint8_t firmwareVersionHigh; | |
73 uint16_t batteryVoltage; | |
74 uint16_t cnsAtBeginning; | |
75 uint8_t gfAtBeginning; | |
76 uint8_t gfAtEnd; | |
77 uint16_t personalDiveCount; | |
458 | 78 SSetpointLog setpoint[NUM_GAS]; |
38 | 79 uint16_t maxCNS; |
80 uint16_t averageDepth_mbar; | |
81 uint16_t total_diveTime_seconds; | |
82 uint8_t salinity; | |
83 uint8_t gfLow_or_Vpm_conservatism; | |
84 uint8_t gfHigh; | |
85 uint8_t decoModel; | |
86 float n2Compartments[16]; | |
87 float heCompartments[16]; | |
88 uint8_t n2CompartDesatTime_min[16]; | |
89 uint8_t heCompartDesatTime_min[16]; | |
90 uint16_t diveNumber; | |
91 uint8_t lastDecostop_m; | |
92 uint8_t CCRmode; | |
93 uint8_t diveMode; | |
94 uint8_t hwHudLastStatus; /* from here on identical to OSTC3 again */ | |
95 uint16_t hwHudBattery_mV; | |
486 | 96 uint8_t batteryGaugeRegisters[5]; /* former batteryGaugeRegisters (6 Bytes) which were not used => use as reserve to keep memory layout */ |
97 uint8_t batteryCharge; /* first reuse byte */ | |
38 | 98 uint16_t diveHeaderEnd; |
99 } SLogbookHeader; | |
100 | |
101 //Logbook OSTC3 | |
102 typedef struct | |
103 { | |
104 uint8_t diveHeaderStart[2]; | |
105 uint8_t pBeginProfileData[3]; | |
106 uint8_t pEndProfileData[3]; | |
107 uint8_t logbookProfileVersion; | |
108 uint8_t profileLength[3]; | |
109 uint8_t dateYear; | |
110 uint8_t dateMonth; | |
111 uint8_t dateDay; | |
112 uint8_t timeHour; | |
113 uint8_t timeMinute; | |
114 uint8_t maxDepth[2]; | |
115 uint8_t diveTimeMinutes[2]; | |
116 uint8_t diveTimeSeconds; | |
117 uint8_t minTemp[2]; | |
118 uint8_t surfacePressure_mbar[2]; | |
119 uint8_t desaturationTime[2]; | |
458 | 120 uint8_t gasordil[NUM_GAS*4]; |
38 | 121 uint8_t firmwareVersionLow; |
122 uint8_t firmwareVersionHigh; | |
123 uint8_t batteryVoltage[2]; | |
124 uint8_t samplingRate; | |
125 uint8_t cnsAtBeginning[2]; | |
126 uint8_t gfAtBeginning; | |
127 uint8_t gfAtEnd; | |
128 uint8_t personalDiveCount[2]; | |
471
73da921869d9
bugfix: implement battery charge percentage in dive header
Jan Mulder <jlmulder@xs4all.nl>
parents:
458
diff
changeset
|
129 uint8_t batteryCharge; |
38 | 130 uint8_t setpoint[5*2]; |
131 uint8_t salinity; | |
132 uint8_t maxCNS[2]; | |
133 uint8_t averageDepth_mbar[2]; | |
134 uint8_t total_diveTime_seconds[2]; | |
135 uint8_t gfLow_or_Vpm_conservatism; | |
136 uint8_t gfHigh; | |
137 uint8_t decoModel; | |
138 uint8_t diveNumber[2]; | |
139 uint8_t diveMode; | |
140 uint8_t n2CompartDesatTime_min[16]; | |
141 uint8_t n2Compartments[16*4]; | |
142 uint8_t heCompartDesatTime_min[16]; | |
143 uint8_t heCompartments[16*4]; | |
144 uint8_t lastDecostop_m; | |
145 uint8_t safetyDistance_10cm; | |
146 uint8_t hwHudBattery_mV[2]; | |
147 uint8_t hwHudLastStatus; | |
148 uint8_t batteryGaugeRegisters[6]; | |
149 uint8_t diveHeaderEnd[2]; | |
150 } SLogbookHeaderOSTC3; | |
151 | |
152 | |
153 //Logbook OSTC3 | |
154 typedef struct | |
155 { | |
156 uint8_t profileLength[3]; | |
157 uint8_t dateYear; | |
158 uint8_t dateMonth; | |
159 uint8_t dateDay; | |
160 uint8_t timeHour; | |
161 uint8_t timeMinute; | |
162 uint8_t maxDepth[2]; | |
163 uint8_t diveTimeMinutes[2]; | |
164 uint8_t diveTimeSeconds; | |
165 uint8_t totalDiveNumberLow; | |
166 uint8_t totalDiveNumberHigh; | |
167 uint8_t profileVersion; | |
168 } SLogbookHeaderOSTC3compact; | |
169 | |
170 | |
171 typedef struct | |
172 { | |
173 uint8_t profileLength[3]; | |
174 uint8_t samplingRate_seconds; | |
175 uint8_t numDivisors; | |
176 uint8_t tempType; | |
177 uint8_t tempLength; | |
178 uint8_t tempDivisor; | |
179 uint8_t deco_ndlType; | |
180 uint8_t deco_ndlLength; | |
181 uint8_t deco_ndlDivisor; | |
182 uint8_t gfType; | |
183 uint8_t gfLength; | |
184 uint8_t gfDivisor; | |
185 uint8_t ppo2Type; | |
186 uint8_t ppo2Length; | |
187 uint8_t ppo2Divisor; | |
188 uint8_t decoplanType; | |
189 uint8_t decoplanLength; | |
190 uint8_t decoplanDivisor; | |
191 uint8_t cnsType; | |
192 uint8_t cnsLength; | |
193 uint8_t cnsDivisor; | |
194 uint8_t tankType; | |
195 uint8_t tankLength; | |
196 uint8_t tankDivisor; | |
197 } SSmallHeader; | |
198 | |
199 typedef struct | |
200 { | |
201 int8_t percentageO2; | |
202 int8_t percentageHe; | |
203 } SManualGas; | |
204 | |
270
2e58a4094770
feature, debug: make simulator write a logbook entry
Jan Mulder <jlmulder@xs4all.nl>
parents:
269
diff
changeset
|
205 void logbook_writeSample(const SDiveState *state); |
38 | 206 void logbook_initNewdiveProfile(const SDiveState* pInfo, SSettings* pSettings); |
207 void logbook_EndDive(void); | |
208 | |
209 SLogbookHeader* logbook_getCurrentHeader(void); | |
210 SLogbookHeaderOSTC3 * logbook_build_ostc3header(SLogbookHeader* pLogbookHeader); | |
211 SLogbookHeaderOSTC3compact * logbook_build_ostc3header_compact(SLogbookHeader* pHead); | |
212 | |
213 uint8_t logbook_getNumberOfHeaders(void); | |
214 uint8_t logbook_getHeader(uint8_t StepBackwards,SLogbookHeader* pLogbookHeader); | |
455
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
215 uint16_t logbook_readSampleData(uint8_t StepBackwards, uint16_t length,uint16_t* depth, uint8_t* gasid, int16_t* temperature, uint16_t* ppo2, |
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
216 uint16_t* setpoint, uint16_t* sensor1, uint16_t* sensor2, uint16_t* sensor3, uint16_t* cns, uint8_t* bailout, |
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
217 uint16_t* decostopDepth, uint16_t* tank); |
38 | 218 void logbook_test(void); |
270
2e58a4094770
feature, debug: make simulator write a logbook entry
Jan Mulder <jlmulder@xs4all.nl>
parents:
269
diff
changeset
|
219 void logbook_InitAndWrite(const SDiveState* pStateReal); |
38 | 220 void logbook_recover_brokenlog(uint8_t headerId); |
221 | |
222 uint16_t logbook_lastDive_diveNumber(void); | |
458 | 223 uint16_t logbook_fillDummySampleBuffer(SLogbookHeader* pHeader); |
455
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
224 void logbook_readDummySamples(uint8_t* pTarget, uint16_t length); |
38 | 225 |
226 #endif /* LOGBOOK_H */ |