annotate Common/Inc/data_central.h @ 130:b7689d9e888a FlipDisplay

Minor changes to improved code quality and to eliminate warnings
author Ideenmodellierer
date Sun, 17 Feb 2019 21:22:13 +0100
parents 5f11787b4f42
children cc9c18075e00
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 Common/Inc/data_central.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Common Dadatypes Declarations
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Heinrichs Weikamp
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 2018
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #ifndef DATA_CENTRAL_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #define DATA_CENTRAL_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include <stdint.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #define BUEHLMANN_STRUCT_MAX_GASES 11
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #define BUEHLMANN_STRUCT_MAX_ASCENDRATES 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #define DECOINFO_STRUCT_MAX_STOPS 50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #define false 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define true 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /* Helper structs ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 //struct SGas
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 //contains gasinfos of single gas for deco calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint8_t nitrogen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint8_t setPoint_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 uint8_t change_during_ascent_depth_meter_otherwise_zero;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 uint8_t GasIdInSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 uint8_t temp1_for16bitalign;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 } SGas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 float use_from_depth_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 float rate_bar_per_minute;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 } SAscentrate;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 uint32_t date_rtc_dr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 uint32_t time_rtc_tr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 int32_t value_int32;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 } SDeviceLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 uint16_t ageInMilliSeconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 uint8_t numberOfBytes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 uint8_t status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 uint8_t data[12];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 } SDataWireless;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 /* Main structs -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 //struct SDecoinfo
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 //contains result of deco calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 unsigned short output_stop_length_seconds[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 int output_time_to_surface_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 int output_ndl_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 float output_ceiling_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 float output_relative_gradient;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 uint32_t tickstamp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 } SDecoinfo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 //crushing pressure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 //in/out
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 float max_crushing_pressure_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 float max_crushing_pressure_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 //
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 float run_time_start_of_deco_zone_save;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 float depth_start_of_deco_zone_save;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 float max_first_stop_depth_save;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 short decomode_vpm_plus_conservatism_last_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 _Bool deco_zone_reached;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 //State variables for repetetive dives
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 _Bool repetitive_variables_not_valid;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 float adjusted_crushing_pressure_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 float adjusted_crushing_pressure_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 float adjusted_critical_radius_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 float adjusted_critical_radius_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 float initial_allowable_gradient_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 float initial_allowable_gradient_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 float max_actual_gradient[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 } SVpm;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 _Bool repetitive_variables_not_valid;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 _Bool is_data_from_RTE_CPU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 _Bool spare2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 _Bool spare3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 float adjusted_crushing_pressure_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 float adjusted_crushing_pressure_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 float adjusted_critical_radius_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 float adjusted_critical_radius_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 float initial_allowable_gradient_he[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 float initial_allowable_gradient_n2[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 float max_actual_gradient[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 } SVpmRepetitiveData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 //struct SDevice
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 //contains information about usage
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 SDeviceLine batteryChargeCycles;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 SDeviceLine batteryChargeCompleteCycles;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 SDeviceLine temperatureMinimum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 SDeviceLine temperatureMaximum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 SDeviceLine depthMaximum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 SDeviceLine diveCycles;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 SDeviceLine voltageMinimum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 SDeviceLine hoursOfOperation;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 SDeviceLine diveAccident;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 } SDevice;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 SDevice device;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 SVpmRepetitiveData vpm;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 } SDeviceState;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 uint32_t average_depth_meter_Count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 uint32_t average_depth_last_update_dive_time_seconds_without_surface_time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 int32_t stopwatch_start_at_this_dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 } SHelper;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 /* struct SLifeData
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 * contains data all actual data (pressure, stuturation, etc. as received from second ship
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 * and has actualGas to be send to Small CPU (second chip)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 * contains data calculated from actual data after receiption from Small CPU
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 /* from Small CPU */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 int32_t dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 int32_t dive_time_seconds_without_surface_time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 uint32_t surface_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 float pressure_ambient_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 float pressure_surface_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 float tissue_nitrogen_bar[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 float tissue_helium_bar[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 float cns;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 float otu;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 uint16_t desaturation_time_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 uint16_t no_fly_time_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 float temperature_celsius;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 float compass_heading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 float compass_roll;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 float compass_pitch;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 int16_t compass_DX_f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 int16_t compass_DY_f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 int16_t compass_DZ_f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 uint16_t counterSecondsShallowDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 float ascent_rate_meter_per_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 uint32_t timeBinaryFormat;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 uint32_t dateBinaryFormat;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 float battery_voltage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 float battery_charge;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 uint16_t ambient_light_level;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 SDataWireless wireless_data[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 uint8_t buttonPICdata[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 /* by create DiveSettings() and by setActualGas()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 * is send to Small CPU2 for nitrogen calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 * includes setpoint information
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 SGas actualGas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 uint8_t lastDiluent_GasIdInSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 uint8_t gas_temp2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 /* calculated by DataEX_copy_to_LifeData()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 bottle_bar array size is made like this to have multiples of 32bit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 float ppO2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 float depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 float max_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 float average_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 float apnea_total_max_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 float apnea_last_max_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 int32_t apnea_last_dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 int32_t stopwatch_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 uint16_t bottle_bar[2 * NUM_GASES +1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 uint16_t bottle_bar_age_MilliSeconds[2 * NUM_GASES + 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 uint16_t apnea_total_counter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 uint8_t scooterSpeed;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 uint8_t scooterType;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 uint16_t scooterWattstunden;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 uint16_t scooterDrehzahl;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 uint8_t scooterRestkapazitaet;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 uint8_t scooterAmpere;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 uint16_t scooterTemperature;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 uint16_t scooterAgeInMilliSeconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 float scooterSpannung;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 uint8_t scooterRestkapazitaetWhBased;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 uint8_t scooterRestkapazitaetVoltageBased;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 /* control of DataEX_copy_to_LifeData()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 uint8_t boolResetAverageDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 uint8_t boolResetStopwatch;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 uint8_t bool_temp1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 uint8_t bool_temp2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 /* from local sensor or direct HUD communication */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 //pp O2 Sensor
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 float ppO2Sensor_bar[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 float sensorVoltage_mV[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 float HUD_battery_voltage_V;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 /* used by DataEX_copy_to_LifeData()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 SHelper internal;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 } SLifeData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 uint16_t tissue_nitrogen_desaturation_time_minutes[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 uint16_t tissue_helium_desaturation_time_minutes[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 } SLifeData2;
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 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 //warnings
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 int8_t decoMissed;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 int8_t aGf;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 int8_t ascentRateHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 int8_t ppO2Low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 int8_t ppO2High;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 int8_t cnsHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 int8_t slowWarning;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 int8_t lowBattery;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 int8_t numWarnings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 int8_t sensorLinkLost;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 int8_t sensorOutOfBounds[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 int8_t betterGas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 int8_t fallback;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 int8_t betterSetpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 } SWarnings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 //Events logbook only
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 int16_t manualMarker;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 int16_t gasChange;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 int16_t info_GasChange;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 int16_t setpointChange;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 int16_t info_SetpointChange;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 int16_t manuelGasSet;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 int16_t info_manuelGasSetHe;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 int16_t info_manuelGasSetO2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 int16_t bailout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 int16_t info_bailoutHe;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 int16_t info_bailoutO2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 } SEvents;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 //struct SDiveSettings
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 //contains settings necessary for deco calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 float last_stop_depth_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 float input_next_stop_increment_depth_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 float input_second_to_last_stop_depth_bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 float ascentRate_meterperminute;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 uint8_t diveMode; /* OC, CC, .. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 uint8_t CCR_Mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 uint8_t future_TTS_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 /* If beginning of dive is CCR than ccrOption is set true
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 * true allows returning from bailout (OC) back to CCR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 * true activates CC gas and setpoint pages in dive menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 uint8_t ccrOption;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 uint8_t fallbackOption;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 uint8_t ppo2sensors_deactivated;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 split2x4_Type deco_type; /* GF or VPM for standard and alternative seperate */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 /* VPM conservatism, do not change during dive!!!
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 * do not change in between dives otherwise repetitve dive is not possible
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 uint8_t vpm_conservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 /* B�hlmann GF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 * and a variable that is used by Buehlmann during the dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 * to remember the position of GF low during ascend
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 uint8_t gf_high;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 uint8_t gf_low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 /* copy of the Settings GasList and SetpintList
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 * that can be modified during the dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 * especially gases can be actived and deactivated
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 * gas[0] and setpoint[0] are the special ones configurable during the dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 SGasLine gas[1 + (2*NUM_GASES)];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 SSetpointLine setpoint[1 + NUM_GASES];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 /* List of GasChanges in the actual order
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 * this is necessary for VPM and Buehlmann and will be created on start of each calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 SGas decogaslist[BUEHLMANN_STRUCT_MAX_GASES]; // unused filled with 0xFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 float internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 uint16_t compassHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 } SDiveSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 enum CHARGE_STATUS{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 CHARGER_off = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 CHARGER_running,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 CHARGER_complete,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 CHARGER_lostConnection
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 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 SDiveSettings diveSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 SLifeData lifeData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 SVpm vpm;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 SEvents events;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 SWarnings warnings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 SDecoinfo decolistVPM;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 SDecoinfo decolistFutureVPM;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 SDecoinfo decolistBuehlmann; //
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 SDecoinfo decolistFutureBuehlmann;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 uint8_t mode; /* hw for sleep, surface, dive, .. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 uint8_t chargeStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 uint8_t data_old__lost_connection_to_slave;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 uint32_t pressure_uTick_new;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 uint32_t compass_uTick_new;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 uint32_t pressure_uTick_old;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 uint32_t compass_uTick_old;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 uint32_t pressure_uTick_local_new;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 uint32_t compass_uTick_local_new;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 uint8_t cnsHigh_at_the_end_of_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 uint8_t decoMissed_at_the_end_of_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 uint8_t sensorErrorsRTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 uint8_t lastKnownBatteryPercentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 } SDiveState;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 uint8_t bit0:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 uint8_t bit1:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 uint8_t bit2:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 uint8_t bit3:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 uint8_t bit4:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 uint8_t bit5:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 uint8_t bit6:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 uint8_t bit7:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 } ubit8_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 ubit8_t ub;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 uint8_t uw;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 } bit8_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 //extern SDiveState stateReal; only via const SDiveState stateRealGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 extern SDiveState stateSim;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 extern SDiveState stateDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 extern uint8_t decoLock;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 extern const SDiveState * stateUsed;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 extern SLifeData2 secondaryInformation;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 enum DECO_LOCK{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 DECO_CALC_running,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 DECO_CALC_ready,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 DECO_CALC_FINSHED_Buehlmann,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 DECO_CALC_FINSHED_vpm,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 DECO_CALC_FINSHED_FutureBuehlmann,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 DECO_CALC_FINSHED_Futurevpm,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 DECO_CALC_init_as_is_start_of_dive,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 DECO_CALC_undefined
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 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 void set_stateUsedToSim(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 void set_stateUsedToReal(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 _Bool is_stateUsedSetToSim(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 const SDiveState * stateRealGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 const SDiveState * stateSimGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 SDiveState * stateRealGetPointerWrite(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 SDiveState * stateSimGetPointerWrite(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 const SDevice * stateDeviceGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 SDevice * stateDeviceGetPointerWrite(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 const SVpmRepetitiveData * stateVpmRepetitiveDataGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 SVpmRepetitiveData * stateVpmRepetitiveDataGetPointerWrite(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 void UpdateLifeDataTest(SDiveState * diveState);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 void setSimulationValues(int _ascent_rate_meter_per_min, int _descent_rate_meter_per_min, int _max_depth, int _bottom_time );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 void createDiveSettings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 void copyDiveSettingsToSim(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 void copyVpmRepetetiveDataToSim(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 //void fallbackToFixedSetpoints(SLifeData *lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 void setActualGasFirst(SLifeData *lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 void setActualGasAir(SLifeData *lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 void setActualGas(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 void setActualGas_ExtraGas(SLifeData *lifeData, uint8_t oxygen, uint8_t helium, uint8_t setpoint_cbar);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 void setActualGas_DM(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 void setWeekday(RTC_DateTypeDef *sDate);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 void setDate(RTC_DateTypeDef Sdate);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 void setTime(RTC_TimeTypeDef Stime);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 void setBatteryPercentage(uint8_t newChargePercentage);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 void setButtonResponsiveness(uint8_t *ButtonSensitivyList);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 void calibrateCompass(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 void clearDeco(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 void translateDate(uint32_t datetmpreg, RTC_DateTypeDef *sDate);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 void translateTime(uint32_t tmpreg, RTC_TimeTypeDef *sTime);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 void updateSetpointStateUsed(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 uint8_t calc_MOD(uint8_t gasId);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 uint8_t calc_MinOD(uint8_t gasId);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 //float calc_ppO2(float input_ambient_pressure_bar, SGas* pGas);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 int current_second(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 _Bool vpm_crush(SDiveState* pDiveState);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 _Bool deco_zone_reached(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 void resetEvents(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 uint32_t crc32c_checksum(uint8_t* message, uint16_t length, uint8_t* message2, uint16_t length2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 uint32_t CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 uint8_t stateUsed_scooterRemainingBattCapacity(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 #endif // DATA_CENTRAL_H