comparison src/hwos.inc @ 560:b7eb98dbd800

bump to 2.96beta (REFACTORED VERSION)
author heinrichsweikamp
date Wed, 31 Jan 2018 19:39:37 +0100
parents 9cb967d844f0
children 9c54849b8d3b
comparison
equal deleted inserted replaced
559:9cb967d844f0 560:b7eb98dbd800
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File hwos.inc 3 ; File hwos.inc REFACTORED VERSION V2.95a1
4 ; 4 ;
5 ; OSTC Platform definitions 5 ; OSTC Platform definitions
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
13 13
14 LIST P=18F87K22 ; change also: Configure->SelectDevice from Mplab 14 LIST P=18F87K22 ; change also: Configure->SelectDevice from Mplab
15 15
16 ;#DEFINE __DEBUG 16 ;#DEFINE __DEBUG
17 17
18 ;#DEFINE french_italian ; If defined, use french and italian instead of english and german 18 ;#DEFINE french_italian ; If defined, use french and italian instead of english and german
19 19
20 #include <p18f87k22.inc> 20 #include <p18f87k22.inc>
21 #include <ports.inc> ; Portmap 21 #include <ports.inc> ; Portmap
22 22
23 ; Firmware definition 23 ; Firmware definition
24 #DEFINE softwareversion_x d'2' ; Software version XX.YY 24 #DEFINE softwareversion_x d'2' ; Software version XX.YY
25 #DEFINE softwareversion_y d'27' ; Software version XX.YY 25 #DEFINE softwareversion_y d'96' ; Software version XX.YY
26 #DEFINE softwareversion_beta 0 ; (and 0 for release) 26 #DEFINE softwareversion_beta 1 ; (and 0 for release)
27
27 ; Firmware version will appear in "Change Firmware" style 28 ; Firmware version will appear in "Change Firmware" style
28 #DEFINE firmware_expire_year .18 29 #DEFINE firmware_expire_year .18
29 #DEFINE firmware_expire_month .12 30 #DEFINE firmware_expire_month .2
30 #DEFINE firmware_expire_day .3 31 #DEFINE firmware_expire_day .22
31 32
32 #DEFINE comm_service_key 0xABCDEF 33 #DEFINE comm_service_key 0xABCDEF
33 34
34 ;----------------------------------------------------------------------------- 35 ;-----------------------------------------------------------------------------
35 36
44 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7,8125ms -> 1s 45 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7,8125ms -> 1s
45 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7,8125ms -> 0.25s 46 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7,8125ms -> 0.25s
46 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7,8125ms -> 0.5s 47 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7,8125ms -> 0.5s
47 48
48 ; Color Definitions: 8Bit RGB b'RRRGGGBB' 49 ; Color Definitions: 8Bit RGB b'RRRGGGBB'
49 #DEFINE color_red b'11100000' ; (7,0,0) 50 #DEFINE color_red b'11100000' ; (7,0,0)
50 #DEFINE color_dark_red b'10000101' ; (4,1,1) 51 #DEFINE color_dark_red b'10000101' ; (4,1,1)
51 #DEFINE color_violet b'11101011' ; (7,2,3) 52 #DEFINE color_violet b'11101011' ; (7,2,3)
52 #DEFINE color_blue b'11000111' ; (6,1,3) 53 #DEFINE color_blue b'11000111' ; (6,1,3)
53 #DEFINE color_green b'00011100' ; (0,7,0) 54 #DEFINE color_green b'00011100' ; (0,7,0)
54 #DEFINE color_greenish b'00111110' ; (1,7,2) 55 #DEFINE color_greenish b'00111110' ; (1,7,2)
55 #DEFINE color_dark_green b'00111001' ; (1,6,1) 56 #DEFINE color_dark_green b'00111001' ; (1,6,1)
56 #DEFINE color_yellow b'11111101' ; (7,7,1) 57 #DEFINE color_yellow b'11111101' ; (7,7,1)
57 #DEFINE color_white b'11111111' ; (7,7,3) 58 #DEFINE color_white b'11111111' ; (7,7,3)
72 #DEFINE warn_cns .2 73 #DEFINE warn_cns .2
73 #DEFINE warn_gf .3 74 #DEFINE warn_gf .3
74 #DEFINE warn_ppo2 .4 75 #DEFINE warn_ppo2 .4
75 #DEFINE warn_ceiling .5 76 #DEFINE warn_ceiling .5
76 #DEFINE warn_gas_in_gaslist .6 77 #DEFINE warn_gas_in_gaslist .6
77 #DEFINE warn_ppo2_hud .7 78 #DEFINE warn_ppo2_hud .7
78 #DEFINE warn_battery .8 79 #DEFINE warn_battery .8
80 #DEFINE warn_stop .9
79 81
80 ; External O2 cell input parameters 82 ; External O2 cell input parameters
81 #DEFINE min_mv .80 ; = 8mV 83 #DEFINE min_mv .80 ; = 8mV
82 #DEFINE max_mv .2500 ; = 250mV 84 #DEFINE max_mv .2500 ; = 250mV
83 #DEFINE ignore_mv .3500 ; = 350mV (To suppress ghost readings for long, open cables) 85 #DEFINE ignore_mv .3500 ; = 350mV (To suppress ghost readings for long, open cables)
84 86
85 ; Profile recording parameters 87 ; Profile recording parameters
86 #DEFINE logbook_profile_version 0x24 88 #DEFINE logbook_profile_version 0x24
87 #DEFINE samplingrate_apnoe .1 ; [seconds] 89 #DEFINE samplingrate_apnoe .1 ; [seconds]
90
88 ; Warning: Divisors must be <.16 ! 91 ; Warning: Divisors must be <.16 !
89 #DEFINE div_temperature .6 ; x samplingrate [s] 92 #DEFINE div_temperature .6 ; x samplingrate [s]
90 #DEFINE div_deco .6 ; x samplingrate [s] 93 #DEFINE div_deco .6 ; x samplingrate [s]
91 #DEFINE div_gf .12 ; x samplingrate [s] 94 #DEFINE div_gf .12 ; x samplingrate [s]
92 #DEFINE div_ppo2_sensors .2 ; x samplingrate [s] 95 #DEFINE div_ppo2_sensors .2 ; x samplingrate [s]
93 #DEFINE div_decoplan .12 ; x samplingrate [s] 96 #DEFINE div_decoplan .12 ; x samplingrate [s]
94 #DEFINE div_cns .12 ; x samplingrate [s] 97 #DEFINE div_cns .12 ; x samplingrate [s]
95 #DEFINE div_tank .0 ; x samplingrate [s] 98 #DEFINE div_tank .0 ; x samplingrate [s]
99
96 ; Warning: Information lengths must be <.16 ! 100 ; Warning: Information lengths must be <.16 !
97 #DEFINE infolength_temperature .2 ; [byte] 101 #DEFINE infolength_temperature .2 ; [byte]
98 #DEFINE infolength_deco .2 ; [byte] 102 #DEFINE infolength_deco .2 ; [byte]
99 #DEFINE infolength_gf .1 ; [byte] 103 #DEFINE infolength_gf .1 ; [byte]
100 #DEFINE infolength_ppo2_sensors .9 ; [byte] 104 #DEFINE infolength_ppo2_sensors .9 ; [byte]
108 #DEFINE minimum_change_depth .3 ; [m] 112 #DEFINE minimum_change_depth .3 ; [m]
109 #DEFINE better_gas_window_neg .3 ; [m] (Depth above change depth) 113 #DEFINE better_gas_window_neg .3 ; [m] (Depth above change depth)
110 #DEFINE better_gas_window_pos .1 ; [m] (Depth below change depth, if ppO2<opt_ppO2_max) 114 #DEFINE better_gas_window_pos .1 ; [m] (Depth below change depth, if ppO2<opt_ppO2_max)
111 115
112 ; Dive mode limits and thresholds 116 ; Dive mode limits and thresholds
113 #DEFINE start_dive_threshold .100 ; [cm] 117 #DEFINE start_dive_threshold .100 ; [cm]
114 #DEFINE high_altitude_dive_threshold .300;[cm] 118 #DEFINE high_altitude_dive_threshold .300 ; [cm]
115 #DEFINE apnoe_timeout .15 ; [min] 119 #DEFINE apnoe_timeout .15 ; [min]
116 #DEFINE divemode_menuview_timeout .10 ; [s] 120 #DEFINE divemode_menuview_timeout .10 ; [s]
117 #DEFINE divemode_timeout_default .5 ; [min] 121 #DEFINE divemode_timeout_default .5 ; [min]
118 #DEFINE divemode_menu_timeout .30 ; [s] 122 #DEFINE divemode_menu_timeout .30 ; [s]
119 #DEFINE ppo2_warning_low .19 ; [cbar] (Default value) 123
120 #DEFINE ppo2_lowest_setting .16 ; [cbar] (Minimum value) 124 #DEFINE ppo2_warning_low .19 ; [cbar] (Default value)
121 #DEFINE ppo2_display_high .120 ; [cbar] 125 #DEFINE ppo2_lowest_setting .16 ; [cbar] (Minimum value)
122 #DEFINE ppo2_warning_high .160 ; [cbar] (Default value) for bottom/travel gases 126 ;#DEFINE ppo2_display_high .120 ; [cbar] ## V2.94 moved to p2_deco.c
127 #DEFINE ppo2_warning_high .160 ; [cbar] (Default value) for bottom/travel gases
123 #DEFINE ppo2_warning_high_deco .160 ; [cbar] (Default value) for deco gases 128 #DEFINE ppo2_warning_high_deco .160 ; [cbar] (Default value) for deco gases
124 #DEFINE ppo2_highest_setting .160 ; [cbar] (Max. Value) for bottom/travel gases 129 #DEFINE ppo2_highest_setting .160 ; [cbar] (Max. Value) for bottom/travel gases
125 #DEFINE ppo2_highest_setting_deco .160 ; [cbar] (Max. Value) for deco gases 130 #DEFINE ppo2_highest_setting_deco .160 ; [cbar] (Max. Value) for deco gases
126 #DEFINE cns_display_high .70 ; [%] 131
127 #DEFINE cns_warning_high .100 ; [%] 132 ; NEW ## min ppO2 CC
128 #DEFINE gf_display_high .75 ; [%] 133 #DEFINE ppo2_warning_low_cc .40 ; [cbar] Default value for loop
129 #DEFINE gf_warning_high .100 ; [%] 134 #DEFINE ppo2_warning_low_cc_min .20 ; [cbar] Default value for loop
135 #DEFINE ppo2_warning_low_cc_max .60 ; [cbar] Default value for loop
136
137 ;#DEFINE cns_display_high .70 ; [%] ## V2.94 moved to p2_deco.c
138 ;#DEFINE cns_warning_high .100 ; [%] ## V2.94 moved to p2_deco.c
139 ;#DEFINE gf_display_high .75 ; [%] ## V2.94 moved to p2_deco.c
140 ;#DEFINE gf_warning_high .100 ; [%] ## V2.94 moved to p2_deco.c
130 #DEFINE depth_warn_mbar .13000 ; [mbar] 141 #DEFINE depth_warn_mbar .13000 ; [mbar]
131 #DEFINE wake_up_from_sleep .1160 ; [mbar] 142 #DEFINE wake_up_from_sleep .1160 ; [mbar]
132 #DEFINE gf_display_threshold .20 ; [%] 143 #DEFINE gf_display_threshold .20 ; [%]
133 #DEFINE simulator_timeout .15 ; [s] 144 #DEFINE simulator_timeout .15 ; [s]
134 #DEFINE sensor_voting_logic_threshold .20 ; Threshold in 0.01bar 145
135 146 #DEFINE sensor_voting_logic_threshold .10 ; Threshold in 0.01bar
136 147
137 ; Surface mode limits and thresholds 148 ; Surface mode limits and thresholds
138 #DEFINE cns_display_surface_high .70 ; [%] 149 #DEFINE cns_display_surface_high .70 ; [%]
139 #DEFINE high_altitude_threshold .880 ; [mbar] 150 #DEFINE high_altitude_threshold .880 ; [mbar]
140 #DEFINE max_surfpressure .1080 ; [mbar] 151 #DEFINE max_surfpressure .1080 ; [mbar]
141 #DEFINE timeout_surfacemode .90 ; [s] 152 #DEFINE timeout_surfacemode .90 ; [s]
142 #DEFINE timeout_calibrate_menu .240 ; [s] 153 #DEFINE timeout_calibrate_menu .240 ; [s]
143 #DEFINE timeout_ccr_surface .240 ; [s] 154 #DEFINE timeout_ccr_surface .240 ; [s]
144 155
145 ; Decomodel paramters 156 ; Decomodel paramters
146 #DEFINE no_fly_time_ratio .60 ; [%]
147 #DEFINE deco_distance .10 ; [dm] 157 #DEFINE deco_distance .10 ; [dm]
148 158
149 ; Color-code parameters for the divemode 159 ; Color-code parameters for the divemode
150 #DEFINE color_code_cns_high .100 ; [%] 160 ;#DEFINE color_code_cns_high .100 ; [%] ## V2.94 moved to p2_deco.c
151 #DEFINE color_code_gf_warn_high .101 ; [%] 161 ;#DEFINE color_code_gf_warn_high .101 ; [%] ## V2.94 moved to p2_deco.c
152 #DEFINE color_code_velocity_warn_high .11 ;[m/min] 162 #DEFINE color_code_velocity_warn_high .11 ;[m/min]
153 #DEFINE color_code_velocity_attn_high .10 ;[m/min] 163 #DEFINE color_code_velocity_attn_high .10 ;[m/min]
154 164
155 ; Velocity threshold 165 ; Velocity threshold
156 #DEFINE velocity_display_threshold_1 .3 ; [m/min] 166 #DEFINE velocity_display_threshold_1 .3 ; [m/min]
157 167
158 ; Battery thresholds 168 ; Battery thresholds
170 #DEFINE lithium_36v_10 .2500 ; [mV] 180 #DEFINE lithium_36v_10 .2500 ; [mV]
171 181
172 ; Capacity for 2.4Ah Saft LS14500 and 0.8Ah Panasonic UR14500P 182 ; Capacity for 2.4Ah Saft LS14500 and 0.8Ah Panasonic UR14500P
173 ; battery_gauge:6 is nAs 183 ; battery_gauge:6 is nAs
174 ; devide through 65536 184 ; devide through 65536
175 ; a) devide through 364 -> Result is in percent of a 2.4Ah Battery 185 ; a) devide through 364 -> Result is in percent of a 2.4Ah Battery
176 ; or b) devide through 121 -> Result is in percent of a 0.8Ah Battery 186 ; or b) devide through 121 -> Result is in percent of a 0.8Ah Battery
177 187
178 ; For internal battery gauging 188 ; For internal battery gauging
179 #DEFINE internal_saft_capacity .364 189 #DEFINE internal_saft_capacity .364
180 #DEFINE internal_panasonic_capacity .121 190 #DEFINE internal_panasonic_capacity .121
181 191
182 ; For gauge IC 192 ; For gauge IC
183 #DEFINE saft_capacity .281 ; 2.4Ah/0.085mAh/100 [%] 193 #DEFINE saft_capacity .281 ; 2.4Ah/0.085mAh/100 [%]
184 #DEFINE saft_offset .37300 ; 65536-(2.4Ah/0.085mAh) 194 #DEFINE saft_offset .37300 ; 65536-(2.4Ah/0.085mAh)
185 195
186 #DEFINE panasonic_capacity .94 ; 0.8Ah/0.085mAh/100 [%] 196 #DEFINE panasonic_capacity .94 ; 0.8Ah/0.085mAh/100 [%]
187 #DEFINE panasonic_offset .56124 ; 65536-(0.8Ah/0.085mAh) 197 #DEFINE panasonic_offset .56124 ; 65536-(0.8Ah/0.085mAh)
188 198
189 #DEFINE ncr18650_capacity .364 ; 3.1Ah/0.085mAh/100 [%] 199 #DEFINE ncr18650_capacity .364 ; 3.1Ah/0.085mAh/100 [%]
190 #DEFINE ncr18650_offset .29065 ; 65536-(3.1Ah/0.085mAh) 200 #DEFINE ncr18650_offset .29065 ; 65536-(3.1Ah/0.085mAh)
191 201
227 ; Compass display 237 ; Compass display
228 #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold 238 #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold
229 #DEFINE compass_averaging .10 ; numbers of extra averaging 239 #DEFINE compass_averaging .10 ; numbers of extra averaging
230 240
231 ; Hardware defines 241 ; Hardware defines
232 #DEFINE battery_gauge_available hardware_flag,0 ; OSTC has rechargeable battery with battery management chip 242 #DEFINE battery_gauge_available hardware_flag,0 ; OSTC has rechargeable battery with battery management chip
233 #DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor 243 #DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor
234 #DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital 244 #DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital
235 #DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input 245 #DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input
236 #DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module 246 #DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module
237 ;unused 247 #DEFINE ostc_rx_present hardware_flag,5 ; OSTC_RX circuity present
238 ;unused 248 ;unused
239 ;unused 249 ;unused
240 250
241 ;---------------------------- Macros ------------------------------------ 251 ;---------------------------- Macros ------------------------------------
242 252
249 ;---------------------------- Bank0 DATA ------------------------------------ 259 ;---------------------------- Bank0 DATA ------------------------------------
250 isr_backup equ 0x60 260 isr_backup equ 0x60
251 isr_backup udata_ovr isr_backup ; Reserved space for interupt data 261 isr_backup udata_ovr isr_backup ; Reserved space for interupt data
252 262
253 ;---- Backup for general registers 263 ;---- Backup for general registers
254 isr_prod res 2 264 isr_prod res 2
255 265
256 ;---- MS5541 subroutines 266 ;---- MS5541 subroutines
257 amb_pressure res 2 267 amb_pressure res 2
258 temperature res 2 268 temperature res 2
259 269
260 C1 res 2 ; Decoded calibration data 270 C1 res 2 ; Decoded calibration data
261 C2 res 2 271 C2 res 2
262 C3 res 2 272 C3 res 2
263 C4 res 2 ; Here: C4-250 273 C4 res 2 ; Here: C4-250
264 C5 res 2 ; Here: Reference Temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) 274 C5 res 2 ; Here: Reference Temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
265 C6 res 2 275 C6 res 2
266 D1 res 2 ; raw pressure 276 D1 res 2 ; raw pressure
267 D2 res 2 ; raw temperature 277 D2 res 2 ; raw temperature
268 xdT res 2 278 xdT res 2
269 xdT2 res 2 279 xdT2 res 2
270 OFF res 2 280 OFF res 2
271 SENS res 2 281 SENS res 2
272 dLSB res 1 ;Pressure sensor interface 282 dLSB res 1 ; Pressure sensor interface
273 dMSB res 1 283 dMSB res 1
274 clock_count res 1 284 clock_count res 1
275 sensor_state_counter res 1 ; counts to eight for state maschine 285 sensor_state_counter res 1 ; counts to eight for state maschine
276 amb_pressure_avg res 2 286 amb_pressure_avg res 2
277 temperature_avg res 2 287 temperature_avg res 2
278 minimum_temperature res 2 ; minimum temperature 288 minimum_temperature res 2 ; minimum temperature
279 last_temperature res 2 289 last_temperature res 2
280 last_pressure res 2 290 last_pressure res 2
281 last_pressure_velocity res 2 ; For velocity 291 last_pressure_velocity res 2 ; For velocity
282 last_surfpressure res 2 292 last_surfpressure res 2
283 last_surfpressure_15min res 2 293 last_surfpressure_15min res 2
284 last_surfpressure_30min res 2 294 last_surfpressure_30min res 2
285 rel_pressure res 2 295 rel_pressure res 2
286 sim_pressure res 2 ; hold simulated pressure in mbar if in Simulator mode 296 sim_pressure res 2 ; hold simulated pressure in mbar if in Simulator mode
287 max_pressure res 2 297 max_pressure res 2
288 avg_rel_pressure res 2 298 avg_rel_pressure res 2
289 avg_rel_pressure_total res 2 299 avg_rel_pressure_total res 2
290 ;---- Data for ISR math subroutines 300 ;---- Data for ISR math subroutines
291 isr_xC res 4 301 isr_xC res 4
292 isr_xA res 2 302 isr_xA res 2
293 isr_xB res 2 303 isr_xB res 2
294 304
295 ;---- Data for ISR routines 305 ;---- Data for ISR routines
296 isr1_temp res 1 ; ISR temp variable, used in ms5541.asm, isr_rtcc, isr_battery_gauge 306 isr1_temp res 1 ; ISR temp variable, used in ms5541.asm, isr_rtcc, isr_battery_gauge
297 isr2_temp res 1 ; ISR temp variable, used isr_battery_gauge 307 isr2_temp res 1 ; ISR temp variable, used isr_battery_gauge
298 308
299 ;---- Display brightness 309 ;---- Display brightness
300 max_CCPR1L res 1 ; Max. brightness value for CCPR1L 310 max_CCPR1L res 1 ; Max. brightness value for CCPR1L
301 311
302 ; Battery gauge (nAs, nC) 312 ; Battery gauge (nAs, nC)
303 battery_gauge res 6 ; 48Bit -> 78Ah max... 313 battery_gauge res 6 ; 48Bit -> 78Ah max...
304 314
305 ; IR/S8-Link 315 ; IR/S8-Link
306 ir_s8_buffer res .18 ; temporally used in get_calibration_data for the raw (packed) calibration data 316 ir_s8_buffer res .18 ; temporally used in get_calibration_data for the raw (packed) calibration data
307 ir_s8_counter res 1 317 ir_s8_counter res 1
308 ir_S8_timeout res 1 ; Timeout for valid data 318 ir_S8_timeout res 1 ; Timeout for valid data
332 342
333 ; Compass more data 343 ; Compass more data
334 compass_heading res 2 ; Corrected heading (in 1°) : -180 .. 180 344 compass_heading res 2 ; Corrected heading (in 1°) : -180 .. 180
335 compass_heading_old res 2 ; Old heading (For smoother display) 345 compass_heading_old res 2 ; Old heading (For smoother display)
336 compass_heading_shown res 2 ; Displayed heading 346 compass_heading_shown res 2 ; Displayed heading
337 ;compass_roll res 2 ; Rotation around the X axis 347 ;compass_roll res 2 ; Rotation around the X axis
338 ;compass_pitch res 2 ; Rotation around the Y axis 348 ;compass_pitch res 2 ; Rotation around the Y axis
339 349
340 compass_a res 2 ; Tmp data for Q15 arithmetics 350 compass_a res 2 ; Tmp data for Q15 arithmetics
341 compass_b res 2 351 compass_b res 2
342 compass_r res 3 352 compass_r res 3
343 353
344 CNS_start res 2 ; CNS value at beginning of dive 354 CNS_start res 2 ; CNS value at beginning of dive
345 GF_start res 1 ; GF value at beginning of dive 355 GF_start res 1 ; GF value at beginning of dive
346 356
347 speed_setting res 1 ; =1: Eco, =2: Normal, =3: Fastest 357 speed_setting res 1 ; =1: Eco, =2: Normal, =3: Fastest
348 358
349 ;---- Data for graphical compass 359 ;---- Data for graphical compass
350 xRD res 2 ; virtual compass ruler offset 360 xRD res 2 ; virtual compass ruler offset
351 xRDr res 2 ; virtual compass ruler offset - right end 361 xRDr res 2 ; virtual compass ruler offset - right end
352 xRD180 res 2 ; virtual compass ruler offset for the -180 marker 362 xRD180 res 2 ; virtual compass ruler offset for the -180 marker
353 xLO res 1 ; lo backup to prevent trashing 363 xLO res 1 ; lo backup to prevent trashing
354 xHI res 1 ; hi backup to prevent trashing 364 xHI res 1 ; hi backup to prevent trashing
355 xCM res 1 ; compass bearing relative position 365 xCM res 1 ; compass bearing relative position
356 compass_bearing res 2 ; this is where the bearing menu stores the actual heading for bearing 366 compass_bearing res 2 ; this is where the bearing menu stores the actual heading for bearing
357 367
358 ;---------------------------- Common DATA ------------------------------------ 368 ;---------------------------- Common DATA ------------------------------------
359 369
360 common equ 0x100 ; Alias for "banksel common" 370 common equ 0x100 ; Alias for "banksel common"
361 common udata_ovr common ; Bank1 general variables 371 common udata_ovr common ; Bank1 general variables
362 372
363 ;---- Time and Date 373 ;---- Time and Date
364 secs res 1 374 secs res 1
365 mins res 1 375 mins res 1
366 hours res 1 376 hours res 1
367 day res 1 377 day res 1
368 month res 1 378 month res 1
369 year res 1 379 year res 1
370 surface_interval res 2 380 surface_interval res 2
371 381
372 flag1 res 1 382 flag1 res 1
373 flag2 res 1 383 flag2 res 1
374 flag3 res 1 384 flag3 res 1
375 flag4 res 1 385 flag4 res 1
376 flag5 res 1 386 flag5 res 1
377 flag6 res 1 387 flag6 res 1
378 flag7 res 1 388 flag7 res 1
379 flag8 res 1 389 flag8 res 1
380 flag9 res 1 390 flag9 res 1
381 flag10 res 1 391 flag10 res 1
382 flag11 res 1 392 flag11 res 1
383 flag12 res 1 393 flag12 res 1
384 flag13 res 1 394 flag13 res 1
385 flag14 res 1 395 flag14 res 1
386 396
387 hardware_flag res 1 ; hardware descriptor flag 397 hardware_flag res 1 ; hardware descriptor flag
388 398
389 temp1 res 1 399 temp1 res 1
390 temp2 res 1 400 temp2 res 1
391 401
392 ;---- Interface to wait macros 402 ;---- Interface to wait macros
428 sub_c res 2 438 sub_c res 2
429 sub_a res 2 439 sub_a res 2
430 sub_b res 2 440 sub_b res 2
431 441
432 ;---- Data for conversion subroutines 442 ;---- Data for conversion subroutines
433 cvt_flags res 1 443 cvt_flags res 2
434 ignore_digits res 1 444 ignore_digits res 1
435 445
436 #define leftbind cvt_flags,0 446 #define leftbind cvt_flags,0
437 #define ignore_digit3 cvt_flags,1 447 #define ignore_digit3 cvt_flags,1
438 #define ignore_digit4 cvt_flags,2 448 #define ignore_digit4 cvt_flags,2
439 #define ignore_digit5 cvt_flags,3 449 #define ignore_digit5 cvt_flags,3
440 #DEFINE enable_screen_dumps cvt_flags,4 ; =1: Ignore vin_usb, wait for "l" command (Screen dump 450 #DEFINE enable_screen_dumps cvt_flags,4 ; =1: Ignore vin_usb, wait for "l" command (Screen dump
441 #DEFINE screen_type cvt_flags,5 ; =1: display1, =0; display0 451 #DEFINE screen_type cvt_flags,5 ; =1: display1, =0; display0
442 #DEFINE compass_type cvt_flags,6 ; =1: compass1, =0: compass0 452 #DEFINE compass_type cvt_flags,6 ; =1: compass1, =0: compass0
443 #DEFINE analog_switches cvt_flags,7 ; =1: Analog switches available 453 #DEFINE analog_switches cvt_flags,7 ; =1: Analog switches available
454
455 #DEFINE compass_type2 cvt_flags+1,0 ; =1: Compass2, =0: Compass1 or compass0
456
457
444 ;---- Misc. 458 ;---- Misc.
445 nofly_time res 2 ; No Fly time in Minutes (Calculated after Dive)
446 timeout_counter res 1 459 timeout_counter res 1
447 timeout_counter2 res 1 460 timeout_counter2 res 1
448 timeout_counter3 res 1 461 timeout_counter3 res 1
449 batt_voltage res 2 ; Battery voltage in mV 462 batt_voltage res 2 ; Battery voltage in mV
450 batt_percent res 1 ; Battery in percent (1-100) 463 batt_percent res 1 ; Battery in percent (1-100)
451 ambient_light res 2 ; ambient_light level 464 ambient_light res 2 ; ambient_light level
452 lo_temp res 1 465 lo_temp res 1
453 hi_temp res 1 466 hi_temp res 1
454 desaturation_time res 2
455 convert_value_temp res 3 ; used in menu_battery_state_convert_date 467 convert_value_temp res 3 ; used in menu_battery_state_convert_date
456 active_gas res 1 468 active_gas res 1 ; the currently breathed gas (1-5)
457 active_diluent res 1 ; As a backup when switching back from Bailout to CCR 469 active_diluent res 1 ; backup when switching back from bailout to CCR/pSCR loop
458 warning_counter res 1 ; Counts amount of warning in divemode 470 warning_counter res 1 ; Counts amount of warning in divemode
459 warning_counter_backup res 1 ; Backup of warning_counter
460 warning_page res 1 ; current # of warning page 471 warning_page res 1 ; current # of warning page
461 472
462 ; Remind history for menu processor (and such): 473 ; Remind history for menu processor (and such):
463 menustack res 5 ; menu stack 474 menustack res 5 ; menu stack
464 menupos res 1 ; Logbook and divemode menu 475 menupos res 1 ; Logbook and divemode menu
491 apnoe_timeout_counter res 1 502 apnoe_timeout_counter res 1
492 apnoe_surface_mins res 1 503 apnoe_surface_mins res 1
493 apnoe_surface_secs res 1 504 apnoe_surface_secs res 1
494 505
495 ; Profile storing 506 ; Profile storing
496 AlarmType res 1 507 AlarmType res 1
497 samplesecs res 1 508 samplesecs res 1
498 EventByte res 1 509 EventByte res 1
499 EventByte2 res 1 510 EventByte2 res 1
500 ProfileFlagByte res 1 511 ProfileFlagByte res 1
501 512
502 ; External flash 513 ; External flash
503 ext_flash_address res 3 ; 24bit Address 514 ext_flash_address res 3 ; 24bit Address
504 ext_flash_log_pointer res 3 ; 24bit Address for logbook profile storing 515 ext_flash_log_pointer res 3 ; 24bit Address for logbook profile storing
505 ext_flash_dive_counter res 3 ; 24bit Counter for dive length (increased in write_byte_ext_flash_plus) 516 ext_flash_dive_counter res 3 ; 24bit Counter for dive length (increased in write_byte_ext_flash_plus)
523 #DEFINE sensor2_active hud_status_byte,4 ;=1: Sensor2 is active 534 #DEFINE sensor2_active hud_status_byte,4 ;=1: Sensor2 is active
524 #DEFINE sensor3_active hud_status_byte,5 ;=1: Sensor3 is active 535 #DEFINE sensor3_active hud_status_byte,5 ;=1: Sensor3 is active
525 ;Bit6 unused in stand-alone HUD 536 ;Bit6 unused in stand-alone HUD
526 ;Bit7 unused in stand-alone HUD 537 ;Bit7 unused in stand-alone HUD
527 538
528 sensor_setpoint res 1 ; sensor ppo2 in 0.01bar for deco routine 539 sensor_setpoint res 1 ; sensor ppo2 in 0.01bar for deco routine
529 540
530 better_gas_number res 1 ; number (1-5) of the "better gas" in divemode, =0: no better gas available 541 better_gas_number res 1 ; number (1-5) of the "better gas" in divemode, =0: no better gas available
531 customview_divemode res 1 ; keeps last custom view 542 customview_divemode res 1 ; keeps last custom view
532 customview_surfmode res 1 543 customview_surfmode res 1
533 safety_stop_countdown res 1 ; counts seconds of safety stop 544 safety_stop_countdown res 1 ; counts seconds of safety stop
545 tft_update_flags res 3 ; probably more then needed...
546
547 ; bank common 1 Byte left here...
548
534 549
535 ;---------------------------- TMP DATA --------------------------------------- 550 ;---------------------------- TMP DATA ---------------------------------------
536 ; Space for various overlayed data from color, word, menu processors, etc. 551 ; Space for various overlayed data from color, word, menu processors, etc.
537 ; 552 ;
538 553
543 ;---------------------------- Common2 DATA ------------------------------------ 558 ;---------------------------- Common2 DATA ------------------------------------
544 559
545 common2 equ 0xA00 ; Alias for "banksel common" 560 common2 equ 0xA00 ; Alias for "banksel common"
546 common2 udata_ovr common2 ; Bank1 general variables 561 common2 udata_ovr common2 ; Bank1 general variables
547 562
548 s8_rawdata_sensor1 res 3 ; 24bit A/D raw data from S8 HUD sensor 1 563 s8_rawdata_sensor1 res 3 ; 24bit A/D raw data from S8 HUD sensor 1
549 s8_rawdata_sensor2 res 3 ; 24bit A/D raw data from S8 HUD sensor 2 564 s8_rawdata_sensor2 res 3 ; 24bit A/D raw data from S8 HUD sensor 2
550 s8_rawdata_sensor3 res 3 ; 24bit A/D raw data from S8 HUD sensor 3 565 s8_rawdata_sensor3 res 3 ; 24bit A/D raw data from S8 HUD sensor 3
551 566
552 hud_battery_mv res 2 ; hud/ppo2 monitor battery voltage in mV 567 hud_battery_mv res 2 ; hud/ppo2 monitor battery voltage in mV
553 start_day res 1 ; At start of dive (For logbook) 568 start_day res 1 ; At start of dive (For logbook)
554 start_month res 1 ; At start of dive (For logbook) 569 start_month res 1 ; At start of dive (For logbook)
555 start_year res 1 ; At start of dive (For logbook) 570 start_year res 1 ; At start of dive (For logbook)
556 start_hours res 1 ; At start of dive (For logbook) 571 start_hours res 1 ; At start of dive (For logbook)
557 start_mins res 1 ; At start of dive (For logbook) 572 start_mins res 1 ; At start of dive (For logbook)
558 573
559 old_velocity res 4 ; Stores the last 4 speeds (8 seconds) in m/min 574 old_velocity res 4 ; Stores the last 4 speeds (8 seconds) in m/min
560 opt_gas_type_backup res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco 575 opt_gas_type_backup res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco
561 opt_dil_type_backup res 5 ; 0=Disabled, 1=First, 2=Normal 576 opt_dil_type_backup res 5 ; 0=Disabled, 1=First, 2=Normal
562 opt_OC_bail_gas_change_backup res 5 ; Gas change depths OC/Bailout 577
563 opt_dil_change_backup res 5; Gas change depths Diluents 578 opt_OC_bail_gas_change_backup res 5 ; Gas change depths OC/Bailout
579 opt_dil_change_backup res 5 ; Gas change depths Diluents
564 580
565 internal_battery_capacity res 2 ; For internal battery gauging 581 internal_battery_capacity res 2 ; For internal battery gauging
566 battery_capacity res 2 ; For battery gauge IC 582 battery_capacity res 2 ; For battery gauge IC
567 battery_offset res 2 ; For battery gauge IC 583 battery_offset res 2 ; For battery gauge IC
568 584
569 analog_sw1_raw res 2 ; idle values (average) 585 analog_sw1_raw res 2 ; idle values (average)
570 analog_sw2_raw res 2 ; idle values (average) 586 analog_sw2_raw res 2 ; idle values (average)
571 analog_counter res 1 ; for averaging 587 analog_counter res 1 ; for averaging
572 analog_sw1 res 1 ; analog value for switch 1 588 analog_sw1 res 1 ; analog value for switch 1
573 analog_sw2 res 1 ; analog value for switch 2 589 analog_sw2 res 1 ; analog value for switch 2
574 battery_type res 1 ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah 590 battery_type res 1 ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
575 uptime res 4 ; Uptime [s] 591 uptime res 4 ; Uptime [s]
576 lastdive_time res 4 ; Time since last dive [s] 592 lastdive_time res 4 ; Time since last dive [s]
577 lastdive_duration res 3 ; mins:2 and secs 593 lastdive_duration res 3 ; mins:2 and secs
578 lastdive_maxdepth res 2 ; in mbar 594 lastdive_maxdepth res 2 ; in mbar
579 battery_acumulated_charge res 2 ; Raw values in battery gauge IC 595 battery_acumulated_charge res 2 ; Raw values in battery gauge IC
580 gauge_status_byte res 1 ; Gauge IC status byte 596 gauge_status_byte res 1 ; Gauge IC status byte
581 button_polarity res 1 ; 0xFF (Both normal), 0x00 (Both inverted), 0x01 (Left inverted only), 0x02 (Right inverted only) 597 button_polarity res 1 ; 0xFF (Both normal), 0x00 (Both inverted), 0x01 (Left inverted only), 0x02 (Right inverted only)
582 gaslist_gas_global res 1 ; for color coding the gas lists 598 gaslist_gas_global res 1 ; for color coding the gas lists
583 active_gas_type res 1 ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents 599 ;active_gas_type res 1 ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
600 rx_buffer res .48 ; Buffer for RX data (Slots 0-7)
601 rx_firmware res 2 ; The RX firmware version xx.yy
602
603 gas6_O2_ratio res 1 ; gas6 O2 ratio
604 gas6_He_ratio res 1 ; gas6 He ratio
605 gas6_temp res 1 ; temp used in divemenu_tree.asm
606
584 607
585 ;----------------------------------------------------------------------------- 608 ;-----------------------------------------------------------------------------
586 ; Reserve BANK2 for general purpose buffer (strings, images, etc). 609 ; Reserve BANK2 for general purpose buffer (strings, images, etc).
587 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0). 610 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0).
588 buffer udata_ovr 0x200 611 buffer udata_ovr 0x200
597 opt_gas_He_ratio res 5 ; He ratio Gas1-5 620 opt_gas_He_ratio res 5 ; He ratio Gas1-5
598 opt_dil_He_ratio res 5 ; Must be in line with opt_gas_He_ratio 621 opt_dil_He_ratio res 5 ; Must be in line with opt_gas_He_ratio
599 opt_gas_type res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco 622 opt_gas_type res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco
600 opt_dil_type res 5 ; 0=Disabled, 1=First, 2=Normal -> ; Must be in line with opt_gas_type 623 opt_dil_type res 5 ; 0=Disabled, 1=First, 2=Normal -> ; Must be in line with opt_gas_type
601 opt_dive_mode res 1 ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR 624 opt_dive_mode res 1 ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR
602 opt_ppO2_max res 1 ; PPO2 Max for MOD calculation and color coding in divemode
603 opt_ccr_mode res 1 ; =0: Fixed SP, =1: Sensor 625 opt_ccr_mode res 1 ; =0: Fixed SP, =1: Sensor
604 opt_ppO2_min res 1 ; PPO2 min for Sensors and color coding in divemode
605 opt_OC_bail_gas_change res 5 ; Gas change depths OC/Bailout 626 opt_OC_bail_gas_change res 5 ; Gas change depths OC/Bailout
627
606 ;---- Managing Settings 628 ;---- Managing Settings
607
608 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full 629 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full
609 opt_salinity res 1 ; 0-5% 630 opt_salinity res 1 ; 0-5%
610 #DEFINE opt_name_length .60 ; Custom text string 5 rows with 12 chars 631 #DEFINE opt_name_length .60 ; Custom text string 5 rows with 12 chars
611 opt_name res opt_name_length 632 opt_name res opt_name_length
612 opt_language res 1 ; Current language. 0=EN, 1=DE, 2=FR, 3=SP 633 opt_language res 1 ; Current language. 0=EN, 1=DE, 2=FR, 3=SP
625 opt_enable_safetystop res 1 ; =1: A safety stop is shown 646 opt_enable_safetystop res 1 ; =1: A safety stop is shown
626 opt_calibration_O2_ratio res 1 ; %O2 of calibration gas 647 opt_calibration_O2_ratio res 1 ; %O2 of calibration gas
627 opt_x_s1 res 2 ; calibration factor (Not stored in EEPROM) 648 opt_x_s1 res 2 ; calibration factor (Not stored in EEPROM)
628 opt_x_s2 res 2 ; calibration factor (Not stored in EEPROM) 649 opt_x_s2 res 2 ; calibration factor (Not stored in EEPROM)
629 opt_x_s3 res 2 ; calibration factor (Not stored in EEPROM) 650 opt_x_s3 res 2 ; calibration factor (Not stored in EEPROM)
630 opt_sensor_fallback res 1 ; =1: Fallback to SP1 when sensor is lost 651 opt_sensor_fallback res 1 ; NOT USED ANY MORE, KEPT FOR COMPATIBILITY WITH EEPROM IMAGE
631 opt_flip_screen res 1 ; =1: Flip the screen 652 opt_flip_screen res 1 ; =1: Flip the screen
632 opt_cR_button_left res 1 ; Left button sensitivity (cR hardware) 653 opt_cR_button_left res 1 ; Left button sensitivity (cR hardware)
633 opt_cR_button_right res 1 ; Right button sensitivity (cR hardware) 654 opt_cR_button_right res 1 ; Right button sensitivity (cR hardware)
634 opt_modwarning res 1 ; =1:do a red blinking warning, =0:default behaviour 655 opt_modwarning res 1 ; =1:do a red blinking warning, =0:default behaviour
635 opt_vsitextv2 res 1 ; =1:use the depth dependent ascend rate limits 656 opt_vsitextv2 res 1 ; =1:use the depth dependent ascend rate limits
638 opt_temperature_adjust res 1 ; SIGNED int (two's complement), -2.0/+2.0 °C max. 659 opt_temperature_adjust res 1 ; SIGNED int (two's complement), -2.0/+2.0 °C max.
639 opt_safety_stop_length res 1 ; [s] 660 opt_safety_stop_length res 1 ; [s]
640 opt_safety_stop_start res 1 ; [cbar] 661 opt_safety_stop_start res 1 ; [cbar]
641 opt_safety_stop_end res 1 ; [cbar] 662 opt_safety_stop_end res 1 ; [cbar]
642 opt_safety_stop_reset res 1 ; [cbar] 663 opt_safety_stop_reset res 1 ; [cbar]
643 opt_diveTimeout res 1 ; Timeout for Divemode [min] 664 opt_diveTimeout res 1 ; Timeout for Divemode [min]
644 opt_PSCR_drop res 1 ; PSCR Drop [%] 665 opt_sim_setpoint_number res 1 ; NEW setpoint to use for deco calculation
645 opt_PSCR_lungratio res 1 ; PSCR Lung Ratio [1/x] 666 opt_calc_asc_gasvolume res 1 ; NEW calculate OC gas volume needs for ascent
646 opt_ppO2_max_deco res 1 ; PPO2 Max Decogases (for MOD calculation and color coding in divemode) 667 opt_sim_use_aGF res 1 ; NEW use GF (no) or aGF (yes) for deco calculation
668 opt_enable_IBCD res 1 ; NEW enable IBCD warning
647 669
648 ;-----------------------------EEPROM DATA ------------------------------------ 670 ;-----------------------------EEPROM DATA ------------------------------------
649 ; Automatic reset of all options when this is changed: 671 ; Automatic reset of all options when this is changed:
650 #define eeprom_opt_serial 0x0005 ; Version 0.5 672 #define eeprom_opt_serial 0x0006 ; Version 0.6
651 673
652 ;----------------------------------------------------------------------------- 674 ;-----------------------------------------------------------------------------
653 ; Flags 675 ; Flags
654 #DEFINE switch_left flag1,0 676 #DEFINE switch_left flag1,0
655 #DEFINE switch_right flag1,1 677 #DEFINE switch_right flag1,1
656 #DEFINE neg_flag flag1,2 ; e.g. sub16 (sub_c = sub_a - sub_b) 678 #DEFINE neg_flag flag1,2 ; e.g. sub16 (sub_c = sub_a - sub_b)
657 #DEFINE pressure_refresh flag1,3 ; =1: A new pressure/temperature is available 679 #DEFINE pressure_refresh flag1,3 ; =1: A new pressure/temperature is available
658 #DEFINE sleepmode flag1,4 ; =1: In Sleepmode 680 #DEFINE sleepmode flag1,4 ; =1: In Sleepmode
659 #DEFINE tft_is_dimming flag1,5 ; =1: The TFT is dimming, ignore light sensor 681 #DEFINE tft_is_dimming flag1,5 ; =1: The TFT is dimming, ignore light sensor
660 #DEFINE display_velocity flag1,6 ; =1: show velocity 682 #DEFINE display_velocity flag1,6 ; =1: show velocity
661 #DEFINE no_sensor_int flag1,7 ; =1: block any further access to pressure sensor 683 #DEFINE no_sensor_int flag1,7 ; =1: block any further access to pressure sensor
664 #DEFINE stored_gas_changed flag2,1 ; =1: Stored Gas changed 686 #DEFINE stored_gas_changed flag2,1 ; =1: Stored Gas changed
665 #DEFINE high_altitude_mode flag2,2 ; =1: Unit was manually turned on with ambient pressure <880mbar 687 #DEFINE high_altitude_mode flag2,2 ; =1: Unit was manually turned on with ambient pressure <880mbar
666 #DEFINE FLAG_apnoe_mode flag2,3 ; =1: Apnoe mode selected 688 #DEFINE FLAG_apnoe_mode flag2,3 ; =1: Apnoe mode selected
667 #DEFINE restore_deco_data flag2,4 ; =1: Restore deco data (After simulation) 689 #DEFINE restore_deco_data flag2,4 ; =1: Restore deco data (After simulation)
668 #DEFINE premenu flag2,5 ; =1: Premenu/Divemenu selected 690 #DEFINE premenu flag2,5 ; =1: Premenu/Divemenu selected
669 #DEFINE menubit flag2,6 ; menu 691 #DEFINE menubit flag2,6 ; menu
670 #DEFINE simulatormode_active flag2,7 ; =1: Simulator mode active, override pressure sensor readings 692 #DEFINE simulatormode_active flag2,7 ; =1: Simulator mode active, override pressure sensor readings
671 693
672 #DEFINE divemode_menu flag3,0 ; =1: Divemode menu is shown 694 #DEFINE divemode_menu flag3,0 ; =1: Divemode menu is shown
673 #DEFINE onesecupdate flag3,1 ; =1 after any second 695 #DEFINE onesecupdate flag3,1 ; =1: after any second
674 #DEFINE twosecupdate flag3,2 ; =1: New two-second update 696 #DEFINE twosecupdate flag3,2 ; =1: New two-second update
675 #DEFINE toggle_customview flag3,3 ; =1: Next customview 697 #DEFINE toggle_customview flag3,3 ; =1: Next customview
676 #DEFINE oneminupdate flag3,4 ; =1 after any minute 698 #DEFINE oneminupdate flag3,4 ; =1: after any minute
677 #DEFINE divemode flag3,5 ; =1: in Divemode 699 #DEFINE divemode flag3,5 ; =1: in Divemode
678 #DEFINE battery_is_36v flag3,6 ; =1: 3,6V Battery is in use 700 #DEFINE battery_is_36v flag3,6 ; =1: 3,6V Battery is in use
679 #DEFINE warning_active flag3,7 ; =1: A warning is active in divemode or surfacemode 701 #DEFINE warning_active flag3,7 ; =1: A warning is active in divemode or surfacemode
680 702
681 #DEFINE better_gas_available flag4,0 ; =1: A better gas is available 703 #DEFINE better_gas_available flag4,0 ; =1: A better gas is available
689 711
690 #DEFINE dive_warning_displayed flag5,0 ; =1: The warning sign is shown 712 #DEFINE dive_warning_displayed flag5,0 ; =1: The warning sign is shown
691 #DEFINE reset_average_depth flag5,1 ; =1: Reset the average depth 713 #DEFINE reset_average_depth flag5,1 ; =1: Reset the average depth
692 #DEFINE store_sample flag5,2 ; =1: Store a new sample 714 #DEFINE store_sample flag5,2 ; =1: Store a new sample
693 #DEFINE divemode2 flag5,3 ; =1: Dive longer then one minute 715 #DEFINE divemode2 flag5,3 ; =1: Dive longer then one minute
694 #DEFINE FLAG_active_descent flag5,4 ; Used in Apnoe mode 716 #DEFINE FLAG_active_descent flag5,4 ; Used in Apnoe mode
695 #DEFINE event_occured flag5,5 ; =1: An event occured, store it! 717 #DEFINE event_occured flag5,5 ; =1: An event occured, store it!
696 #DEFINE divemode_menu_active flag5,6 ; =1: The divemode menu is shown 718 #DEFINE divemode_menu_active flag5,6 ; =1: The divemode menu is shown
697 #DEFINE temp_changed flag5,7 ; =1: The temperature changed 719 #DEFINE temp_changed flag5,7 ; =1: The temperature changed
698 720
699 #DEFINE gas6_changed flag6,0 ; =1: Gas 6 has been selected/changed underwater 721 #DEFINE gas6_changed flag6,0 ; =1: Gas 6 has been selected/changed underwater
706 #DEFINE dive_hud2_displayed flag6,7 ; =1: The Sensor2 HUD reading is displayed 728 #DEFINE dive_hud2_displayed flag6,7 ; =1: The Sensor2 HUD reading is displayed
707 729
708 #DEFINE dive_hud3_displayed flag7,0 ; =1: The Sensor3 HUD reading is displayed 730 #DEFINE dive_hud3_displayed flag7,0 ; =1: The Sensor3 HUD reading is displayed
709 #DEFINE no_more_divesecs flag7,1 ; =1: Do no longer show seconds in divemode 731 #DEFINE no_more_divesecs flag7,1 ; =1: Do no longer show seconds in divemode
710 #DEFINE FLAG_gauge_mode flag7,2 ; =1: In Gauge mode 732 #DEFINE FLAG_gauge_mode flag7,2 ; =1: In Gauge mode
711 #DEFINE ignore_last_edited_gas flag7,3 ; Used in gaslist_cleanup_list 733 #DEFINE ignore_last_edited_gas flag7,3 ; Used in gaslist_cleanup_list
712 #DEFINE ccr_diluent_setup flag7,4 ; =1: Setting up Diluents ("Gas6-10") 734 #DEFINE ccr_diluent_setup flag7,4 ; =1: Setting up Diluents ("Gas6-10")
713 #DEFINE menu_show_sensors flag7,5 ; =1: Update HUD data in menu 735 #DEFINE menu_show_sensors flag7,5 ; =1: Update HUD data in menu ## NOT USED ANYMORE ##
714 #DEFINE short_gas_decriptions flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 736 #DEFINE short_gas_decriptions flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
715 #DEFINE max_depth_greater_100m flag7,7 ; =1: Max. Depth > 100m 737 #DEFINE max_depth_greater_100m flag7,7 ; =1: Max. Depth > 100m
716 738
717 #DEFINE is_bailout flag8,0 ; =1: Bailout 739 #DEFINE is_bailout flag8,0 ; =1: Bailout
718 #DEFINE is_bailout_menu flag8,1 ; =1: Bailout 740 #DEFINE is_bailout_menu flag8,1 ; =1: Bailout
725 747
726 #DEFINE compass_fast_mode flag9,0 ; =1: The compass is in fast mode 748 #DEFINE compass_fast_mode flag9,0 ; =1: The compass is in fast mode
727 #DEFINE in_color_menu flag9,1 ; =1: In the color scheme menu 749 #DEFINE in_color_menu flag9,1 ; =1: In the color scheme menu
728 #DEFINE bailoutgas_event flag9,2 ; =1: bailout was selected or a gaschange during bailout 750 #DEFINE bailoutgas_event flag9,2 ; =1: bailout was selected or a gaschange during bailout
729 #DEFINE win_invert flag9,3 ; =1: Invert font output 751 #DEFINE win_invert flag9,3 ; =1: Invert font output
730 #DEFINE show_safety_stop flag9,4 ; =1: Show the safety stop 752 #DEFINE show_safety_stop flag9,4 ; =1: Show the safety stop
731 #DEFINE safety_stop_active flag9,5 ; =1: The safety stop is currently displayed 753 #DEFINE safety_stop_active flag9,5 ; =1: The safety stop is currently displayed
732 #DEFINE new_s8_data_available flag9,6 ; =1: New data frame recieved 754 #DEFINE new_s8_data_available flag9,6 ; =1: New data frame recieved
733 #DEFINE print_compass_label flag9,7 ; =1: print the graphical comapss label 755 #DEFINE print_compass_label flag9,7 ; =1: print the graphical comapss label
734 756
735 #DEFINE s8_digital flag10,0; =1: Digital I/O 757 #DEFINE s8_digital flag10,0; =1: Digital I/O
758 #DEFINE blinking_depth_warning flag12,5 ; set by the color_depth. =1: warning color 780 #DEFINE blinking_depth_warning flag12,5 ; set by the color_depth. =1: warning color
759 #DEFINE blinking_depth_prev flag12,6 ; set by the TFT_depth. =1: prev display had warning color 781 #DEFINE blinking_depth_prev flag12,6 ; set by the TFT_depth. =1: prev display had warning color
760 #DEFINE blinking_depth_toggle flag12,7 ; toggle to blink 782 #DEFINE blinking_depth_toggle flag12,7 ; toggle to blink
761 783
762 #DEFINE neg_flag_velocity flag13,0 ; neg_flag backup for velocity logic 784 #DEFINE neg_flag_velocity flag13,0 ; neg_flag backup for velocity logic
763 #DEFINE analog_sw1_pressed flag13,1 ; =1: Analog switch 1 pressed 785 #DEFINE analog_sw1_pressed flag13,1 ; =1: Analog switch 1 pressed
764 #DEFINE analog_sw2_pressed flag13,2 ; =1: Analog switch 2 pressed 786 #DEFINE analog_sw2_pressed flag13,2 ; =1: Analog switch 2 pressed
765 #DEFINE sp2_switched flag13,3 ; =1: This setpoint has been autoselected already 787 #DEFINE sp2_switched flag13,3 ; =1: This setpoint has been autoselected already
766 #DEFINE sp3_switched flag13,4 ; =1: This setpoint has been autoselected already 788 #DEFINE sp3_switched flag13,4 ; =1: This setpoint has been autoselected already
767 #DEFINE sp4_switched flag13,5 ; =1: This setpoint has been autoselected already 789 #DEFINE sp4_switched flag13,5 ; =1: This setpoint has been autoselected already
768 #DEFINE sp5_switched flag13,6 ; =1: This setpoint has been autoselected already 790 #DEFINE sp5_switched flag13,6 ; =1: This setpoint has been autoselected already
769 #DEFINE use_old_batt_flag flag13,7 ; =1: load old battery information after power-on reset 791 #DEFINE use_old_batt_flag flag13,7 ; =1: load old battery information after power-on reset
770 792
771 #DEFINE FLAG_pscr_mode flag14,0 ; =1: OSTC is in PSCR mode 793 #DEFINE FLAG_pscr_mode flag14,0 ; =1: OSTC is in PSCR mode
772 #DEFINE deep_sleep flag14,1 ; OSTC is in deep sleep (ignore buttons, etc) 794 #DEFINE deep_sleep flag14,1 ; OSTC is in deep sleep (ignore buttons, etc)
795 #DEFINE sensors_agree flag14,2 ; =1: the ppO2 of all sensors are within the threshold range
796 #DEFINE gas_needs_attention flag14,3 ; =1: the gas needs attention has been raised before
797 #DEFINE gas_needs_warning flag14,4 ; =1: the gas needs warning has been raised before
798 #DEFINE sensor_warning flag14,5 ; =1: the sensors disagree warning has been raised before
799 #DEFINE alternative_divelayout flag14,6 ; =1: the alternative divelayout is used (aka Blind Mode)
800 #DEFINE i2c_error_flag flag14,7 ; =1: An I2C error occured
801
802
803 ; Update flags in divemode, =1: Update the screen
804 #DEFINE FLAG_TFT_divemode_mask tft_update_flags+0,0
805 #DEFINE FLAG_TFT_display_ndl_mask tft_update_flags+0,1
806 #DEFINE FLAG_TFT_depth tft_update_flags+0,2
807 #DEFINE FLAG_TFT_divemins tft_update_flags+0,3
808 #DEFINE FLAG_TFT_show_safety_stop tft_update_flags+0,4
809 #DEFINE FLAG_TFT_display_ndl tft_update_flags+0,5
810 #DEFINE FLAG_TFT_display_deko_mask tft_update_flags+0,6
811 #DEFINE FLAG_TFT_display_deko tft_update_flags+0,7
812 #DEFINE FLAG_TFT_display_tts tft_update_flags+1,0
813 #DEFINE FLAG_TFT_temp_divemode tft_update_flags+1,1
814 #DEFINE FLAG_TFT_divemode_warning tft_update_flags+1,2
815 #DEFINE FLAG_TFT_divemode_warning_clear tft_update_flags+1,3
816 #DEFINE FLAG_TFT_active_gas_divemode tft_update_flags+1,4
817 #DEFINE FLAG_TFT_clear_safety_stop tft_update_flags+1,5
818 #DEFINE FLAG_TFT_max_depth tft_update_flags+1,6
819 #DEFINE FLAG_TFT_divemode_mask_alt tft_update_flags+1,7
820 #DEFINE FLAG_TFT_dive_warning_text_clear tft_update_flags+2,0
821 #DEFINE FLAG_TFT_dive_warning_text_clr2 tft_update_flags+2,1
822 #DEFINE FLAG_TFT_max_depth_alt tft_update_flags+2,2
823 #DEFINE FLAG_TFT_big_deco_alt tft_update_flags+2,3
824 #define FLAG_TFT_not_defined_yet tft_update_flags+2,7 ; last usable flag within tft_update_flags memory space
825
826
827 ; Bit Masks for communication with p2_deco.c
828 #define DECO_STATUS_MASK .3
829
830 ; Bit Flags for communication with p2_deco.c - char_O_deco_status
831 #define DECO_STATUS_0_FLAG .0
832 #define DECO_STATUS_1_FLAG .1
833 #define DECO_MODE_LOOP_FLAG .2
834 #define DECO_MODE_PSCR_FLAG .3
835 #define DECO_PLAN_FLAG .4
836 #define DECO_CNS_FLAG .5
837 #define DECO_VOLUME_FLAG .6
838 #define DECO_ASCENT_FLAG .7
839
840 ; Bit Flags for communication with p2_deco.c - char_O_main_status
841 ;#define DECO_MODE_LOOP_FLAG .2
842 ;#define DECO_MODE_PSCR_FLAG .3
843 #define DECO_GASCHANGE_OVRD .4
844 #define DECO_BOTTOM_FLAG .6
845
846 ; Bit Values for communication with p2_deco.c
847 #define DECO_STATUS_INIT .3
848 #define DECO_MODE_LOOP .4
849 #define DECO_MODE_PSCR .8
850 #define DECO_PLAN_ALTERNATE .16
851 #define DECO_CNS_CALCULATE .32
852 #define DECO_VOLUME_CALCULATE .64
853 #define DECO_ASCENT_DELAYED .128
854
855 ; Bit Flags for char_O_deco_warnings
856 #define IBCD_warning .0
857 #define IBCD_warning_lock .1
858 #define mbubble_warning .2
859 #define mbubble_warning_lock .3
860 #define outside_warning .4
861 #define outside_warning_lock .5
862 #define stoptable_overflow .6
863 #define deco_flag .7
864
865 #define char_invalid_flag .7
866
867 #define int_invalid_flag .2
868 #define int_not_yet_computed .3
869 #define int_is_zero .3
870 #define int_low_flag .4
871 #define int_high_flag .5
872 #define int_prewarning_flag .6
873 #define int_warning_flag .7
874
875
876
773 ;============================================================================= 877 ;=============================================================================
774 ; C-code Routines 878 ; C-code Routines
775 ; PART 2 879 ; PART 2
776 extern deco_calc_CNS_decrease_15min 880 extern deco_calc_CNS_decrease_15min
777 extern deco_calc_CNS_fraction
778 extern deco_calc_desaturation_time 881 extern deco_calc_desaturation_time
779 extern deco_calc_hauptroutine 882 extern deco_calc_hauptroutine
780 extern deco_calc_tissue
781 extern deco_calc_percentage
782 extern deco_calc_wo_deco_step_1_min 883 extern deco_calc_wo_deco_step_1_min
783 extern deco_calc_dive_interval 884 extern deco_calc_dive_interval
784 extern deco_clear_CNS_fraction
785 extern deco_clear_tissue 885 extern deco_clear_tissue
786 extern deco_pull_tissues_from_vault 886 extern deco_pull_tissues_from_vault
787 extern deco_push_tissues_to_vault 887 extern deco_push_tissues_to_vault
788 888