comparison src/hwos.inc @ 275:653a3ab08062

rename into hwOS
author heinrichsweikamp
date Thu, 07 May 2015 13:11:14 +0200
parents src/ostc3.inc@12ee30cbced9
children dfac47ac2e1d
comparison
equal deleted inserted replaced
274:9347893b74ce 275:653a3ab08062
1 ;=============================================================================
2 ;
3 ; File hwos.inc
4 ;
5 ; OSTC 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 ; Firmware definition
22 #DEFINE softwareversion_x d'1' ; Software version XX.YY
23 #DEFINE softwareversion_y d'79' ; Software version XX.YY
24 #DEFINE softwareversion_beta 1 ; (and 0 for release)
25 ; Firmware version will appear in "Change Firmware" style
26 #DEFINE firmware_expire_year .16
27 #DEFINE firmware_expire_month .4
28 #DEFINE firmware_expire_day .1
29
30 #DEFINE comm_service_key 0xABCDEF
31
32 ;-----------------------------------------------------------------------------
33
34 #DEFINE CCP1CON_VALUE b'00001100' ; PWM1 for LED dimming
35 #DEFINE T2CON_ECO b'00000100' ; 1:1 Postscaler, 1:1 Prescaler, Timer 2 start -> 980Hz (Good compromise of no-flicker and efficiency)
36 #DEFINE T2CON_NORMAL b'00001110'
37 #DEFINE T2CON_FASTEST b'00001110' ; 1:2 Postscaler, 1:16 Prescaler, Timer 2 start -> 1960Hz (no-flicker)
38
39 #DEFINE TMR0H_VALUE .245 ; RX Timeout (~3ms)
40
41 ; Timing for button hold-down flags
42 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7,8125ms -> 1s
43 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7,8125ms -> 0.25s
44 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7,8125ms -> 0.5s
45
46 ; Color Definitions: 8Bit RGB b'RRRGGGBB'
47 #DEFINE color_red b'11100000' ; (7,0,0)
48 #DEFINE color_dark_red b'10000101' ; (4,1,1)
49 #DEFINE color_violet b'11101011' ; (7,2,3)
50 #DEFINE color_blue b'11000111' ; (6,1,3)
51 #DEFINE color_green b'00011100' ; (0,7,0)
52 #DEFINE color_greenish b'00111110' ; (1,7,2)
53 #DEFINE color_dark_green b'00111001' ; (1,6,1)
54 #DEFINE color_yellow b'11111101' ; (7,7,1)
55 #DEFINE color_white b'11111111' ; (7,7,3)
56 #DEFINE color_black b'00000000' ; (0,0,0)
57 #DEFINE color_deepblue b'00000010' ; (0,0,2)
58 #DEFINE color_grey b'11011111' ; (6,7,3)
59 #DEFINE color_cyan b'11011111' ; (6,7,3)
60 #DEFINE color_lightblue b'11011011' ; (6,7,3)
61 #DEFINE color_orange b'11111000' ; (7,6,0)
62 #DEFINE color_pink b'11111010' ; (7,6,2)
63
64 #DEFINE FT_TINY .0
65 #DEFINE FT_SMALL .1
66 #DEFINE FT_MEDIUM .2
67 #DEFINE FT_LARGE .3
68
69 #DEFINE warn_depth .1
70 #DEFINE warn_cns .2
71 #DEFINE warn_gf .3
72 #DEFINE warn_ppo2 .4
73 #DEFINE warn_velocity .5
74 #DEFINE warn_ceiling .6
75 #DEFINE warn_gas_in_gaslist .7
76 #DEFINE warn_ppo2_hud .8
77 #DEFINE warn_battery .9
78
79 ; External O2 cell input parameters
80 #DEFINE min_mv .80 ; = 8mV
81 #DEFINE max_mv .2500 ; = 250mV
82 #DEFINE ignore_mv .3500 ; = 350mV (To suppress ghost readings for long, open cables)
83
84 ; Profile recording parameters
85 #DEFINE logbook_profile_version 0x23
86 #DEFINE samplingrate_apnoe .1 ; [seconds]
87 ; Warning: Divisors must be <.16 !
88 #DEFINE div_temperature .6 ; x samplingrate [s]
89 #DEFINE div_deco .6 ; x samplingrate [s]
90 #DEFINE div_gf .12 ; x samplingrate [s]
91 #DEFINE div_ppo2_sensors .2 ; x samplingrate [s]
92 #DEFINE div_decoplan .12 ; x samplingrate [s]
93 #DEFINE div_cns .12 ; x samplingrate [s]
94 #DEFINE div_tank .0 ; x samplingrate [s]
95 ; Warning: Information lengths must be <.16 !
96 #DEFINE infolength_temperature .2 ; [byte]
97 #DEFINE infolength_deco .2 ; [byte]
98 #DEFINE infolength_gf .1 ; [byte]
99 #DEFINE infolength_ppo2_sensors .9 ; [byte]
100 #DEFINE infolength_decoplan .15 ; [byte]
101 #DEFINE infolength_cns .2 ; [byte]
102 #DEFINE infolength_tank .0 ; [byte]
103
104 ; "Better Gas" behavior
105 ; better_gas_window <= minimum_change_depth !
106 ; minimum_change_depth >=5 !
107 #DEFINE minimum_change_depth .3 ; [m]
108 #DEFINE better_gas_window_neg .3 ; [m] (Depth above change depth)
109 #DEFINE better_gas_window_pos .1 ; [m] (Depth below change depth, if ppO2<opt_ppO2_max)
110
111 ; Dive mode limits and thresholds
112 #DEFINE start_dive_threshold .100 ; [cm]
113 #DEFINE high_altitude_dive_threshold .300;[cm]
114 #DEFINE apnoe_timeout .15 ; [min]
115 #DEFINE divemode_menuview_timeout .10 ; [s]
116 #DEFINE divemode_timeout .300 ; [s]
117 #DEFINE divemode_menu_timeout .30 ; [s]
118 #DEFINE ppo2_warning_low .19 ; [cbar] (Default value)
119 #DEFINE ppo2_lowest_setting .16 ; [cbar] (Minimum value)
120 #DEFINE ppo2_display_high .120 ; [cbar]
121 #DEFINE ppo2_warning_high .160 ; [cbar] (Default value)
122 #DEFINE ppo2_highest_setting .160 ; [cbar] (Max. Value)
123 #DEFINE cns_display_high .70 ; [%]
124 #DEFINE cns_warning_high .100 ; [%]
125 #DEFINE gf_display_high .75 ; [%]
126 #DEFINE gf_warning_high .100 ; [%]
127 #DEFINE depth_warn_mbar .13000 ; [mbar]
128 #DEFINE wake_up_from_sleep .1160 ; [mbar]
129 #DEFINE gf_display_threshold .20 ; [%]
130 #DEFINE simulator_timeout .15 ; [s]
131 #DEFINE sensor_voting_logic_threshold .20 ; Threshold in 0.01bar
132
133
134 ; Surface mode limits and thresholds
135 #DEFINE cns_display_surface_high .70 ; [%]
136 #DEFINE high_altitude_threshold .880 ; [mbar]
137 #DEFINE max_surfpressure .1080 ; [mbar]
138 #DEFINE timeout_surfacemode .90 ; [s]
139 #DEFINE timeout_calibrate_menu .240 ; [s]
140 #DEFINE timeout_ccr_surface .240 ; [s]
141
142 ; Decomodel paramters
143 #DEFINE no_fly_time_ratio .60 ; [%]
144 #DEFINE deco_distance .10 ; [dm]
145
146 ; Safety stop parameters
147 #DEFINE safety_stop_length .180 ; [s]
148 #DEFINE safety_stop_start .510 ; [mbar]
149 #DEFINE safety_stop_end .290 ; [mbar]
150 #DEFINE safety_stop_reset .1010 ; [mbar]
151
152 ; Color-code parameters for the divemode
153 #DEFINE color_code_cns_high .100 ; [%]
154 #DEFINE color_code_gf_warn_high .101 ; [%]
155 #DEFINE color_code_velocity_warn_high .10;[m/min]
156
157 ; Velocity threshold
158 #DEFINE velocity_warning_level_1 .7 ; [m/min]
159
160 ; Battery thresholds
161 #DEFINE lithium_36v_empty .2400 ; [mV] Saft 3,6V LS14500 AA - threshold for battery percent display
162 #DEFINE lithium_36v_low .2000 ; [mV] (Must be bigger then aa_15v_high!)
163 #DEFINE aa_15v_high .1550 ; [mV] Energizer 1,5V E2 AA
164 #DEFINE aa_15v_low .1100 ; [mV] According to Energizer Datasheet EBC-4201R, Page 2
165 #DEFINE color_code_battery_low .10 ; [%]
166 #DEFINE battery_show_level .24 ; [%]
167
168 ; 3,6V battery sensing data points at 70mA load
169 #DEFINE lithium_36v_75 .3000 ; [mV]
170 #DEFINE lithium_36v_50 .2900 ; [mV]
171 #DEFINE lithium_36v_25 .2600 ; [mV]
172 #DEFINE lithium_36v_10 .2500 ; [mV]
173
174 #DEFINE current_sleepmode .10
175 #DEFINE current_backlight_multi .115 ; *CCPR1L+current_backlight_offset
176 #DEFINE current_backlight_offset .216
177 #DEFINE current_speed_eco .1914
178 #DEFINE current_speed_normal .4027
179 #DEFINE current_speed_fastest .5050
180 #DEFINE current_ir_reciever .139
181 #DEFINE current_compass .28
182
183 ; Brightness thresholds (between zero (off) and 255 (max. power))
184 #DEFINE ambient_light_max_high_36V .175
185 #DEFINE ambient_light_max_high_cr .240
186 #DEFINE ambient_light_max_high_15V .150
187 #DEFINE ambient_light_min_high .35
188 #DEFINE ambient_light_max_medium .135
189 #DEFINE ambient_light_min_medium .25
190 #DEFINE ambient_light_max_eco .75
191 #DEFINE ambient_light_min_eco .10 ; Must be the lowest value!
192
193 ; IR Link timeout
194 #DEFINE ir_timeout_value .64 ; multiples of 62,5ms
195
196 ; Gaslist hard-coded limits
197 #DEFINE gaslist_min_o2 .7 ; Minimum O2 [%]
198 #DEFINE gaslist_max_change_depth .99 ; Max. change depth [m]
199 #DEFINE gaslist_sp_stepsize .10 ; Steps for Setpoint Setup [cbar]
200 #DEFINE gaslist_sp_max .160 ; Max. Setpoint [cbar]
201 #DEFINE gaslist_sp_min .50 ; Min. Setpoint [cbar]
202
203 ; Compass display
204 #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold
205 #DEFINE compass_averaging .10 ; numbers of extra averaging
206
207 ; Hardware defines
208 #DEFINE rechargeable hardware_flag,0 ; OSTC has rechargeable battery with battery management chip
209 #DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor
210 #DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital
211 #DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input
212 #DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module
213 ;unused
214 ;unused
215 ;unused
216
217 ;---------------------------- Macros ------------------------------------
218
219 TSTOSS macro opt_reg ; TeST Option Skip if not Zero
220 movff opt_reg,WREG
221 tstfsz WREG,A
222 bra $+4
223 endm
224
225 ;---------------------------- Bank0 DATA ------------------------------------
226 isr_backup equ 0x60
227 isr_backup udata_ovr isr_backup ; Reserved space for interupt data
228
229 ;---- Backup for general registers
230 isr_prod res 2
231
232 ;---- MS5541 subroutines
233 amb_pressure res 2
234 temperature res 2
235
236 C1 res 2 ; Decoded calibration data
237 C2 res 2
238 C3 res 2
239 C4 res 2 ; Here: C4-250
240 C5 res 2 ; Here: Reference Temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
241 C6 res 2
242 D1 res 2 ; raw pressure
243 D2 res 2 ; raw temperature
244 xdT res 2
245 xdT2 res 2
246 OFF res 2
247 SENS res 2
248 dLSB res 1 ;Pressure sensor interface
249 dMSB res 1
250 clock_count res 1
251 sensor_state_counter res 1 ; counts to eight for state maschine
252 amb_pressure_avg res 2
253 temperature_avg res 2
254 minimum_temperature res 2 ; minimum temperature
255 last_temperature res 2
256 last_pressure res 2
257 last_pressure_velocity res 2 ; For velocity
258 last_surfpressure res 2
259 last_surfpressure_15min res 2
260 last_surfpressure_30min res 2
261 rel_pressure res 2
262 sim_pressure res 2 ; hold simulated pressure in mbar if in Simulator mode
263 max_pressure res 2
264 avr_rel_pressure res 2
265 avr_rel_pressure_total res 2
266 ;---- Data for ISR math subroutines
267 isr_xC res 4
268 isr_xA res 2
269 isr_xB res 2
270
271 ;---- Data for ISR routines
272 isr1_temp res 1 ; ISR temp variable, used in ms5541.asm, isr_rtcc, isr_battery_gauge
273 isr2_temp res 1 ; ISR temp variable, used isr_battery_gauge
274
275 ;---- Display brightness
276 max_CCPR1L res 1 ; Max. brightness value for CCPR1L
277
278 ; Battery gauge (nAs, nC)
279 battery_gauge res 6 ; 48Bit -> 78Ah max...
280
281 ; IR/S8-Link
282 ir_s8_buffer res .18 ; temporally used in get_calibration_data for the raw (packed) calibration data
283 ir_s8_counter res 1
284 ir_S8_timeout res 1 ; Timeout for valid data
285
286 ; Compass raw data
287 compass_DX res 2
288 compass_DY res 2
289 compass_DZ res 2
290
291 accel_DX res 2
292 accel_DY res 2
293 accel_DZ res 2
294
295 ; Compass FILTERED data
296 compass_DX_f res 2
297 compass_DY_f res 2
298 compass_DZ_f res 2
299
300 accel_DX_f res 2
301 accel_DY_f res 2
302 accel_DZ_f res 2
303
304 ; Compass calibration data
305 compass_CX_f res 2
306 compass_CY_f res 2
307 compass_CZ_f res 2
308
309 ; Compass more data
310 compass_heading res 2 ; Corrected heading (in 1°) : -180 .. 180
311 compass_heading_old res 2 ; Old heading (For smoother display)
312 compass_heading_shown res 2 ; Displayed heading
313 ;compass_roll res 2 ; Rotation around the X axis
314 ;compass_pitch res 2 ; Rotation arounf the Y axis
315
316 compass_a res 2 ; Tmp data for Q15 arithmetics
317 compass_b res 2
318 compass_r res 3
319
320 CNS_start res 2 ; CNS value at beginning of dive
321 GF_start res 1 ; GF value at beginning of dive
322
323 ;---- Data for graphical compass
324 xRD res 2 ; virtual compass ruler offset
325 xRDr res 2 ; virtual compass ruler offset - right end
326 xRD180 res 2 ; virtual compass ruler offset for the -180 marker
327 xLO res 1 ; lo backup to prevent trashing
328 xHI res 1 ; hi backup to prevent trashing
329 xCM res 1 ; compass bearing relative position
330 compass_bearing res 2 ; this is where the bearing menu stores the actual heading for bearing
331
332 ;---------------------------- Common DATA ------------------------------------
333
334 common equ 0x100 ; Alias for "banksel common"
335 common udata_ovr common ; Bank1 general variables
336
337 ;---- Time and Date
338 secs res 1
339 mins res 1
340 hours res 1
341 day res 1
342 month res 1
343 year res 1
344 surface_interval res 2
345
346 flag1 res 1
347 flag2 res 1
348 flag3 res 1
349 flag4 res 1
350 flag5 res 1
351 flag6 res 1
352 flag7 res 1
353 flag8 res 1
354 flag9 res 1
355 flag10 res 1
356 flag11 res 1
357 flag12 res 1
358
359 hardware_flag res 1 ; hardware descriptor flag
360
361 temp1 res 1
362 temp2 res 1
363
364 ;---- Interface to wait macros
365 wait_temp res 1
366 waitms_temp res 1
367
368 ;---- Interface to graphic subroutines (aa_wordprocessor, color_processor, ...)
369 win_leftx2 res 1
370 win_top res 1
371 win_width res 2
372 win_height res 1
373 win_bargraph res 1
374 win_color1 res 1
375 win_color2 res 1
376 win_font res 1
377
378 ;---- Draw subroutines
379 tft_temp4 res 1
380 tft_temp3 res 1
381 tft_temp2 res 1
382 tft_temp1 res 1
383
384 ;---- data conversion subroutines
385 lo res 1
386 hi res 1
387 up res 1
388
389 ;---- RS232 temp variables
390 uart1_temp res 1
391 uart2_temp res 1
392
393 ;---- Data for math subroutines
394 divA res 2
395 divB res 1
396 xC res 4
397 xA res 2
398 xB res 2
399 sub_c res 2
400 sub_a res 2
401 sub_b res 2
402
403 ;---- Data for conversion subroutines
404 cvt_flags res 1
405 ignore_digits res 1
406
407 #define leftbind cvt_flags,0
408 #define ignore_digit3 cvt_flags,1
409 #define ignore_digit4 cvt_flags,2
410 #define ignore_digit5 cvt_flags,3
411 #DEFINE enable_screen_dumps cvt_flags,4 ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
412
413 ;---- Misc.
414 speed_setting res 1 ; =1: Eco, =2: Normal, =3: Fastest
415 nofly_time res 2 ; No Fly time in Minutes (Calculated after Dive)
416 timeout_counter res 1
417 timeout_counter2 res 1
418 timeout_counter3 res 1
419 batt_voltage res 2 ; Battery voltage in mV
420 batt_percent res 1 ; Battery in percent (1-100)
421 ambient_light res 2 ; ambient_light level
422 lo_temp res 1
423 hi_temp res 1
424 desaturation_time res 2
425 convert_value_temp res 3 ; used in menu_battery_state_convert_date
426 active_gas res 1
427 active_diluent res 1 ; As a backup when switching back from Bailout to CCR
428 warning_counter res 1 ; Counts amount of warning in divemode
429 warning_counter_backup res 1 ; Backup of warning_counter
430 warning_page res 1 ; current # of warning page
431
432 ; Remind history for menu processor (and such):
433 menustack res 5 ; menu stack
434 menupos res 1 ; Logbook and divemode menu
435 menupos2 res 1 ; For dive mode simulator and pre-menu
436 menupos3 res 1 ; For Customviews
437 menupos4 res 1 ; For divemode menu
438
439 ; Apnoe stuff that must be in bank common
440 apnoe_mins res 1
441 apnoe_secs res 1
442 apnoe_max_pressure res 2
443
444 ; Divemode
445 divemins res 2
446 divesecs res 1
447 samplingrate res 1
448 samplesecs_value res 1
449 divisor_temperature res 1
450 divisor_deco res 1
451 divisor_gf res 1
452 divisor_ppo2_sensors res 1
453 divisor_decoplan res 1
454 divisor_cns res 1
455 divisor_tank res 1
456 average_depth_hold res 4
457 average_depth_hold_total res 4
458 total_divetime_seconds res 2
459 average_divesecs res 2 ; For the resettable stopwatch
460 decodata res 2
461 apnoe_timeout_counter res 1
462 apnoe_surface_mins res 1
463 apnoe_surface_secs res 1
464
465 ; Profile storing
466 AlarmType res 1
467 samplesecs res 1
468 EventByte res 1
469 EventByte2 res 1
470 ProfileFlagByte res 1
471
472 ; External flash
473 ext_flash_address res 3 ; 24bit Address
474 ext_flash_log_pointer res 3 ; 24bit Address for logbook profile storing
475 ext_flash_dive_counter res 3 ; 24bit Counter for dive length (increased in write_byte_ext_flash_plus)
476
477 ; I2C
478 i2c_temp res 2 ; Temp
479
480 ; O2 Sensor data
481 o2_mv_sensor1 res 2 ; in 0.1mV steps
482 o2_mv_sensor2 res 2 ; in 0.1mV steps
483 o2_mv_sensor3 res 2 ; in 0.1mV steps
484 o2_ppo2_sensor1 res 1 ; Sensor1 ppO2 (in 0.01bar steps)
485 o2_ppo2_sensor2 res 1 ; Sensor2 ppO2 (in 0.01bar steps)
486 o2_ppo2_sensor3 res 1 ; Sensor3 ppO2 (in 0.01bar steps)
487 hud_battery_mv res 2
488 hud_status_byte res 1
489 ;Status Byte/
490 #DEFINE hud_connection_ok hud_status_byte,0 ;Bit0 = 1 -> HUD connection ok
491 ;Bit1 = 1 -> HUD is calibrated
492 ;Bit2 = 1 -> HUD Battery is low (<3000mV)
493 #DEFINE sensor1_active hud_status_byte,3 ;=1: Sensor1 is active
494 #DEFINE sensor2_active hud_status_byte,4 ;=1: Sensor2 is active
495 #DEFINE sensor3_active hud_status_byte,5 ;=1: Sensor3 is active
496 ;Bit6 unused in stand-alone HUD
497 ;Bit7 unused in stand-alone HUD
498
499 sensor_setpoint res 1 ; sensor ppo2 in 0.01bar for deco routine
500
501 better_gas_number res 1 ; number (1-5) of the "better gas" in divemode, =0: no better gas available
502 customview_divemode res 1 ; keeps last custom view
503 customview_surfmode res 1
504 safety_stop_countdown res 1 ; counts seconds of safety stop
505
506 ;---------------------------- TMP DATA ---------------------------------------
507 ; Space for various overlayed data from color, word, menu processors, etc.
508 ;
509
510 tmp udata_ovr 0x1A0 ; Bank1 shared TMP space
511 tmp equ 0x1A0 ; Alias for CBLOCK directive.
512 res 0x060 ; RESERVED area.
513
514 ;---------------------------- Common2 DATA ------------------------------------
515
516 common2 equ 0xA00 ; Alias for "banksel common"
517 common2 udata_ovr common2 ; Bank1 general variables
518
519 s8_rawdata_sensor1 res 3 ; 24bit A/D raw data from S8 HUD sensor 1
520 s8_rawdata_sensor2 res 3 ; 24bit A/D raw data from S8 HUD sensor 2
521 s8_rawdata_sensor3 res 3 ; 24bit A/D raw data from S8 HUD sensor 3
522
523 ;-----------------------------------------------------------------------------
524 ; Reserve BANK2 for general purpose buffer (strings, images, etc).
525 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0).
526 buffer udata_ovr 0x200
527 buffer res .256
528
529 opt_table equ 0xE00
530 opt_table udata_ovr opt_table
531
532 ;---- Dive Options
533 opt_gas_O2_ratio res 5 ; Needed because deco gaslist use N2
534 opt_dil_O2_ratio res 5 ; Must be in line with opt_gas_O2_ratio
535 opt_gas_He_ratio res 5 ; He ratio Gas1-5
536 opt_dil_He_ratio res 5 ; Must be in line with opt_gas_He_ratio
537 opt_gas_type res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco
538 opt_dil_type res 5 ; 0=Disabled, 1=First, 2=Normal
539 opt_dive_mode res 1 ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
540 opt_ppO2_max res 1 ; PPO2 Max for MOD calculation and color coding in divemode
541 opt_ccr_mode res 1 ; =0: Fixed SP, =1: Sensor
542 opt_ppO2_min res 1 ; PPO2 min for Sensors and color coding in divemode
543 opt_OC_bail_gas_change res 5 ; Gas change depths OC/Bailout
544 ;---- Managing Settings
545
546 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full
547 opt_salinity res 1 ; 0-5%
548 #DEFINE opt_name_length .60 ; Custom text string 5 rows with 12 chars
549 opt_name res opt_name_length
550 opt_language res 1 ; Current language. 0=EN, 1=DE, 2=FR, 3=SP
551 opt_units res 1 ; 0:m/°C, 1:ft/°F
552 opt_dateformat res 1 ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
553 opt_last_stop res 1 ; =3:3m, =4:4m, =5:5m, =6:6m
554 opt_aGF_high res 1 ; Alternative GF HIGH
555 opt_aGF_low res 1 ; Alternative GF LOW
556 opt_GF_high res 1 ; GF HIGH
557 opt_GF_low res 1 ; GF LOW
558 opt_enable_aGF res 1 ; =1: aGF can be selected underwater
559 opt_compass_gain res 1 ; 0-7 (230LSB/Gauss to 1370LSB/Gaus)
560 opt_sampling_rate res 1 ; =1: 10s, =0: 2s
561 opt_dive_color_scheme res 1 ; 0-3
562 opt_pressure_adjust res 1 ; SIGNED int (two's complement), -20/+20mbar max.
563 opt_enable_safetystop res 1 ; =1: A safety stop is shown
564 opt_calibration_O2_ratio res 1 ; %O2 of calibration gas
565 opt_x_s1 res 2 ; calibration factor (Not stored in EEPROM)
566 opt_x_s2 res 2 ; calibration factor (Not stored in EEPROM)
567 opt_x_s3 res 2 ; calibration factor (Not stored in EEPROM)
568 opt_sensor_fallback res 1 ; =1: Fallback to SP1 when sensor is lost
569 opt_flip_screen res 1 ; =1: Flip the screen
570 opt_cR_button_left res 1 ; Left button sensitivity (cR hardware)
571 opt_cR_button_right res 1 ; Right button sensitivity (cR hardware)
572
573 ;-----------------------------EEPROM DATA ------------------------------------
574 ; Automatic reset of all options when this is changed:
575 #define eeprom_opt_serial 0x0005 ; Version 0.5
576
577 ;-----------------------------------------------------------------------------
578 ; Flags
579 #DEFINE switch_left flag1,0
580 #DEFINE switch_right flag1,1
581 #DEFINE neg_flag flag1,2 ; e.g. sub16 (sub_c = sub_a - sub_b)
582 #DEFINE pressure_refresh flag1,3 ; =1: A new pressure/temperature is available
583 #DEFINE sleepmode flag1,4 ; =1: In Sleepmode
584 #DEFINE tft_is_dimming flag1,5 ; =1: The TFT is dimming, ignore light sensor
585 #DEFINE display_velocity flag1,6 ; =1: show velocity
586 #DEFINE no_sensor_int flag1,7 ; =1: block any further access to pressure sensor
587
588 #DEFINE rs232_recieve_overflow flag2,0 ; =1: An RS232 timeout overflow occoured
589 #DEFINE stored_gas_changed flag2,1 ; =1: Stored Gas changed
590 #DEFINE high_altitude_mode flag2,2 ; =1: Unit was manually turned on with ambient pressure <880mbar
591 #DEFINE FLAG_apnoe_mode flag2,3 ; =1: Apnoe mode selected
592 #DEFINE restore_deco_data flag2,4 ; =1: Restore deco data (After simulation)
593 #DEFINE premenu flag2,5 ; =1: Premenu/Divemenu selected
594 #DEFINE menubit flag2,6 ; menu
595 #DEFINE simulatormode_active flag2,7 ; =1: Simulator mode active, override pressure sensor readings
596
597 #DEFINE divemode_menu flag3,0 ; =1: Divemode menu is shown
598 #DEFINE onesecupdate flag3,1 ; =1 after any second
599 #DEFINE twosecupdate flag3,2 ; =1: New two-second update
600 #DEFINE toggle_customview flag3,3 ; =1: Next customview
601 #DEFINE oneminupdate flag3,4 ; =1 after any minute
602 #DEFINE divemode flag3,5 ; =1: in Divemode
603 #DEFINE battery_is_36v flag3,6 ; =1: 3,6V Battery is in use
604 #DEFINE warning_active flag3,7 ; =1: A warning is active in divemode or surfacemode
605
606 #DEFINE better_gas_available flag4,0 ; =1: A better gas is available
607 #DEFINE blinking_better_gas flag4,1 ; =1: Gas is blinking
608 #DEFINE menuview flag4,2 ; =1: A menuview is shown in divemode (e.g. "Menu?")
609 #DEFINE quarter_second_update flag4,3 ; =1: A new 1/4 second has begun
610 #DEFINE divemode_gaschange flag4,4 ; =1: The gas will change very soon
611 #DEFINE decostop_active flag4,5 ; =1: Decompression stop shown
612 #DEFINE depth_greater_100m flag4,6 ; =1: Current Depth > 100m
613 #DEFINE realdive flag4,7 ; =1: A real dive during divemode
614
615 #DEFINE dive_warning_displayed flag5,0 ; =1: The warning sign is shown
616 #DEFINE reset_average_depth flag5,1 ; =1: Reset the average depth
617 #DEFINE store_sample flag5,2 ; =1: Store a new sample
618 #DEFINE divemode2 flag5,3 ; =1: Dive longer then one minute
619 #DEFINE FLAG_active_descent flag5,4 ; Used in Apnoe mode
620 #DEFINE event_occured flag5,5 ; =1: An event occured, store it!
621 #DEFINE divemode_menu_active flag5,6 ; =1: The divemode menu is shown
622 #DEFINE temp_changed flag5,7 ; =1: The temperature changed
623
624 #DEFINE gas6_changed flag6,0 ; =1: Gas 6 has been selected/changed underwater
625 #DEFINE onehourupdate flag6,1 ; =1: A new hour has just begun
626 #DEFINE settime_setdate flag6,2 ; =1: In the Set Time or Set Date Menu
627 #DEFINE setpoint_changed flag6,3 ; =1: Setpoint has been changed
628 #DEFINE second_row_warning flag6,4 ; =1: The second row contains a warning
629 #DEFINE FLAG_ccr_mode flag6,5 ; =1: CCR mode (Fixed ppO2 or Sensor) active
630 #DEFINE dive_hud1_displayed flag6,6 ; =1: The Sensor1 HUD reading is displayed
631 #DEFINE dive_hud2_displayed flag6,7 ; =1: The Sensor2 HUD reading is displayed
632
633 #DEFINE dive_hud3_displayed flag7,0 ; =1: The Sensor3 HUD reading is displayed
634 #DEFINE no_more_divesecs flag7,1 ; =1: Do no longer show seconds in divemode
635 #DEFINE FLAG_gauge_mode flag7,2 ; =1: In Gauge mode
636 #DEFINE ignore_last_edited_gas flag7,3 ; Used in gaslist_cleanup_list
637 #DEFINE ccr_diluent_setup flag7,4 ; =1: Setting up Diluents ("Gas6-10")
638 #DEFINE menu_show_sensors flag7,5 ; =1: Update HUD data in menu
639 #DEFINE short_gas_decriptions flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
640 #DEFINE max_depth_greater_100m flag7,7 ; =1: Max. Depth > 100m
641
642 #DEFINE is_bailout flag8,0 ; =1: Bailout
643 #DEFINE is_bailout_menu flag8,1 ; =1: Bailout
644 #DEFINE toggle_gf flag8,2 ; =1: Toggle GF/aGF
645 #DEFINE use_agf flag8,3 ; =1: Use aGF (instead of GF)
646 #DEFINE battery_removed_in_usb flag8,4 ; =1: The battery has been removed in USB
647 #DEFINE adc_running flag8,5 ; =1: The ADC is in use
648 #DEFINE comm_service_enabled flag8,6 ; =1: COMM Service mode unlocked
649 #DEFINE compass_enabled flag8,7 ; =1: The compass and accelerometer chip is active
650
651 #DEFINE compass_fast_mode flag9,0 ; =1: The compass is in fast mode
652 #DEFINE in_color_menu flag9,1 ; =1: In the color scheme menu
653 #DEFINE bailoutgas_event flag9,2 ; =1: bailout was selected or a gaschange during bailout
654 #DEFINE win_invert flag9,3 ; =1: Invert font output
655 #DEFINE show_safety_stop flag9,4 ; =1: Show the safety stop
656 #DEFINE safety_stop_active flag9,5 ; =1: The safety stop is currently displayed
657 #DEFINE new_s8_data_available flag9,6 ; =1: New data frame recieved
658 #DEFINE print_compass_label flag9,7 ; =1: print the graphical comapss label
659
660 #DEFINE s8_digital flag10,0; =1: Digital I/O
661 #DEFINE menu_show_sensors2 flag10,1; =1: Update mV data in calibration menu
662 #DEFINE use_O2_sensor1 flag10,2; =1: Use this sensor for deco
663 #DEFINE use_O2_sensor2 flag10,3; =1: Use this sensor for deco
664 #DEFINE use_O2_sensor3 flag10,4; =1: Use this sensor for deco
665 #DEFINE setpoint_fallback flag10,5; =1: Fallback to SP1 due to external O2 sensor failure
666 #DEFINE blinking_setpoint flag10,6; =1: SP is blinking
667 #DEFINE flip_screen flag10,7; =1: Screen is flipped by 180°
668
669 #DEFINE sensor1_calibrated_ok flag11,0; =1: This sensor has been calibrated ok
670 #DEFINE sensor2_calibrated_ok flag11,1; =1: This sensor has been calibrated ok
671 #DEFINE sensor3_calibrated_ok flag11,2; =1: This sensor has been calibrated ok
672 #DEFINE voting_logic_sensor1 flag11,3; =1: This sensor is within the voting logic threshold
673 #DEFINE voting_logic_sensor2 flag11,4; =1: This sensor is within the voting logic threshold
674 #DEFINE voting_logic_sensor3 flag11,5; =1: This sensor is within the voting logic threshold
675 #DEFINE cc_active flag11,6; =1: Constant Current active (cR Hardware)
676 #DEFINE cv_active flag11,7; =1: Constant Voltage active (cR Hardware)
677
678 #DEFINE compass_bearing_set flag12,0 ; bearing set
679 #DEFINE compass_bearing_eq flag12,1 ; bearing is in direction? do not show << or >>
680 #DEFINE compass_bearing_lft flag12,2 ; bearing is to the left/<< if set, otherwise to the right/>>
681 #DEFINE compass_bearing_vis flag12,3 ; bearing is visible? (either ahead or behind/-180°)
682 #DEFINE compass_bearing_ahd flag12,4 ; bearing is ahead or behind?
683
684 ;=============================================================================
685 ; C-code Routines
686 ; PART 2
687 extern deco_calc_CNS_decrease_15min
688 extern deco_calc_CNS_fraction
689 extern deco_calc_desaturation_time
690 extern deco_calc_hauptroutine
691 extern deco_calc_tissue
692 extern deco_calc_percentage
693 extern deco_calc_wo_deco_step_1_min
694 extern deco_calc_dive_interval
695 extern deco_clear_CNS_fraction
696 extern deco_clear_tissue
697 extern deco_pull_tissues_from_vault
698 extern deco_push_tissues_to_vault
699