diff src/shared_definitions.h @ 623:c40025d8e750

3.03 beta released
author heinrichsweikamp
date Mon, 03 Jun 2019 14:01:48 +0200
parents ca4556fb60b9
children cd58f7fc86db
line wrap: on
line diff
--- a/src/shared_definitions.h	Wed Apr 10 10:51:07 2019 +0200
+++ b/src/shared_definitions.h	Mon Jun 03 14:01:48 2019 +0200
@@ -1,6 +1,6 @@
 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 ;
-;    shared_definitions.h							REFACTORED VERSION V2.99e
+;    shared_definitions.h                     combined next generation V3.03.1
 ;
 ;    Declare variables used both in C and ASM code
 ;
@@ -80,87 +80,74 @@
               ascent simulation.
     NUM_SP    is the number of setpoints
 #endif
-#define NUM_COMP	0x10
-#define NUM_STOPS	0x20
-#define NUM_GAS		5
-#define NUM_SP		5
+#define NUM_COMP		0x10
+#define NUM_STOPS		0x20
+#define NUM_STOPS_LOG	0x0F
+#define NUM_GAS			5
 
 
 #ifdef __18CXX
 	//---- BANK 3 DATA -------------------------------------------------------
 	// Gather all Data C-Code --> ASM-Code
-	// Memory usage: 202 Byte used, 54 Byte free
+	// Memory usage: 240 Byte used, 16 Byte free
 #   pragma udata overlay bank3=0x300
 #else
 	; in ASM, put the same bank, in overlay mode, at the same address
-bank3	udata_ovr	0x300
+bank3	equ			0x300
+bank3	udata_ovr	bank3
 #endif
 
-VAR_UINT  (int_O_desaturation_time);				// time until tissues desaturated to 5% remains, in minutes
-VAR_UINT  (int_O_nofly_time);						// altitude / no-fly waiting time time in minutes
-
-VAR_UINT  (int_O_ascenttime);						// time-to-surface (TTS) in minutes
-VAR_UINT  (int_O_alternate_ascenttime);				// TTS for the alternative dive plan
+VAR_UINT  (int_O_desaturation_time);			// time until tissues desaturated to 5% remains, in minutes
+VAR_UINT  (int_O_nofly_time);					// altitude / no-fly waiting time time in minutes
 
-VAR_UINT  (int_O_CNS_fraction);						// current CNS%
-VAR_UINT  (int_O_normal_CNS_fraction);				// CNS% at end of dive in normal dive plan
-VAR_UINT  (int_O_alternate_CNS_fraction);			// CNS% at end of dive in alternative plan
-
-VAR_UINT  (int_O_gradient_factor);					// current gradient factor in %, 100% = on M-line of straight Buhlmann
+VAR_UINT  (int_O_TTS_norm);						// ascent time (TTS) in normal      plan in minutes
+VAR_UINT  (int_O_TTS_alt);						// ascent time (TTS) in alternative plan in minutes
 
-VAR_UCHAR (char_O_lead_number);						// number of the leading tissue
-
-VAR_UCHAR (char_O_nullzeit);						// remaining NDL time in minutes
-VAR_UCHAR (char_O_alternate_nullzeit);				// remaining NDL time for the alternative dive plan
+VAR_UINT  (int_O_CNS_current);					// current CNS %
+VAR_UINT  (int_O_CNS_norm);						// CNS% at end of dive in normal dive plan
+VAR_UINT  (int_O_CNS_alt);						// CNS% at end of dive in alternative plan
 
-VAR_UCHAR (char_O_main_status);						// setup of the deco engine regarding the real tissue   computations
-VAR_UCHAR (char_O_deco_status);						// setup of the deco engine regarding the decompression computations
-VAR_UCHAR (char_O_deco_warnings);					// vector of warnings generated by the deco engine
-VAR_UCHAR (char_O_deco_info);						// vector of infos    generated by the deco engine
+VAR_UINT  (int_O_lead_supersat);				// supersaturation of the leading tissue in %, 100% = on M-line of straight Buhlmann
 
-VAR_UCHAR (char_O_EAD);								// equivalent air      depth (EAD) of breathed gas
-VAR_UCHAR (char_O_END);								// equivalent narcosis depth (END) of breathed gas
+VAR_UCHAR (char_O_lead_tissue);					// number of the leading tissue
+
+VAR_UCHAR (char_O_NDL_norm);					// remaining NDL time for the normal      dive plan in minutes
+VAR_UCHAR (char_O_NDL_alt);						// remaining NDL time for the alternative dive plan in minutes
 
-VAR_UCHAR (char_O_first_deco_depth);				// depth of first stop (deco or gas change)
-VAR_UCHAR (char_O_first_deco_time) ;				// duration of first stop
+VAR_UCHAR (char_O_main_status);					// setup of the deco engine regarding the real tissue   computations
+VAR_UCHAR (char_O_deco_status);					// setup of the deco engine regarding the decompression computations
+VAR_UCHAR (char_O_deco_warnings);				// vector of warnings generated by the deco engine
+VAR_UCHAR (char_O_deco_info);					// vector of infos    generated by the deco engine
 
-TAB_UCHAR (char_O_deco_depth, NUM_STOPS);			// stops table: depth, ...                       | ATTENTION: do not re-arrange these
-TAB_UCHAR (char_O_deco_time,  NUM_STOPS);			// ... duration, and                             |            three arrays relative
-TAB_UCHAR (char_O_deco_gas,   NUM_STOPS);			// ... gas breathed                              |            to each other!
-
-TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS);	// variant of the stops table for logging purpose
-
-TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP);	// nitrogen tissue pressures for display purpose
-TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP);	// helium   tissue pressures for display purpose
+VAR_UCHAR (char_O_EAD);							// equivalent air      depth (EAD) of breathed gas
+VAR_UCHAR (char_O_END);							// equivalent narcosis depth (END) of breathed gas
 
-TAB_UINT  (int_O_ascent_volumes,   NUM_GAS);		// gas volumes needed for ascent in liters
-TAB_UINT  (int_O_ascent_pres_need, NUM_GAS);		// tank pressures needed for ascent in bar
+TAB_UCHAR (char_O_tissue_pres_N2,    NUM_COMP);	// N2    tissue pressures   for display purpose
+TAB_UCHAR (char_O_tissue_pres_He,    NUM_COMP);	// He    tissue pressures   for display purpose
+TAB_UCHAR (char_O_tissue_pressure,   NUM_COMP);	// total tissue pressures   for display purpose
+TAB_UCHAR (char_O_tissue_saturation, NUM_COMP);	//       tissue saturations for display purpose
 
-VAR_UINT  (int_O_ceiling);							// ascent boundary in mbar relative pressure, calculated at GF-high
+TAB_UINT  (int_O_gas_need_vol,  NUM_GAS);		// gas volumes needed for ascent in liters
+TAB_UINT  (int_O_gas_need_pres, NUM_GAS);		// gas volumes needed for ascent in bar as per tank size
 
-VAR_UINT  (int_O_O2_ppO2);							// ppO2 of pure O2 at current depth
-VAR_UINT  (int_O_pure_ppO2);						// ppO2 of the current gas or dil if breathed pure
-VAR_UINT  (int_O_pSCR_ppO2);						// ppO2 calculated in pSCR loop
-VAR_UINT  (int_O_breathed_ppO2);					// ppO2 actually breathed (= char_O_pure_ppO2 if in OC)
+VAR_UINT  (int_O_ceiling);						// ascent boundary in mbar relative pressure, calculated at GF-high
+
+VAR_UINT  (int_O_breathed_ppO2);				// ppO2 actually breathed (= int_O_pure_ppO2 if in OC)
 
-TAB_UINT  (int_O_pressure_need, 2);					// pressure reading, need by deco calculations, in 0.1   bar
-VAR_UINT  (int_O_sac_rate);							// SAC rate in 0.1 liter/minute
+VAR_UINT  (int_O_O2_ppO2);						// ppO2 of pure O2 at current depth
+VAR_UINT  (int_O_pure_ppO2);					// ppO2 of the current gas or diluent if breathed pure
+VAR_UINT  (int_O_pSCR_ppO2);					// ppO2 calculated in pSCR loop
 
 
-#ifdef __18CXX
-	//---- BANK 4 DATA -------------------------------------------------------
-	// Gather all Data ASM-Code --> C-Code
-	// Memory usage: 86 Byte used, 170 byte free
-#   pragma udata overlay bank4=0x400
-#else
-	; in ASM, put the same bank, in overlay mode, at the same address
-bank4	udata_ovr	0x400
-#endif
+TAB_UINT  (int_O_pressure_need, 2);				// pressure reading, need by deco calculations, in 0.1 bar
+VAR_UINT  (int_O_SAC_measured);					// measured SAC rate in 0.1 liter/minute
+
+VAR_UCHAR (char_O_depth_sim);					// depth reached in deco calculation, used in deco calculator to show progress
 
 VAR_UINT  (int_I_pres_respiration);				// absolute pressure breathed
 VAR_UINT  (int_I_pres_surface);					// absolute pressure at surface
 
-VAR_UCHAR (char_I_current_gas);					// number of gas currently breathed (1..5 for configured gases, 6 for the manual gas)
+VAR_UCHAR (char_I_current_gas_num);				// number of gas currently breathed (1..5 for configured gases, 6 for the manual gas)
 VAR_UCHAR (char_I_current_gas_type);			// type of current gas: (0=Disabled), 1=First, 2=Travel/Normal, 3=Deco/-
 VAR_UCHAR (char_I_He_ratio);					// helium ratio of the currently breathed gas
 VAR_UCHAR (char_I_O2_ratio);					// oxygen ratio of the currently breathed gas
@@ -183,36 +170,34 @@
 VAR_UCHAR (char_I_sim_advance_time);			// 'fast forward' of dive time, used in simulation (+5 min function)
 VAR_UCHAR (char_I_extra_time);					// extra bottom time for fTTs and delayed ascent calculation in minutes
 
-VAR_UCHAR (char_I_const_ppO2);					// ppO2 reported from sensors or by setpoint
-
-TAB_UCHAR (char_I_setpoint_cbar,  NUM_SP);		// setpoints in cbar                        | ATTENTION: do not change the position of these
-TAB_UCHAR (char_I_setpoint_change,NUM_SP);		// change depth for the setpoints in meter  |            two arrays relative to each other!
+VAR_UCHAR (char_I_const_ppO2);					// ppO2 reported from sensors or selected setpoint
 
 TAB_UCHAR (char_I_deco_O2_ratio,  NUM_GAS);		// oxygen ratios of the configured gases, used for deco calc. | ATTENTION: do not change the
 TAB_UCHAR (char_I_deco_He_ratio,  NUM_GAS);		// helium ratios of the configured gases, used for deco calc. |            position of these
 TAB_UCHAR (char_I_deco_gas_type,  NUM_GAS);		// type          of the configured gases, used for deco calc. |            arrays relative to
 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS);		// change depths of the configured gases, used for deco calc. |            each other!
 
-TAB_UCHAR (char_I_tank_size,      NUM_GAS * 2);	// tank sizes, used for pressure needs and SAC calculations
-TAB_UCHAR (char_I_tank_pres_fill, NUM_GAS * 2);	// tank fill pressures (in multiples of 10 bar), used to generate warnings
+TAB_UCHAR (char_I_gas_avail_size, NUM_GAS * 2);	// tank sizes, used for pressure needs and SAC calculations
+TAB_UCHAR (char_I_gas_avail_pres, NUM_GAS * 2);	// tank pressures available (in multiples of 10 bar), used to generate warnings
 
-VAR_UCHAR (char_I_cc_max_frac_o2);				// limiter for maximum O2% in loop
+VAR_UCHAR (char_I_CC_max_frac_O2);				// limiter for maximum O2% in loop
 VAR_UCHAR (char_I_PSCR_drop);					// pSCR parameter drop [%]
 VAR_UCHAR (char_I_PSCR_lungratio);				// pSCR parameter lung ratio [1/x]
 
 VAR_UCHAR (char_I_altitude_wait);				// selector for altitude / no-fly waiting time calculation
 
-VAR_UCHAR (char_I_bottom_usage);				// gas consumption during bottom part and initial ascent   in liters/minute
-VAR_UCHAR (char_I_deco_usage);					// gas consumption during deco stops and following ascents in liters/minute
+VAR_UCHAR (char_I_SAC_work);					// gas consumption during bottom part and initial ascent   in liters/minute
+VAR_UCHAR (char_I_SAC_deco);					// gas consumption during deco stops and following ascents in liters/minute
 
 VAR_UCHAR (char_I_gas6_depth);					// change depth (MOD) of the manually configured gas in meters
 
-VAR_UCHAR (char_I_ppO2_max);					// warning threshold for maximum ppO2 during working phase of the dive
-VAR_UCHAR (char_I_ppO2_max_deco);				// warning threshold for maximum ppO2 during deco phase of the dive
+VAR_UCHAR (char_I_ppO2_max_work);				// warning threshold for maximum ppO2 during working phase of the dive
+VAR_UCHAR (char_I_ppO2_max_deco);				// warning threshold for maximum ppO2 during deco    phase of the dive
 VAR_UCHAR (char_I_ppO2_min);					// warning threshold for maximum ppO2 when breathing OC
 VAR_UCHAR (char_I_ppO2_min_loop);				// warning threshold for maximum ppO2 when breathing from CCR or pSCR
 
-VAR_UCHAR (char_I_ascent_speed);				// ascent speed in meters/minute
+VAR_UCHAR (char_I_ascent_speed);				// ascent  speed in meters/minute
+VAR_UCHAR (char_I_descent_speed);				// descent speed in meters/minute
 VAR_UCHAR (char_I_gas_change_time);				// extra time spent during a stop for doing a gas change, in minutes
 
 VAR_UCHAR (char_I_SAC_mode);					// SAC calculation mode
@@ -227,6 +212,30 @@
 
 VAR_UCHAR (char_I_backtrack_time);				// index (in minutes) of backtrack entries in char_I_backtrack_depth
 
+VAR_UINT  (int_O_profiling_overrun);			// current scheduling overrun in ms
+VAR_UINT  (int_O_profiling_overrun_max);		// maximum scheduling overrun in ms
+VAR_UCHAR (char_O_profiling_overrun_phase);		// calculation phase causing the maximum overrun
+VAR_UCHAR (char_O_profiling_runs_norm);			// runs per cycle for normal      plan
+VAR_UCHAR (char_O_profiling_runs_alt);			// runs per cycle for alternative plan
+
+TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS_LOG);	// times of the shallowest NUM_STOPS_LOG deco stops
+
+
+#ifdef __18CXX
+	//---- BANK 4 DATA -------------------------------------------------------
+	// Gather all Data ASM-Code --> C-Code
+	// Memory usage: 96 Byte used, 160 byte free
+#   pragma udata overlay bank4=0x400
+#else
+	; in ASM, put the same bank, in overlay mode, at the same address
+bank4	equ			0x400
+bank4	udata_ovr	bank4
+#endif
+
+TAB_UCHAR (char_O_deco_depth, NUM_STOPS);			// stops table: depth, ...  | ATTENTION: do not re-arrange these
+TAB_UCHAR (char_O_deco_time,  NUM_STOPS);			// ... duration, and        |            three arrays relative
+TAB_UCHAR (char_O_deco_gas,   NUM_STOPS);			// ... gas breathed         |            to each other!
+
 
 #ifdef __18CXX
 	//---- BANK 11 DATA -------------------------------------------------------