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