0
|
1 ;=============================================================================
|
|
2 ;
|
|
3 ; File ostc3.asm
|
|
4 ;
|
|
5 ; OSTC3 Platform definitions
|
|
6 ;
|
|
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code.
|
|
11
|
|
12 ;=============================================================================
|
|
13
|
|
14 LIST P=18F87K22 ; change also: Configure->SelectDevice from Mplab
|
|
15
|
|
16 ;#DEFINE __DEBUG
|
|
17
|
|
18 #include <p18f87k22.inc>
|
|
19 #include <ports.inc> ; Portmap
|
|
20
|
|
21 #DEFINE softwareversion_x d'0' ; Software version XX.YY
|
|
22 #DEFINE softwareversion_y d'90' ; Software version XX.YY
|
|
23 #DEFINE softwareversion_beta 0 ; (and 0 for release)
|
|
24
|
|
25 #DEFINE comm_service_key 0xABCDEF
|
|
26
|
|
27 ;-----------------------------------------------------------------------------
|
|
28
|
|
29 #DEFINE CCP1CON_VALUE b'00001100' ; PWM1 for LED dimming
|
|
30 #DEFINE T2CON_ECO b'00000100' ; 1:1 Postscaler, 1:1 Prescaler, Timer 2 start -> 980Hz (Good compromise of no-flicker and efficiency)
|
|
31 #DEFINE T2CON_NORMAL b'00001110'
|
|
32 #DEFINE T2CON_FASTEST b'00001110' ; 1:2 Postscaler, 1:16 Prescaler, Timer 2 start -> 1960Hz (no-flicker)
|
|
33
|
|
34 ; Timing for button hold-down flags
|
|
35 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7,8125ms -> 1s
|
|
36 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7,8125ms -> 0.25s
|
|
37 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7,8125ms -> 0.5s
|
|
38
|
|
39 ; Color Definitions: 8Bit RGB b'RRRGGGBB'
|
|
40 #DEFINE color_red b'11100000' ; (7,0,0)
|
|
41 #DEFINE color_dark_red b'10000101' ; (4,1,1)
|
|
42 #DEFINE color_violet b'11101011' ; (7,2,3)
|
|
43 #DEFINE color_blue b'11000111' ; (6,1,3)
|
|
44 #DEFINE color_green b'00011100' ; (0,7,0)
|
|
45 #DEFINE color_greenish b'00111110' ; (1,7,2)
|
|
46 #DEFINE color_dark_green b'00111001' ; (1,6,1)
|
|
47 #DEFINE color_yellow b'11111101' ; (7,7,1)
|
|
48 #DEFINE color_white b'11111111' ; (7,7,3)
|
|
49 #DEFINE color_black b'00000000' ; (0,0,0)
|
|
50 #DEFINE color_deepblue b'00000010' ; (0,0,2)
|
|
51 #DEFINE color_grey b'11011111' ; (6,7,3)
|
|
52 #DEFINE color_cyan b'11011111' ; (6,7,3)
|
|
53 #DEFINE color_lightblue b'11011011' ; (6,7,3)
|
|
54 #DEFINE color_orange b'11111000' ; (7,6,0)
|
|
55 #DEFINE color_pink b'11111010' ; (7,6,2)
|
|
56
|
|
57 #DEFINE FT_TINY .0
|
|
58 #DEFINE FT_SMALL .1
|
|
59 #DEFINE FT_MEDIUM .2
|
|
60 #DEFINE FT_LARGE .3
|
|
61
|
|
62 #DEFINE warn_depth .1
|
|
63 #DEFINE warn_cns .2
|
|
64 #DEFINE warn_gf .3
|
|
65 #DEFINE warn_ppo2 .4
|
|
66 #DEFINE warn_velocity .5
|
|
67 #DEFINE warn_ceiling .6
|
|
68 #DEFINE warn_gas_in_gaslist .7
|
|
69 #DEFINE warn_ppo2_hud .8
|
|
70 #DEFINE warn_battery .9
|
|
71
|
|
72
|
|
73 ; Profile recording parameters
|
|
74 #DEFINE logbook_profile_version 0x23
|
|
75 #DEFINE samplingrate .10 ; [seconds]
|
|
76 #DEFINE samplingrate_apnoe .1 ; [seconds]
|
|
77 ; Warning: Divisors must be <.16 !
|
|
78 #DEFINE div_temperature .6 ; x samplingrate [s]
|
|
79 #DEFINE div_deco .6 ; x samplingrate [s]
|
|
80 #DEFINE div_gf .12 ; x samplingrate [s]
|
|
81 #DEFINE div_ppo2_sensors .2 ; x samplingrate [s]
|
|
82 #DEFINE div_decoplan .12 ; x samplingrate [s]
|
|
83 #DEFINE div_cns .12 ; x samplingrate [s]
|
|
84 #DEFINE div_tank .0 ; x samplingrate [s]
|
|
85 ; Warning: Information lengths must be <.16 !
|
|
86 #DEFINE infolength_temperature .2 ; [byte]
|
|
87 #DEFINE infolength_deco .2 ; [byte]
|
|
88 #DEFINE infolength_gf .1 ; [byte]
|
|
89 #DEFINE infolength_ppo2_sensors .9 ; [byte]
|
|
90 #DEFINE infolength_decoplan .15 ; [byte]
|
|
91 #DEFINE infolength_cns .2 ; [byte]
|
|
92 #DEFINE infolength_tank .0 ; [byte]
|
|
93
|
|
94 ; "Better Gas" behavior
|
|
95 ; better_gas_window <= minimum_change_depth !
|
|
96 ; minimum_change_depth >=5 !
|
|
97 #DEFINE minimum_change_depth .3 ; [m]
|
|
98 #DEFINE better_gas_window .3 ; [m]
|
|
99
|
|
100 ; Dive mode limits and thresholds
|
|
101 #DEFINE start_dive_threshold .100 ; [cm]
|
|
102 #DEFINE high_altitude_dive_threshold .300;[cm]
|
|
103 #DEFINE apnoe_timeout .30 ; [min]
|
|
104 #DEFINE divemode_menuview_timeout .10 ; [s]
|
|
105 #DEFINE divemode_timeout .300 ; [s]
|
|
106 #DEFINE divemode_menu_timeout .30 ; [s]
|
|
107 #DEFINE ppo2_warning_low .19 ; [cbar] (Default value)
|
|
108 #DEFINE ppo2_lowest_setting .16 ; [cbar] (Minimum value)
|
|
109 #DEFINE ppo2_display_high .120 ; [cbar]
|
|
110 #DEFINE ppo2_warning_high .160 ; [cbar] (Default value)
|
|
111 #DEFINE ppo2_highest_setting .160 ; [cbar] (Max. Value)
|
|
112 #DEFINE cns_display_high .70 ; [%]
|
|
113 #DEFINE cns_warning_high .100 ; [%]
|
|
114 #DEFINE gf_display_high .75 ; [%]
|
|
115 #DEFINE gf_warning_high .100 ; [%]
|
|
116 #DEFINE depth_warn_mbar .13000 ; [mbar]
|
|
117 #DEFINE wake_up_from_sleep .1160 ; [mbar]
|
|
118 #DEFINE gf_display_threshold .20 ; [%]
|
|
119 #DEFINE simulator_start_depth .2500 ; [mbar] + 1000mbar surface
|
|
120 #DEFINE simulator_timeout .15 ; [s]
|
|
121
|
|
122
|
|
123 ; Surface mode limits and thresholds
|
|
124 #DEFINE cns_display_surface_high .70 ; [%]
|
|
125 #DEFINE high_altitude_threshold .880 ; [mbar]
|
|
126 #DEFINE max_surfpressure .1080 ; [mbar]
|
|
127 #DEFINE timeout_surfacemode .90 ; [s]
|
|
128
|
|
129
|
|
130 ; Decomodel paramters
|
|
131 #DEFINE no_fly_time_ratio .60 ; [%]
|
|
132 #DEFINE deco_distance .10 ; [dm]
|
|
133
|
|
134
|
|
135 ; Color-code parameters for the divemode
|
|
136 #DEFINE color_code_cns_high .100 ; [%]
|
|
137 #DEFINE color_code_gf_warn_high .101 ; [%]
|
|
138 #DEFINE color_code_velocity_warn_high .10;[m/min]
|
|
139
|
|
140 ; Velocity threshold
|
|
141 #DEFINE velocity_warning_level_1 .7 ; [m/min]
|
|
142
|
|
143 ; Battery thresholds
|
|
144 #DEFINE lithium_36v_empty .3050 ; [mV] Saft 3,6V LS14500 AA - threshold for battery percent display
|
|
145 #DEFINE lithium_36v_low .2000 ; [mV] (Must be bigger then aa_15v_high!)
|
|
146 #DEFINE aa_15v_high .1550 ; [mV] Energizer 1,5V E2 AA
|
|
147 #DEFINE aa_15v_low .1100 ; [mV] According to Energizer Datasheet EBC-4201R, Page 2
|
|
148 #DEFINE color_code_battery_low .15 ; [%]
|
|
149 #DEFINE battery_show_level .30 ; [%]
|
|
150
|
|
151 #DEFINE current_sleepmode .62
|
|
152 #DEFINE current_backlight_multi .115 ; *CCPR1L+current_backlight_offset
|
|
153 #DEFINE current_backlight_offset .216
|
|
154 #DEFINE current_speed_eco .1914
|
|
155 #DEFINE current_speed_normal .4027
|
|
156 #DEFINE current_speed_fastest .5050
|
|
157 #DEFINE current_ir_reciever .139
|
|
158 #DEFINE current_compass .28
|
|
159
|
|
160 ; Brightness thresholds (between zero (off) and 255 (max. power))
|
|
161 #DEFINE ambient_light_max_high_36V .220 ; When used with a 3,6V battery
|
|
162 #DEFINE ambient_light_max_high .170
|
|
163 #DEFINE ambient_light_min_high .40
|
|
164 #DEFINE ambient_light_max_medium .155
|
|
165 #DEFINE ambient_light_min_medium .30
|
|
166 #DEFINE ambient_light_max_eco .120
|
|
167 #DEFINE ambient_light_min_eco .20
|
|
168
|
|
169 ; IR Link timeout
|
|
170 #DEFINE ir_timeout_value .48 ; multiples of 62,5ms
|
|
171
|
|
172 ; Gaslist hard-coded limits
|
|
173 #DEFINE gaslist_min_o2 .7 ; Minimum O2 [%]
|
|
174 #DEFINE gaslist_max_change_depth .100 ; Max. change depth [m]
|
|
175 #DEFINE gaslist_sp_stepsize .10 ; Steps for Setpoint Setup [cbar]
|
|
176 #DEFINE gaslist_sp_max .160 ; Max. Setpoint [cbar]
|
|
177 #DEFINE gaslist_sp_min .50 ; Min. Setpoint [cbar]
|
|
178
|
|
179 ;---------------------------- Macros ------------------------------------
|
|
180
|
|
181 TSTOSS macro opt_reg ; TeST Option Skip if not Zero
|
|
182 movff opt_reg,WREG
|
|
183 tstfsz WREG,A
|
|
184 bra $+4
|
|
185 endm
|
|
186
|
|
187 ;---------------------------- Bank0 DATA ------------------------------------
|
|
188 isr_backup equ 0x60
|
|
189 isr_backup udata_ovr isr_backup ; Reserved space for interupt data
|
|
190
|
|
191 ;---- Backup for general registers
|
|
192 isr_prod res 2
|
|
193
|
|
194 ;---- MS5541 subroutines
|
|
195 amb_pressure res 2
|
|
196 temperature res 2
|
|
197
|
|
198 W1 res 2 ; Raw (packed) calibration data
|
|
199 W2 res 2
|
|
200 W3 res 2
|
|
201 W4 res 2 ; 100
|
|
202 C1 res 2 ; Decoded calibration data
|
|
203 C2 res 2
|
|
204 C3 res 2
|
|
205 C4 res 2 ; Here: C4-250
|
|
206 C5 res 2 ; Here: Reference Temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
|
|
207 C6 res 2
|
|
208 D1 res 2 ; raw pressure
|
|
209 D2 res 2 ; raw temperature
|
|
210 xdT res 2
|
|
211 xdT2 res 2
|
|
212 OFF res 2
|
|
213 SENS res 2
|
|
214 dLSB res 1 ;Pressure sensor interface
|
|
215 dMSB res 1
|
|
216 clock_count res 1
|
|
217 sensor_state_counter res 1 ; counts to eight for state maschine
|
|
218 amb_pressure_avg res 2
|
|
219 temperature_avg res 2
|
|
220 minimum_temperature res 2 ; minimum temperature
|
|
221 last_temperature res 2
|
|
222 last_pressure res 2
|
|
223 last_pressure_velocity res 2 ; For velocity
|
|
224 last_surfpressure res 2
|
|
225 last_surfpressure_15min res 2
|
|
226 last_surfpressure_30min res 2
|
|
227 rel_pressure res 2
|
|
228 sim_pressure res 2 ; hold simulated pressure in mbar if in Simulator mode
|
|
229 max_pressure res 2
|
|
230 avr_rel_pressure res 2
|
|
231 avr_rel_pressure_total res 2
|
|
232 ;---- Data for ISR math subroutines
|
|
233 isr_xC res 4
|
|
234 isr_xA res 2
|
|
235 isr_xB res 2
|
|
236
|
|
237 ;---- Data for ISR routines
|
|
238 isr1_temp res 1 ; ISR temp variable, used in ms5541.asm, isr_rtcc, isr_battery_gauge
|
|
239 isr2_temp res 1 ; ISR temp variable, used isr_battery_gauge
|
|
240
|
|
241 ;---- Display brightness
|
|
242 max_CCPR1L res 1 ; Max. brightness value for CCPR1L
|
|
243
|
|
244 ; Battery gauge (nAs, nC)
|
|
245 battery_gauge res 6 ; 48Bit -> 78Ah max...
|
|
246
|
|
247 ; IR-Link
|
|
248 ir_buffer res .16
|
|
249 ir_counter res 1
|
|
250 ir_timeout res 1 ; Timeout for valid data
|
|
251
|
|
252 ; Compass raw data
|
|
253 compass_DX res 2
|
|
254 compass_DY res 2
|
|
255 compass_DZ res 2
|
|
256
|
|
257 accel_DX res 2
|
|
258 accel_DY res 2
|
|
259 accel_DZ res 2
|
|
260
|
|
261 ; Compass FILTERED data
|
|
262 compass_DX_f res 2
|
|
263 compass_DY_f res 2
|
|
264 compass_DZ_f res 2
|
|
265
|
|
266 accel_DX_f res 2
|
|
267 accel_DY_f res 2
|
|
268 accel_DZ_f res 2
|
|
269
|
|
270 ; Compass calibration data
|
|
271 compass_CX_f res 2
|
|
272 compass_CY_f res 2
|
|
273 compass_CZ_f res 2
|
|
274
|
|
275 ; Compass more data
|
|
276 compass_heading res 2 ; Corrected heading (in 1°) : -180 .. 180
|
|
277 compass_roll res 2 ; Rotation around the X axis
|
|
278 compass_pitch res 2 ; Rotation arounf the Y axis
|
|
279
|
|
280 compass_a res 2 ; Tmp data for Q15 arithmetics
|
|
281 compass_b res 2
|
|
282 compass_r res 3
|
|
283
|
|
284 CNS_start res 2 ; CNS value at beginning of dive
|
|
285 GF_start res 1 ; GF value at beginning of dive
|
|
286
|
|
287 ;---------------------------- Common DATA ------------------------------------
|
|
288
|
|
289 common equ 0x100 ; Alias for "banksel common"
|
|
290 common udata_ovr common ; Bank1 general variables
|
|
291
|
|
292 ;---- Time and Date
|
|
293 secs res 1
|
|
294 mins res 1
|
|
295 hours res 1
|
|
296 day res 1
|
|
297 month res 1
|
|
298 year res 1
|
|
299 surface_interval res 2
|
|
300
|
|
301 flag1 res 1
|
|
302 flag2 res 1
|
|
303 flag3 res 1
|
|
304 flag4 res 1
|
|
305 flag5 res 1
|
|
306 flag6 res 1
|
|
307 flag7 res 1
|
|
308 flag8 res 1
|
|
309
|
|
310 temp1 res 1
|
|
311 temp2 res 1
|
|
312
|
|
313 ;---- Interface to wait macros
|
|
314 wait_temp res 1
|
|
315 waitms_temp res 1
|
|
316
|
|
317 ;---- Interface to graphic subroutines (aa_wordprocessor, color_processor, ...)
|
|
318 win_leftx2 res 1
|
|
319 win_top res 1
|
|
320 win_width res 2
|
|
321 win_height res 1
|
|
322 win_bargraph res 1
|
|
323 win_color1 res 1
|
|
324 win_color2 res 1
|
|
325 win_font res 1
|
|
326 win_invert res 1
|
|
327
|
|
328 ;---- Draw subroutines
|
|
329 tft_temp4 res 1
|
|
330 tft_temp3 res 1
|
|
331 tft_temp2 res 1
|
|
332 tft_temp1 res 1
|
|
333
|
|
334 ;---- data conversion subroutines
|
|
335 lo res 1
|
|
336 hi res 1
|
|
337 up res 1
|
|
338
|
|
339 ;---- RS232 temp variables
|
|
340 uart1_temp res 1
|
|
341 uart2_temp res 1
|
|
342
|
|
343 ;---- Data for math subroutines
|
|
344 divA res 2
|
|
345 divB res 1
|
|
346 xC res 4
|
|
347 xA res 2
|
|
348 xB res 2
|
|
349 sub_c res 2
|
|
350 sub_a res 2
|
|
351 sub_b res 2
|
|
352
|
|
353 ;---- Data for conversion subroutines
|
|
354 cvt_flags res 1
|
|
355 ignore_digits res 1
|
|
356
|
|
357 #define leftbind cvt_flags,0
|
|
358 #define ignore_digit3 cvt_flags,1
|
|
359 #define ignore_digit4 cvt_flags,2
|
|
360 #define ignore_digit5 cvt_flags,3
|
|
361 #DEFINE enable_screen_dumps cvt_flags,4 ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
|
|
362
|
|
363 ;---- Misc.
|
|
364 speed_setting res 1 ; =1: Eco, =2: Normal, =3: Fastest
|
|
365 nofly_time res 2 ; No Fly time in Minutes (Calculated after Dive)
|
|
366 timeout_counter res 1
|
|
367 timeout_counter2 res 1
|
|
368 timeout_counter3 res 1
|
|
369 batt_voltage res 2 ; Battery voltage in mV
|
|
370 batt_percent res 1 ; Battery in percent (1-100)
|
|
371 ambient_light res 2 ; ambient_light level
|
|
372 lo_temp res 1
|
|
373 hi_temp res 1
|
|
374 desaturation_time res 2
|
|
375 convert_value_temp res 3 ; used in menu_battery_state_convert_date
|
|
376 active_gas res 1
|
|
377 decoplan_page res 1
|
|
378 warning_counter res 1 ; Counts amount of warning in divemode
|
|
379 warning_counter_backup res 1 ; Backup of warning_counter
|
|
380 warning_page res 1 ; current # of warning page
|
|
381 rssi_value res 1 ; Current RSSI level
|
|
382
|
|
383 ; Remind history for menu processor (and such):
|
|
384 menustack res 5 ; menu stack
|
|
385 menupos res 1 ; Logbook and divemode menu
|
|
386 menupos2 res 1 ; For dive mode simulator and pre-menu
|
|
387 menupos3 res 1 ; For Customviews
|
|
388 menupos4 res 1 ; For divemode menu
|
|
389
|
|
390 ; Apnoe stuff that must be in bank common
|
|
391 apnoe_mins res 1
|
|
392 apnoe_secs res 1
|
|
393 apnoe_max_pressure res 2
|
|
394
|
|
395 ; Divemode
|
|
396 divemins res 2
|
|
397 divesecs res 1
|
|
398 samplesecs_value res 1
|
|
399 divisor_temperature res 1
|
|
400 divisor_deco res 1
|
|
401 divisor_gf res 1
|
|
402 divisor_ppo2_sensors res 1
|
|
403 divisor_decoplan res 1
|
|
404 divisor_cns res 1
|
|
405 divisor_tank res 1
|
|
406 average_depth_hold res 4
|
|
407 average_depth_hold_total res 4
|
|
408 total_divetime_seconds res 2
|
|
409 average_divesecs res 2 ; For the resettable stopwatch
|
|
410 decodata res 2
|
|
411 apnoe_timeout_counter res 1
|
|
412 apnoe_surface_mins res 1
|
|
413 apnoe_surface_secs res 1
|
|
414
|
|
415
|
|
416 ; Profile storing
|
|
417 AlarmType res 1
|
|
418 samplesecs res 1
|
|
419 EventByte res 1
|
|
420 ProfileFlagByte res 1
|
|
421
|
|
422 ; External flash
|
|
423 ext_flash_address res 3 ; 24bit Address
|
|
424 ext_flash_log_pointer res 3 ; 24bit Address for logbook profile storing
|
|
425 ext_flash_dive_counter res 3 ; 24bit Counter for dive length (increased in write_byte_ext_flash_plus)
|
|
426
|
|
427 ; I2C
|
|
428 i2c_temp res 1 ; Temp
|
|
429
|
|
430 ; MCP
|
|
431 mcp_temp res 4 ; For RX
|
|
432
|
|
433 ; O2 Sensor data
|
|
434 o2_mv_sensor1 res 2 ; in 0.1mV steps
|
|
435 o2_mv_sensor2 res 2 ; in 0.1mV steps
|
|
436 o2_mv_sensor3 res 2 ; in 0.1mV steps
|
|
437 o2_ppo2_sensor1 res 1 ; Sensor1 ppO2 (in 0.01bar steps)
|
|
438 o2_ppo2_sensor2 res 1 ; Sensor2 ppO2 (in 0.01bar steps)
|
|
439 o2_ppo2_sensor3 res 1 ; Sensor3 ppO2 (in 0.01bar steps)
|
|
440 hud_battery_mv res 2
|
|
441 hud_status_byte res 1
|
|
442 ;Status Byte/
|
|
443 ;Bit0 = 1 -> HUD connection ok
|
|
444 ;Bit1 = 1 -> HUD is calibrated
|
|
445 ;Bit2 = 1 -> HUD Battery is low (<3000mV)
|
|
446 ;Bit3 = 1 -> Sensor 1 active
|
|
447 ;Bit4 = 1 -> Sensor 2 active
|
|
448 ;Bit5 = 1 -> Sensor 3 active
|
|
449 ;Bit6 unused in stand-alone HUD
|
|
450 ;Bit7 unused in stand-alone HUD
|
|
451
|
|
452 sensor_setpoint res 1 ; sensor ppo2 in 0.01bar for deco routine
|
|
453
|
|
454 better_gas_number res 1 ; number (1-5) of the "better gas" in divemode, =0: no better gas available
|
|
455
|
|
456 ;---------------------------- TMP DATA ---------------------------------------
|
|
457 ; Space for various overlayed data from color, word, menu processors, etc.
|
|
458 ;
|
|
459
|
|
460 tmp udata_ovr 0x1A0 ; Bank1 shared TMP space
|
|
461 tmp equ 0x1A0 ; Alias for CBLOCK directive.
|
|
462 res 0x060 ; RESERVED area.
|
|
463
|
|
464 ;-----------------------------------------------------------------------------
|
|
465 ; Reserve BANK2 for general purpose buffer (strings, images, etc).
|
|
466 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0).
|
|
467 buffer udata_ovr 0x200
|
|
468 buffer res .256
|
|
469
|
|
470 opt_table equ 0xE00
|
|
471 opt_table udata_ovr opt_table
|
|
472
|
|
473 ;---- Dive Options
|
|
474 opt_gas_O2_ratio res 5 ; Needed because deco gaslist use N2
|
|
475 opt_dil_O2_ratio res 5 ; Must be in line with opt_gas_O2_ratio
|
|
476 opt_gas_He_ratio res 5 ; He ratio Gas1-5
|
|
477 opt_dil_He_ratio res 5 ; Must be in line with opt_gas_He_ratio
|
|
478 opt_gas_type res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco
|
|
479 opt_dil_type res 5 ; 0=Disabled, 1=First, 2=Normal
|
|
480 opt_dive_mode res 1 ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
|
|
481 opt_ppO2_max res 1 ; PPO2 Max for MOD calculation and color coding in divemode
|
|
482 opt_ccr_mode res 1 ; =0: Fixed SP, =1: Sensor
|
|
483 opt_ppO2_min res 1 ; PPO2 min for Sensors and color coding in divemode
|
|
484
|
|
485 ;---- Managing Settings
|
|
486
|
|
487 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full
|
|
488 opt_salinity res 1 ; 0-5%
|
|
489 #DEFINE opt_name_length .60 ; Custom text string 5 rows with 12 chars
|
|
490 opt_name res opt_name_length
|
|
491 opt_language res 1 ; Current language. 0=EN, 1=DE, 2=FR, 3=SP
|
|
492 opt_units res 1 ; 0:m/°C, 1:ft/°F
|
|
493 opt_dateformat res 1 ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
|
|
494 opt_last_stop res 1 ; =3:3m, =4:4m, =5:5m, =6:6m
|
|
495 opt_aGF_high res 1 ; Alternative GF HIGH
|
|
496 opt_aGF_low res 1 ; Alternative GF LOW
|
|
497 opt_GF_high res 1 ; GF HIGH
|
|
498 opt_GF_low res 1 ; GF LOW
|
|
499 opt_enable_aGF res 1 ; =1: aGF can be selected underwater
|
|
500
|
|
501 ;-----------------------------EEPROM DATA ------------------------------------
|
|
502 ; Automatic reset of all options when this is changed:
|
|
503 #define eeprom_opt_serial 0x0005 ; Version 0.5
|
|
504
|
|
505 ;-----------------------------------------------------------------------------
|
|
506 ; Flags
|
|
507 #DEFINE switch_left flag1,0
|
|
508 #DEFINE switch_right flag1,1
|
|
509 #DEFINE neg_flag flag1,2 ; e.g. sub16 (sub_c = sub_a - sub_b)
|
|
510 #DEFINE pressure_refresh flag1,3 ; =1: A new pressure/temperature is available
|
|
511 #DEFINE sleepmode flag1,4 ; =1: In Sleepmode
|
|
512 #DEFINE tft_is_dimming flag1,5 ; =1: The TFT is dimming, ignore light sensor
|
|
513 #DEFINE display_velocity flag1,6 ; =1: show velocity
|
|
514 #DEFINE no_sensor_int flag1,7 ; =1: block any further access to pressure sensor
|
|
515
|
|
516 #DEFINE rs232_recieve_overflow flag2,0 ; =1: An RS232 timeout overflow occoured
|
|
517 #DEFINE stored_gas_changed flag2,1 ; =1: Stored Gas changed
|
|
518 #DEFINE high_altitude_mode flag2,2 ; =1: Unit was manually turned on with ambient pressure <880mbar
|
|
519 #DEFINE FLAG_apnoe_mode flag2,3 ; =1: Apnoe mode selected
|
|
520 #DEFINE restore_deco_data flag2,4 ; =1: Restore deco data (After simulation)
|
|
521 #DEFINE premenu flag2,5 ; =1: Premenu/Divemenu selected
|
|
522 #DEFINE menubit flag2,6 ; menu
|
|
523 #DEFINE simulatormode_active flag2,7 ; =1: Simulator mode active, override pressure sensor readings
|
|
524
|
|
525 #DEFINE divemode_menu flag3,0 ; =1: Divemode menu is shown
|
|
526 #DEFINE onesecupdate flag3,1 ; =1 after any second
|
|
527 #DEFINE twosecupdate flag3,2 ; =1: New two-second update
|
|
528 #DEFINE toggle_customview flag3,3 ; =1: Next customview
|
|
529 #DEFINE oneminupdate flag3,4 ; =1 after any minute
|
|
530 #DEFINE divemode flag3,5 ; =1: in Divemode
|
|
531 #DEFINE battery_is_36v flag3,6 ; =1: 3,6V Battery is in use
|
|
532 #DEFINE warning_active flag3,7 ; =1: A warning is active in divemode or surfacemode
|
|
533
|
|
534 #DEFINE better_gas_available flag4,0 ; =1: A better gas is available
|
|
535 #DEFINE blinking_better_gas flag4,1 ; =1: Gas is blinking
|
|
536 #DEFINE menuview flag4,2 ; =1: A menuview is shown in divemode (e.g. "Menu?")
|
|
537 #DEFINE quarter_second_update flag4,3 ; =1: A new 1/4 second has begun
|
|
538 #DEFINE divemode_gaschange flag4,4 ; =1: The gas will change very soon
|
|
539 #DEFINE decostop_active flag4,5 ; =1: Decompression stop shown
|
|
540 #DEFINE depth_greater_100m flag4,6 ; =1: Current Depth > 100m
|
|
541 #DEFINE realdive flag4,7 ; =1: A real dive during divemode
|
|
542
|
|
543 #DEFINE dive_warning_displayed flag5,0 ; =1: The warning sign is shown
|
|
544 #DEFINE reset_average_depth flag5,1 ; =1: Reset the average depth
|
|
545 #DEFINE store_sample flag5,2 ; =1: Store a new sample
|
|
546 #DEFINE divemode2 flag5,3 ; =1: Dive longer then one minute
|
|
547 #DEFINE FLAG_active_descent flag5,4 ; Used in Apnoe mode
|
|
548 #DEFINE event_occured flag5,5 ; =1: An event occured, store it!
|
|
549 #DEFINE divemode_menu_active flag5,6 ; =1: The divemode menu is shown
|
|
550 #DEFINE temp_changed flag5,7 ; =1: The temperature changed
|
|
551
|
|
552 #DEFINE gas6_changed flag6,0 ; =1: Gas 6 has been selected/changed underwater
|
|
553 #DEFINE onehourupdate flag6,1 ; =1: A new hour has just begun
|
|
554 #DEFINE settime_setdate flag6,2 ; =1: In the Set Time or Set Date Menu
|
|
555 #DEFINE setpoint_changed flag6,3 ; =1: Setpoint has been changed
|
|
556 #DEFINE second_row_warning flag6,4 ; =1: The second row contains a warning
|
|
557 #DEFINE FLAG_ccr_mode flag6,5 ; =1: CCR mode (Fixed ppO2 or Sensor) active
|
|
558 #DEFINE dive_hud1_displayed flag6,6 ; =1: The Sensor1 HUD reading is displayed
|
|
559 #DEFINE dive_hud2_displayed flag6,7 ; =1: The Sensor2 HUD reading is displayed
|
|
560
|
|
561 #DEFINE dive_hud3_displayed flag7,0 ; =1: The Sensor3 HUD reading is displayed
|
|
562 #DEFINE no_more_divesecs flag7,1 ; =1: Do no longer show seconds in divemode
|
|
563 #DEFINE FLAG_gauge_mode flag7,2 ; =1: In Gauge mode
|
|
564 #DEFINE ignore_last_edited_gas flag7,3 ; Used in gaslist_cleanup_list
|
|
565 #DEFINE ccr_diluent_setup flag7,4 ; =1: Setting up Diluents ("Gas6-10")
|
|
566 #DEFINE menu_show_sensors flag7,5 ; =1: Update HUD data in menu
|
|
567 #DEFINE short_gas_decriptions flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
568
|
|
569 #DEFINE is_bailout flag8,0 ; =1: Bailout
|
|
570 #DEFINE is_bailout_menu flag8,1 ; =1: Bailout
|
|
571 #DEFINE toggle_gf flag8,2 ; =1: Toggle GF/aGF
|
|
572 #DEFINE use_agf flag8,3 ; =1: Use aGF (instead of GF)
|
|
573 #DEFINE battery_removed_in_usb flag8,4 ; =1: The battery has been removed in USB
|
|
574 #DEFINE adc_running flag8,5 ; =1: The ADC is in use
|
|
575 #DEFINE comm_service_enabled flag8,6 ; =1: COMM Service mode unlocked
|
|
576 #DEFINE compass_enabled flag8,7 ; =1: The compass and accelerometer chip is active
|
|
577
|
|
578 ;=============================================================================
|
|
579 ; C-code Routines
|
|
580 ; PART 2
|
|
581 extern deco_calc_CNS_decrease_15min
|
|
582 extern deco_calc_CNS_fraction
|
|
583 extern deco_calc_desaturation_time
|
|
584 extern deco_calc_hauptroutine
|
|
585 extern deco_calc_tissue
|
|
586 extern deco_calc_percentage
|
|
587 extern deco_calc_wo_deco_step_1_min
|
|
588 extern deco_calc_dive_interval
|
|
589 extern deco_clear_CNS_fraction
|
|
590 extern deco_clear_tissue
|
|
591 extern deco_pull_tissues_from_vault
|
|
592 extern deco_push_tissues_to_vault
|
|
593 |