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