comparison Common/Inc/data_central.h @ 752:4f19336a3f21

Dev Bugfix: Alignment problem in lifedata structure: Since the introduction of the 64 bit DigO2 sensor ID the potential risk of a misalignment is present in the lifedata structure. E.g. If a new 8bit variable is added in front of the data structure containing the 64bit value. To avoid this in future the sensor data structure which may contain the 64bit value has been moved to the top of the structure (first element)
author Ideenmodellierer
date Tue, 07 Mar 2023 19:51:30 +0100
parents be25ab2d902c
children 29d9b5bc7946
comparison
equal deleted inserted replaced
751:70e9c83ecf22 752:4f19336a3f21
170 * contains data calculated from actual data after receiption from Small CPU 170 * contains data calculated from actual data after receiption from Small CPU
171 */ 171 */
172 typedef struct 172 typedef struct
173 { 173 {
174 /* from Small CPU */ 174 /* from Small CPU */
175 uint8_t extIf_sensor_data[32]; /* The external sensor may contain a 64 bit ID. It has been placed at the beginning of the structure to avoid problems in alignment */
176 uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT];
177
175 int32_t dive_time_seconds; 178 int32_t dive_time_seconds;
176 int32_t dive_time_seconds_without_surface_time; 179 int32_t dive_time_seconds_without_surface_time;
177 uint32_t surface_time_seconds; 180 uint32_t surface_time_seconds;
178 float pressure_ambient_bar; 181 float pressure_ambient_bar;
179 float pressure_surface_bar; 182 float pressure_surface_bar;
199 uint16_t ambient_light_level; 202 uint16_t ambient_light_level;
200 SDataWireless wireless_data[4]; 203 SDataWireless wireless_data[4];
201 uint8_t buttonPICdata[4]; 204 uint8_t buttonPICdata[4];
202 SCO2Sensor CO2_data; 205 SCO2Sensor CO2_data;
203 uint8_t extIf_sensor_Id; 206 uint8_t extIf_sensor_Id;
204 uint8_t UINT64ALIGNMENT; /* If your program crash check if you changed something in the life data structure ! The external sensor may contain a 64 bit ID */
205 uint8_t extIf_sensor_data[32];
206 uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT];
207 207
208 /* by create DiveSettings() and by setActualGas() 208 /* by create DiveSettings() and by setActualGas()
209 * is send to Small CPU2 for nitrogen calculation 209 * is send to Small CPU2 for nitrogen calculation
210 * includes setpoint information 210 * includes setpoint information
211 */ 211 */
266 int8_t sensorLinkLost; 266 int8_t sensorLinkLost;
267 int8_t sensorOutOfBounds[3]; 267 int8_t sensorOutOfBounds[3];
268 int8_t betterGas; 268 int8_t betterGas;
269 int8_t fallback; 269 int8_t fallback;
270 int8_t betterSetpoint; 270 int8_t betterSetpoint;
271 int8_t co2High;
271 #ifdef ENABLE_BOTTLE_SENSOR 272 #ifdef ENABLE_BOTTLE_SENSOR
272 int8_t newPressure; 273 int8_t newPressure;
273 #endif 274 #endif
274 } SWarnings; 275 } SWarnings;
275 276