Mercurial > public > ostc4
annotate Discovery/Inc/logbook.h @ 1066:eceb5cb2a8e3 Icon_Integration
Added missing compile switch
| author | Ideenmodellierer |
|---|---|
| date | Mon, 16 Feb 2026 21:33:04 +0100 |
| parents | 3c73180fde1d |
| children |
| 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 | |
| 1058 | 33 /* FW requirement for GF_Surf data entry */ |
| 34 #define GF_SURF_FW_FIRST (1) | |
| 35 #define GF_SURF_FW_SECOND (7) | |
| 36 #define GF_SURF_FW_THIRD (5) | |
| 37 | |
| 38 | 38 typedef struct |
| 39 { | |
| 40 uint8_t setpoint_cbar; | |
| 41 uint8_t depth_meter; | |
| 42 } SSetpointLog; | |
| 43 | |
| 44 typedef struct | |
| 45 { | |
| 46 uint8_t oxygen_percentage; | |
| 47 uint8_t helium_percentage; | |
| 48 uint8_t depth_meter; | |
| 49 gasbit8_Type note; | |
| 50 } SGasListLog; | |
| 51 | |
| 52 //Logbook | |
| 53 typedef struct | |
| 54 { | |
| 55 uint16_t diveHeaderStart; | |
| 56 uint8_t pBeginProfileData[3]; | |
| 57 uint8_t pEndProfileData[3]; | |
| 58 uint8_t profileLength[3]; | |
| 59 uint8_t logbookProfileVersion; | |
| 60 uint8_t dateYear; | |
| 61 uint8_t dateMonth; | |
| 62 uint8_t dateDay; | |
| 63 uint8_t timeHour; | |
| 64 uint8_t timeMinute; | |
| 65 uint8_t extraPagesWithData; /* from here on: changes in order with respect to OSTC3 */ | |
| 66 uint16_t maxDepth; | |
| 67 uint16_t diveTimeMinutes; | |
| 68 uint8_t diveTimeSeconds; | |
| 69 uint8_t samplingRate; | |
| 70 int16_t minTemp; | |
| 71 uint16_t surfacePressure_mbar; | |
| 72 uint16_t desaturationTime; | |
|
524
b33a8c1c72e5
Minor: Removed duplicated definition of number of available gases
Ideenmodellierer
parents:
486
diff
changeset
|
73 SGasListLog gasordil[NUM_GASES]; |
| 38 | 74 uint8_t firmwareVersionLow; |
| 75 uint8_t firmwareVersionHigh; | |
| 76 uint16_t batteryVoltage; | |
| 77 uint16_t cnsAtBeginning; | |
| 78 uint8_t gfAtBeginning; | |
| 79 uint8_t gfAtEnd; | |
| 80 uint16_t personalDiveCount; | |
|
524
b33a8c1c72e5
Minor: Removed duplicated definition of number of available gases
Ideenmodellierer
parents:
486
diff
changeset
|
81 SSetpointLog setpoint[NUM_GASES]; |
| 38 | 82 uint16_t maxCNS; |
| 83 uint16_t averageDepth_mbar; | |
| 84 uint16_t total_diveTime_seconds; | |
| 85 uint8_t salinity; | |
| 86 uint8_t gfLow_or_Vpm_conservatism; | |
| 87 uint8_t gfHigh; | |
| 88 uint8_t decoModel; | |
| 89 float n2Compartments[16]; | |
| 90 float heCompartments[16]; | |
| 91 uint8_t n2CompartDesatTime_min[16]; | |
| 92 uint8_t heCompartDesatTime_min[16]; | |
| 93 uint16_t diveNumber; | |
| 94 uint8_t lastDecostop_m; | |
| 95 uint8_t CCRmode; | |
| 96 uint8_t diveMode; | |
| 97 uint8_t hwHudLastStatus; /* from here on identical to OSTC3 again */ | |
| 98 uint16_t hwHudBattery_mV; | |
| 486 | 99 uint8_t batteryGaugeRegisters[5]; /* former batteryGaugeRegisters (6 Bytes) which were not used => use as reserve to keep memory layout */ |
| 100 uint8_t batteryCharge; /* first reuse byte */ | |
| 38 | 101 uint16_t diveHeaderEnd; |
| 102 } SLogbookHeader; | |
| 103 | |
| 104 //Logbook OSTC3 | |
| 105 typedef struct | |
| 106 { | |
| 107 uint8_t diveHeaderStart[2]; | |
| 108 uint8_t pBeginProfileData[3]; | |
| 109 uint8_t pEndProfileData[3]; | |
| 110 uint8_t logbookProfileVersion; | |
| 111 uint8_t profileLength[3]; | |
| 112 uint8_t dateYear; | |
| 113 uint8_t dateMonth; | |
| 114 uint8_t dateDay; | |
| 115 uint8_t timeHour; | |
| 116 uint8_t timeMinute; | |
| 117 uint8_t maxDepth[2]; | |
| 118 uint8_t diveTimeMinutes[2]; | |
| 119 uint8_t diveTimeSeconds; | |
| 120 uint8_t minTemp[2]; | |
| 121 uint8_t surfacePressure_mbar[2]; | |
| 122 uint8_t desaturationTime[2]; | |
|
524
b33a8c1c72e5
Minor: Removed duplicated definition of number of available gases
Ideenmodellierer
parents:
486
diff
changeset
|
123 uint8_t gasordil[NUM_GASES*4]; |
| 38 | 124 uint8_t firmwareVersionLow; |
| 125 uint8_t firmwareVersionHigh; | |
| 126 uint8_t batteryVoltage[2]; | |
| 127 uint8_t samplingRate; | |
| 128 uint8_t cnsAtBeginning[2]; | |
| 129 uint8_t gfAtBeginning; | |
| 130 uint8_t gfAtEnd; | |
| 131 uint8_t personalDiveCount[2]; | |
|
471
73da921869d9
bugfix: implement battery charge percentage in dive header
Jan Mulder <jlmulder@xs4all.nl>
parents:
458
diff
changeset
|
132 uint8_t batteryCharge; |
| 38 | 133 uint8_t setpoint[5*2]; |
| 134 uint8_t salinity; | |
| 135 uint8_t maxCNS[2]; | |
| 136 uint8_t averageDepth_mbar[2]; | |
| 137 uint8_t total_diveTime_seconds[2]; | |
| 138 uint8_t gfLow_or_Vpm_conservatism; | |
| 139 uint8_t gfHigh; | |
| 140 uint8_t decoModel; | |
| 141 uint8_t diveNumber[2]; | |
| 142 uint8_t diveMode; | |
| 143 uint8_t n2CompartDesatTime_min[16]; | |
| 144 uint8_t n2Compartments[16*4]; | |
| 145 uint8_t heCompartDesatTime_min[16]; | |
| 146 uint8_t heCompartments[16*4]; | |
| 147 uint8_t lastDecostop_m; | |
| 148 uint8_t safetyDistance_10cm; | |
| 149 uint8_t hwHudBattery_mV[2]; | |
| 150 uint8_t hwHudLastStatus; | |
| 151 uint8_t batteryGaugeRegisters[6]; | |
| 152 uint8_t diveHeaderEnd[2]; | |
| 153 } SLogbookHeaderOSTC3; | |
| 154 | |
| 155 | |
| 156 //Logbook OSTC3 | |
| 157 typedef struct | |
| 158 { | |
| 159 uint8_t profileLength[3]; | |
| 160 uint8_t dateYear; | |
| 161 uint8_t dateMonth; | |
| 162 uint8_t dateDay; | |
| 163 uint8_t timeHour; | |
| 164 uint8_t timeMinute; | |
| 165 uint8_t maxDepth[2]; | |
| 166 uint8_t diveTimeMinutes[2]; | |
| 167 uint8_t diveTimeSeconds; | |
| 168 uint8_t totalDiveNumberLow; | |
| 169 uint8_t totalDiveNumberHigh; | |
| 170 uint8_t profileVersion; | |
| 171 } SLogbookHeaderOSTC3compact; | |
| 172 | |
| 173 | |
| 174 typedef struct | |
| 175 { | |
| 176 uint8_t profileLength[3]; | |
| 177 uint8_t samplingRate_seconds; | |
| 178 uint8_t numDivisors; | |
| 179 uint8_t tempType; | |
| 180 uint8_t tempLength; | |
| 181 uint8_t tempDivisor; | |
| 182 uint8_t deco_ndlType; | |
| 183 uint8_t deco_ndlLength; | |
| 184 uint8_t deco_ndlDivisor; | |
| 185 uint8_t gfType; | |
| 186 uint8_t gfLength; | |
| 187 uint8_t gfDivisor; | |
| 188 uint8_t ppo2Type; | |
| 189 uint8_t ppo2Length; | |
| 190 uint8_t ppo2Divisor; | |
| 191 uint8_t decoplanType; | |
| 192 uint8_t decoplanLength; | |
| 193 uint8_t decoplanDivisor; | |
| 194 uint8_t cnsType; | |
| 195 uint8_t cnsLength; | |
| 196 uint8_t cnsDivisor; | |
| 197 uint8_t tankType; | |
| 198 uint8_t tankLength; | |
| 199 uint8_t tankDivisor; | |
| 200 } SSmallHeader; | |
| 201 | |
| 202 typedef struct | |
| 203 { | |
| 204 int8_t percentageO2; | |
| 205 int8_t percentageHe; | |
| 206 } SManualGas; | |
| 207 | |
|
270
2e58a4094770
feature, debug: make simulator write a logbook entry
Jan Mulder <jlmulder@xs4all.nl>
parents:
269
diff
changeset
|
208 void logbook_writeSample(const SDiveState *state); |
| 38 | 209 void logbook_initNewdiveProfile(const SDiveState* pInfo, SSettings* pSettings); |
| 210 void logbook_EndDive(void); | |
| 211 | |
| 212 SLogbookHeader* logbook_getCurrentHeader(void); | |
| 213 SLogbookHeaderOSTC3 * logbook_build_ostc3header(SLogbookHeader* pLogbookHeader); | |
| 214 SLogbookHeaderOSTC3compact * logbook_build_ostc3header_compact(SLogbookHeader* pHead); | |
| 215 | |
| 216 uint8_t logbook_getNumberOfHeaders(void); | |
| 217 uint8_t logbook_getHeader(uint8_t StepBackwards,SLogbookHeader* pLogbookHeader); | |
|
455
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
218 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
|
219 uint16_t* setpoint, uint16_t* sensor1, uint16_t* sensor2, uint16_t* sensor3, uint16_t* cns, uint8_t* bailout, |
|
1020
b0d3e8b84966
Fix: Add Missing Compass Heading to the Logbook Reader.
heinrichsweikamp
parents:
1014
diff
changeset
|
220 uint16_t* decostopDepth, uint16_t* tank, uint16_t* compassHeading, SGnssCoord* pPosition, uint16_t* scrubberState, uint8_t* event); |
| 38 | 221 void logbook_test(void); |
| 941 | 222 void logbook_InitAndWrite(SDiveState* pStateReal); |
| 38 | 223 void logbook_recover_brokenlog(uint8_t headerId); |
| 224 | |
| 225 uint16_t logbook_lastDive_diveNumber(void); | |
| 458 | 226 uint16_t logbook_fillDummySampleBuffer(SLogbookHeader* pHeader); |
|
455
928a14568689
Reactivated samples for bottle pressure information:
ideenmodellierer
parents:
270
diff
changeset
|
227 void logbook_readDummySamples(uint8_t* pTarget, uint16_t length); |
| 38 | 228 |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
941
diff
changeset
|
229 void logScrubberState(const SScrubberData *scrubberData); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
941
diff
changeset
|
230 |
| 38 | 231 #endif /* LOGBOOK_H */ |
