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