changeset 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 70e9c83ecf22
children 4a28402e4aca
files Common/Inc/data_central.h
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/data_central.h	Mon Mar 13 22:23:00 2023 +0100
+++ b/Common/Inc/data_central.h	Tue Mar 07 19:51:30 2023 +0100
@@ -172,6 +172,9 @@
 typedef struct
 {
 	/* from Small CPU */
+	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 */
+	uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT];
+
 	int32_t dive_time_seconds;
 	int32_t dive_time_seconds_without_surface_time;
 	uint32_t surface_time_seconds;
@@ -201,9 +204,6 @@
 	uint8_t buttonPICdata[4];
 	SCO2Sensor CO2_data;
 	uint8_t extIf_sensor_Id;
-	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 */
-	uint8_t extIf_sensor_data[32];
-	uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT];
 
 	/* by create DiveSettings() and by setActualGas()
 	 * is send to Small CPU2 for nitrogen calculation
@@ -268,6 +268,7 @@
 	int8_t betterGas;
 	int8_t fallback;
 	int8_t betterSetpoint;
+	int8_t co2High;
 #ifdef ENABLE_BOTTLE_SENSOR
 	int8_t newPressure;
 #endif