Mercurial > public > hwos_code
annotate src/hwos.inc @ 634:4050675965ea
3.10 stable release
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2020 17:34:31 +0200 |
parents | 185ba2f91f59 |
children | 8c1f1f334275 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
634 | 3 ; File hwos.inc * combined next generation V3.09.5 |
0 | 4 ; |
623 | 5 ; OSTC Platform Definitions |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
604 | 10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code |
0 | 11 ;============================================================================= |
12 | |
623 | 13 |
634 | 14 ; ---- Hardware Configuration |
623 | 15 LIST P=18F87K22 ; compiler settings, if changed change also: Configure -> SelectDevice in MPLAB |
16 #include "p18f87k22.inc" ; processor definitions | |
17 #include "ports.inc" ; port map definitions | |
0 | 18 |
604 | 19 |
634 | 20 ; ---- Software Configuration |
623 | 21 #include "configuration.inc" ; OSTC hwOS configuration |
582 | 22 |
0 | 23 |
634 | 24 ;----------------------------------------------------------------------------- |
25 ; Settings, Limits, Thresholds, Encodings, etc. | |
26 ;----------------------------------------------------------------------------- | |
27 | |
28 ; ---- Language Codes | |
604 | 29 #DEFINE none 0 ; no language selected |
623 | 30 #DEFINE en 1 ; select English |
31 #DEFINE de 2 ; select German | |
32 #DEFINE fr 3 ; select French | |
33 #DEFINE it 4 ; select Italian | |
604 | 34 |
560 | 35 |
634 | 36 ; ---- Magic Cookie Definition |
631 | 37 #DEFINE comm_service_key 0xABCDEF ; simsalabim to establish comm service mode |
0 | 38 |
39 | |
634 | 40 ; ---- Scrolling Menu Support |
41 ;#DEFINE scrolling_menu_enabled ; disabled | |
42 | |
43 | |
44 ; ---- Logo Address Vectors | |
604 | 45 #DEFINE hw_logo_block 0x01E000 ; color image data for heinrichsweikamp logo |
634 | 46 #DEFINE comm_logo_1 0x01EEDE ; color image data for USB or BT logo |
47 #DEFINE comm_logo_2 0x01EA04 ; color image data for BT logo, "+" bootloader | |
604 | 48 |
49 | |
582 | 50 ;-----------------------------EEPROM DATA ------------------------------------ |
51 ; Automatic reset of all options when this is changed: | |
631 | 52 #DEFINE eeprom_opt_version .8 ; range: 16 bit |
53 #DEFINE eeprom_vault_version .1 ; range: 8 bit | |
0 | 54 ;----------------------------------------------------------------------------- |
55 | |
623 | 56 |
634 | 57 ; ---- PWM1 for LED dimming |
58 #DEFINE CCP1CON_VALUE b'00001100' | |
623 | 59 #DEFINE T2CON_ECO b'01111110' |
60 #DEFINE T2CON_NORMAL b'01111110' | |
61 #DEFINE T2CON_FASTEST b'01111110' | |
62 | |
63 | |
634 | 64 ; ---- CPU speeds |
623 | 65 #DEFINE coding_speed_eco .1 ; 1 MHz = eco speed |
66 #DEFINE coding_speed_normal .2 ; 16 MHz = normal speed | |
67 #DEFINE coding_speed_fastest .4 ; 64 MHz = fastest speed (32 MHz on OSTC Sport BLE) | |
68 | |
69 #DEFINE speed_is_eco cpu_speed_state,0 ; =1: CPU is running at eco speed | |
70 #DEFINE speed_is_normal cpu_speed_state,1 ; =1: CPU is running at normal speed | |
71 #DEFINE speed_is_fastest cpu_speed_state,2 ; =1: CPU is running at fastest speed | |
72 | |
604 | 73 |
634 | 74 ; ---- Divemode Custom View Indexes - Attention: these numbers need to be in line with the jump tables in customview.asm! |
631 | 75 #DEFINE index_blank .0 ; blank view |
604 | 76 #DEFINE index_avr_stopwatch .1 ; average depth and stopwatch |
77 #DEFINE index_compass_dm .2 ; compass | |
78 #DEFINE index_ppo2_sensors .3 ; ppO2 sensors | |
79 #DEFINE index_sensor_check .4 ; sensor check | |
80 #DEFINE index_pscr_info .5 ; pSCR data | |
81 #DEFINE index_pressures_SAC .6 ; tank pressure and SAC rate | |
82 #DEFINE index_gas_needs_ascent .7 ; gas needs for ascent / cave return | |
631 | 83 #DEFINE index_cave_tts .8 ; cave mode TTS |
84 #DEFINE index_decoplan .9 ; deco plan | |
85 #DEFINE index_ceiling_GF_tissue .10 ; ceiling, current GF and tissues | |
86 #DEFINE index_CNS .11 ; CNS values | |
87 #DEFINE index_ppo2_ead_end_cns .12 ; ppO2, END/EAD and CNS or gas density | |
604 | 88 #DEFINE index_clock_batt_surfpress .13 ; clock, battery and surface pressure |
631 | 89 #DEFINE index_gf_factors .14 ; GF factors |
90 #DEFINE index_cave_waypoints .15 ; cave waypoints | |
91 #DEFINE index_cv_dm_max .13 ; highest index used in normal custom view rotation | |
28 | 92 |
623 | 93 |
634 | 94 ; ---- Timing for button hold-down flags |
631 | 95 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7.8125 ms -> 1.00 s |
604 | 96 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7.8125 ms -> 0.25 s |
631 | 97 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7.8125 ms -> 0.50 s |
0 | 98 |
623 | 99 |
634 | 100 ; ---- Font Sizes |
623 | 101 #DEFINE FT_TINY .0 ; aa_font16_block, full character set |
102 #DEFINE FT_SMALL .1 ; aa_font28_block, full character set | |
103 #DEFINE FT_STANDARD .2 ; aa_font34_block, full character set | |
104 #DEFINE FT_MEDIUM .3 ; aa_font48_block, only digits, /, ., :, ;, <, =, > and ? | |
105 #DEFINE FT_LARGE .4 ; aa_font90_block, only digits, / and . | |
106 #DEFINE FT_HUGE .5 ; aa_font92_block, only digits, / and . | |
107 | |
0 | 108 |
634 | 109 ; ---- External O2 Sensors |
628 | 110 #DEFINE min_mv .70 ; = 7 mV |
604 | 111 #DEFINE max_mv .2500 ; = 250 mV |
634 | 112 #DEFINE ignore_mv_above .3500 ; = 350 mV (to suppress ghost readings on long open cables) |
113 #DEFINE ignore_mv_below .19 ; = 1.9 mv (to suppress noise readings on open cabled) | |
0 | 114 |
623 | 115 |
634 | 116 ; ---- Profile Recording Parameters |
117 #DEFINE logbook_profile_version 0x40+0x24 ; logbook recording format: internal (2 bit) + external (6 bit) | |
582 | 118 #DEFINE samplingrate_apnoe .1 ; [seconds] |
560 | 119 |
623 | 120 |
634 | 121 ; ---- Profile Recording Rates - Attention: all Divisors must be < 16 ! |
604 | 122 #DEFINE div_temperature .6 ; x sampling rate [s] |
123 #DEFINE div_deco .6 ; x sampling rate [s] | |
124 #DEFINE div_gf .12 ; x sampling rate [s] | |
125 #DEFINE div_ppo2_sensors .2 ; x sampling rate [s] | |
126 #DEFINE div_decoplan .12 ; x sampling rate [s] | |
127 #DEFINE div_cns .12 ; x sampling rate [s] | |
628 | 128 #DEFINE div_tank .12 ; x sampling rate [s] |
560 | 129 |
623 | 130 |
634 | 131 ; ---- Profile Recording Data - Attention: Information Lengths must be < 16 ! |
582 | 132 #DEFINE infolength_temperature .2 ; [byte] |
133 #DEFINE infolength_deco .2 ; [byte] | |
134 #DEFINE infolength_gf .1 ; [byte] | |
135 #DEFINE infolength_ppo2_sensors .9 ; [byte] | |
136 #DEFINE infolength_decoplan .15 ; [byte] | |
137 #DEFINE infolength_cns .2 ; [byte] | |
628 | 138 #DEFINE infolength_tank .2 ; [byte] |
0 | 139 |
623 | 140 |
634 | 141 ; ---- RX Functions |
628 | 142 #DEFINE rx_packet_overdue_timeout .120 ; [seconds] timeout for pressure measurements becomming declared as outdated (max. 255) |
604 | 143 #DEFINE max_pres_diff_min .5 ; [bar] minimum selectable pressure difference for ind.double mode |
144 #DEFINE max_pres_diff_max .50 ; [bar] maximum selectable pressure difference for ind.double mode | |
0 | 145 |
623 | 146 IFDEF _ccr_pscr |
147 #DEFINE tr_pres_options .15 ; number of options for pressure measurement source / with diluents | |
148 ELSE | |
149 #DEFINE tr_pres_options .6 ; number of options for pressure measurement source / OC gases only | |
150 ENDIF | |
151 | |
631 | 152 |
634 | 153 ; ---- Cave Mode |
623 | 154 IFDEF _cave_mode |
631 | 155 #DEFINE backtrack_waypoint_max .30 ; highest user-available waypoint number (max allowed: 30) |
156 #DEFINE backtrack_almost_full_threshold .240 ; backtrack index position at which the almost full flag will be set | |
157 #DEFINE backtrack_entire_full_threshold .250 ; backtrack index position at which the entirely full flag will be set | |
623 | 158 ENDIF |
159 | |
160 | |
634 | 161 ; ---- Gas Needs Settings |
604 | 162 #DEFINE min_tank_size .1 ; [liter] |
163 #DEFINE max_tank_size .40 ; [liter] | |
164 #DEFINE min_fill_press .5 ; [0 bar] value is in multiples of 10 bar | |
165 #DEFINE max_fill_press .29 ; [0 bar] value is in multiples of 10 bar, no 300 bar due to too far beyond ideal gas laws | |
166 | |
167 | |
634 | 168 ; ---- Timeouts for Menus / Surface Mode |
631 | 169 #DEFINE surfmode_timeout_default .240 ; [s] default timeout for surface mode and surface menus |
170 #DEFINE surfmode_timeout_aa_15v .90 ; [s] timeout for surface mode and surface menus when on 1.5V battery | |
171 #DEFINE surfmode_timeout_simulator .240 ; [s] special timeout for simulator mode | |
634 | 172 |
604 | 173 |
634 | 174 ; ---- Timeouts for Menus / Dive Mode |
623 | 175 #DEFINE divemode_timeout_premenu .10 ; [s] timeout for dive mode pre-menu |
176 #DEFINE divemode_timeout_mainmenu .30 ; [s] timeout for dive mode main menu | |
177 | |
178 | |
634 | 179 ; ---- RS232 Timeout |
180 #DEFINE rx_timeout .400 ; [ms] timeout for RS232 RX, needs to be multiple of 50 ms | |
631 | 181 |
182 | |
634 | 183 ; ---- End-of-Dive Timeouts |
631 | 184 #DEFINE simulator_timeout_normal .90 ; [min] timeout simulator mode |
185 #DEFINE simulator_timeout_cave .240 ; [min] timeout simulator mode (cave mode) | |
186 #DEFINE apnoe_timeout .15 ; [min] timeout at surface in apnoe mode | |
187 #DEFINE simulator_timeout .15 ; [s] timeout at surface in simulator mode | |
188 | |
189 | |
634 | 190 ; ---- other Timeouts |
631 | 191 #DEFINE deep_sleep_10mins .144 ; [x 10mins] (24h in this example) |
192 | |
582 | 193 |
634 | 194 ; ---- Surface Mode Thresholds and Limits |
623 | 195 #DEFINE high_altitude_threshold .880 ; [mbar] ambient pressure at which to switch into high altitude mode |
196 #DEFINE max_surfpressure .1030 ; [mbar] maximum value for internal surface pressure | |
634 | 197 #DEFINE pressure_noise_threshold .10 ; [mbar] deltaP threshold for start of fast display updating |
198 #DEFINE pressure_noise_lag_time .6 ; [1/4 secs] lag time of display updating after deltaP < threshold again | |
560 | 199 |
200 | |
634 | 201 |
202 ; ---- Dive Mode Thresholds and Limits | |
623 | 203 #DEFINE wake_up_from_sleep .1160 ; [mbar] absolute pressure at which to switch from sleep mode to surface / dive mode |
204 #DEFINE dive_threshold_norm_alt_start .125 ; [mbar] relative pressure for normal altitude start-of-dive (equals depth in cm) | |
205 #DEFINE dive_threshold_norm_alt_end .75 ; [mbar] relative pressure for normal altitude end-of-dive (equals depth in cm) | |
206 #DEFINE dive_threshold_high_alt_start .325 ; [mbar] relative pressure for high altitude start-of-dive (equals depth in cm) | |
207 #DEFINE dive_threshold_high_alt_end .75 ; [mbar] relative pressure for high altitude end-of-dive (equals depth in cm) | |
208 #DEFINE ostc_depth_max .120 ; [m] maximum allowed operational depth for OSTC 2, 3, cR, TR, Plus & Sport | |
628 | 209 #DEFINE deco_region_distance .2 ; [m] distance below first stop for the deco region to begin |
192 | 210 |
582 | 211 |
634 | 212 ; ---- Dive Mode Margins |
623 | 213 #DEFINE ppO2_margin_on_max .300 ; [0.1 mbar] extra margin on ppO2 max values to compensate for surface pressures > 1000 hPa |
604 | 214 #DEFINE sensor_voting_logic_threshold .10 ; threshold in 0.01 bar |
0 | 215 |
623 | 216 |
634 | 217 ; ---- Gas and Dil types |
631 | 218 #DEFINE num_gas_types .4 ; Disabled, First, Normal, Deco |
219 #DEFINE num_dil_types .3 ; Disabled, First, Normal | |
220 | |
221 | |
634 | 222 ; ---- ppO2 Limits |
623 | 223 #DEFINE ppo2_warning_low_lowest .15 ; [cbar] minimum value for minimum ppO2 on OC |
224 #DEFINE ppo2_warning_low_default .17 ; [cbar] default value for minimum ppO2 on OC | |
225 #DEFINE ppo2_warning_low_highest .21 ; [cbar] maximum value for minimum ppO2 on OC | |
226 | |
227 #DEFINE ppo2_warning_loop_lowest .20 ; [cbar] minimum value for minimum ppO2 on loop | |
228 #DEFINE ppo2_warning_loop_default .40 ; [cbar] default value for minimum ppO2 on loop | |
229 #DEFINE ppo2_warning_loop_highest .60 ; [cbar] maximum value for minimum ppO2 on loop | |
230 | |
231 #DEFINE ppo2_warning_high_lowest .120 ; [cbar] minimum value for maximum ppO2 in none-deco phase | |
628 | 232 #DEFINE ppo2_warning_deco_lowest .120 ; [cbar] minimum value for maximum ppO2 in deco phase |
233 | |
623 | 234 #DEFINE ppo2_warning_high_default .140 ; [cbar] default value for maximum ppO2 in none-deco phase |
235 #DEFINE ppo2_warning_deco_default .160 ; [cbar] default value for maximum ppO2 in deco phase | |
628 | 236 |
237 IFDEF _high_ppO2_max | |
238 #DEFINE ppo2_warning_high_highest .200 ; [cbar] maximum value for maximum ppO2 in none-deco phase | |
239 #DEFINE ppo2_warning_deco_highest .200 ; [cbar] maximum value for maximum ppO2 in deco phase | |
240 ELSE | |
241 #DEFINE ppo2_warning_high_highest .160 ; [cbar] maximum value for maximum ppO2 in none-deco phase | |
623 | 242 #DEFINE ppo2_warning_deco_highest .160 ; [cbar] maximum value for maximum ppO2 in deco phase |
628 | 243 ENDIF |
623 | 244 |
634 | 245 |
246 ; ---- Salinity Limits | |
631 | 247 #DEFINE salinity_min .0 ; [%] minimum value for salinity percentage |
248 #DEFINE salinity_max .4 ; [%] maximum value for salinity percentage | |
0 | 249 |
634 | 250 |
251 ; ---- Color-Code Parameters for the Dive Mode | |
582 | 252 #DEFINE color_code_velocity_warn_high .11 ; [m/min] |
253 #DEFINE color_code_velocity_attn_high .10 ; [m/min] | |
623 | 254 #DEFINE velocity_display_threshold .3 ; [m/min] |
255 | |
256 | |
634 | 257 ; ---- Simulator Parameters |
623 | 258 #DEFINE simulator_startdepth .200 ; [mbar] initial depth (relative pressure) when entering simulator mode |
259 #DEFINE simulator_descent_threshold .50 ; [mbar] remaining distance to target pressure when to slow down descent | |
260 #DEFINE simulator_ascent_threshold .50 ; [mbar] remaining distance to target pressure when to slow down ascent | |
628 | 261 #DEFINE simulator_descent_rate .5 ; [mbar/0.125 sec] normal descent speed, 5 equals 24 m/min |
623 | 262 #DEFINE simulator_ascent_rate .2 ; [mbar/0.125 sec] normal ascent speed, 2 equals 9 m/min |
263 | |
0 | 264 |
634 | 265 ; ---- Battery Thresholds |
623 | 266 #DEFINE max_battery_charge_temp .3231 ; [0.1 Kelvin] max allowed battery temperature during charging (equals 50°C) |
604 | 267 #DEFINE lithium_36v_empty .2400 ; [mV] Saft 3.6 V LS14500 AA - threshold for battery percent display |
623 | 268 #DEFINE lithium_36v_low .2000 ; [mV] Saft 3.6 V LS14500 AA - lowest possible voltage, value must be higher than value of aa_15v_high! |
269 #DEFINE aa_15v_high .1550 ; [mV] Energizer 1.5 V E2 AA - highest possible voltage, value must be lower than value of lithium_36v_low! | |
270 #DEFINE aa_15v_low .1100 ; [mV] Energizer 1.5 V E2 AA - lowest possible voltage, according to Energizer data sheet EBC-4201R, page 2 | |
271 #DEFINE battery_show_level .30 ; [%] threshold when to show battery level | |
628 | 272 #DEFINE battery_warn_level_36 .15 ; [%] threshold for 3.6 V battery warning, also acts as threshold for setting display brightness level to ECO when in dive mode |
631 | 273 #DEFINE battery_warn_level_15 .25 ; [%] threshold for 1.5 V battery warning, also acts as threshold for setting display brightness level to ECO when in dive mode |
0 | 274 |
623 | 275 |
634 | 276 ; ---- 3.6 Volt Battery Sensing Data Points at 70 mA Load |
582 | 277 #DEFINE lithium_36v_75 .3000 ; [mV] |
278 #DEFINE lithium_36v_50 .2900 ; [mV] | |
279 #DEFINE lithium_36v_25 .2600 ; [mV] | |
280 #DEFINE lithium_36v_10 .2500 ; [mV] | |
604 | 281 |
628 | 282 |
634 | 283 ; ---- Capacity for 2.4 Ah Saft LS14500 and 0.8 Ah Panasonic UR14500P |
623 | 284 ; battery_gauge: 6 is nAs |
448 | 285 ; devide through 65536 |
604 | 286 ; a) devide through 364 -> result is in percent of a 2.4 Ah battery |
287 ; or b) devide through 121 -> result is in percent of a 0.8 Ah battery | |
37
0e1723f2761e
use four additional data points for the battery monitor
mh@mh-THINK.fritz.box
parents:
35
diff
changeset
|
288 |
628 | 289 |
634 | 290 ; ---- internal Battery Gauging |
623 | 291 #DEFINE capacity_saft_internal .364 |
292 #DEFINE capacity_panasonic_internal .121 | |
293 | |
448 | 294 |
604 | 295 ; Gauge IC |
623 | 296 #DEFINE capacity_saft .281 ; 2.4Ah/0.085mAh/100 [%] |
297 #DEFINE offset_saft .37300 ; 65536-(2.4Ah/0.085mAh) | |
448 | 298 |
623 | 299 #DEFINE capacity_panasonic .94 ; 0.8Ah/0.085mAh/100 [%] |
300 #DEFINE offset_panasonic .56124 ; 65536-(0.8Ah/0.085mAh) | |
582 | 301 |
623 | 302 #DEFINE capacity_ncr18650 .364 ; 3.1Ah/0.085mAh/100 [%] |
303 #DEFINE offset_ncr18650 .29065 ; 65536-(3.1Ah/0.085mAh) | |
448 | 304 |
623 | 305 #DEFINE capacity_ur16650 .271 ; 2.3Ah/0.085mAh/100 [%] |
306 #DEFINE offset_ur16650 .38477 ; 65536-(2.3Ah/0.085mAh) | |
307 | |
582 | 308 |
634 | 309 ; ---- Power Consumption Values |
582 | 310 #DEFINE current_sleepmode .31 |
623 | 311 #DEFINE current_backlight_multi .115 ; * CCPR1L + current_backlight_offset (restricted to <= 255) |
582 | 312 #DEFINE current_backlight_offset .216 |
313 #DEFINE current_speed_eco .1914 | |
314 #DEFINE current_speed_normal .4027 | |
315 #DEFINE current_speed_fastest .5050 | |
316 #DEFINE current_ir_receiver .139 | |
317 #DEFINE current_compass .28 | |
0 | 318 |
623 | 319 |
634 | 320 ; ---- Brightness Thresholds (between zero (off) and 255 (max. power consumption)) |
582 | 321 #DEFINE ambient_light_max_high_36V .170 |
322 #DEFINE ambient_light_max_high_cr .240 | |
323 #DEFINE ambient_light_max_high_15V .140 | |
324 #DEFINE ambient_light_min_high .35 | |
325 #DEFINE ambient_light_max_medium .125 | |
326 #DEFINE ambient_light_min_medium .25 | |
327 #DEFINE ambient_light_max_eco .70 | |
328 #DEFINE ambient_light_min_eco .10 ; must be the lowest value! | |
0 | 329 |
623 | 330 |
634 | 331 ; ---- IR Link Timeout |
631 | 332 #DEFINE ir_timeout_value .128 ; in multiples of 62.5 ms |
623 | 333 |
0 | 334 |
634 | 335 ; ---- Setpoint Control |
582 | 336 #DEFINE surface_sp .50 ; in cbar |
352
5c6da9fa5cb0
add setpoint change to first sample in CCR mode
heinrichsweikamp
parents:
344
diff
changeset
|
337 |
623 | 338 |
634 | 339 ; ---- Gaslist hard-coded Limits |
340 IFDEF _helium | |
341 #DEFINE gaslist_min_o2 .7 ; minimum O2 [%] ( 7% is minimum value to keep MOD < 255 meters / 1 Byte) | |
342 #DEFINE gaslist_max_o2 .100 ; maximum O2 [%] | |
343 #DEFINE gaslist_max_He .100-gaslist_min_o2 ; maximum He [%] | |
344 #DEFINE gaslist_max_change_depth .140 ; max. change depth [m] | |
345 #DEFINE tissue_graphics_options .2 ; tissue graphics "Pres+Sat" and "N2+He" available | |
346 ELSE | |
347 #DEFINE gaslist_min_o2 .21 ; minimum O2 [%] | |
348 #DEFINE gaslist_max_o2 .100 ; maximum O2 [%] | |
349 #DEFINE gaslist_max_He .0 ; maximum He [%] | |
350 #DEFINE gaslist_max_change_depth .70 ; max. change depth [m] | |
351 #DEFINE tissue_graphics_options .1 ; tissue graphics "Pres+Sat" only available | |
352 ENDIF | |
353 | |
354 | |
355 ; ---- Setpoint list hard-coded Limits | |
356 #DEFINE gaslist_sp_max .160 ; max. setpoint [cbar] | |
357 #DEFINE gaslist_sp_min .50 ; min. setpoint [cbar] | |
358 #DEFINE gaslist_sp_max_depth .100 ; max change depth [m] | |
359 | |
360 | |
361 ; ---- Compass Display | |
362 #DEFINE compass_fast_treshold .9 ; show new heading instantly if angular difference > compass_fast_treshold, else show animated turning of compass rose | |
363 #DEFINE compass_averaging .10 ; number of averaging cycles | |
364 | |
365 | |
366 ;----------------------------------------------------------------------------- | |
367 ; Bit Flags | |
368 ;----------------------------------------------------------------------------- | |
369 | |
370 ; ---- Gas / Diluent Type & State | |
631 | 371 ; .0 ; | 0: disabled, 1: first, 2: normal/work, 3: deco |
372 ; .1 ; | | |
373 #DEFINE gas_lost .2 ; =1: gas/diluent is lost (permanently unavailable) | |
374 #DEFINE gas_staged .3 ; =1: gas/diluent is staged (temporary unavailable) | |
375 ; .4 ; --- unused | |
376 ; .5 ; --- unused | |
377 ; .6 ; --- unused | |
378 ; .7 ; --- unused | |
379 | |
634 | 380 ; ---- Bit Flags for Communication with p2_deco.c - char_O_main_status |
623 | 381 #DEFINE DECO_VOLUME_FLAG .0 ; =1: calculate gas needs |
382 #DEFINE DECO_BOTTOM_FLAG .1 ; =1: calculate gas needs for full bottom segment, =0: ...for extra time only | |
383 #DEFINE DECO_CAVE_MODE .2 ; =1: calculate ascent and gas needs using backtracking data | |
631 | 384 #DEFINE DECO_GAS_CONTINGENCY .3 ; =1: use a second best gas if best gas is all used up |
623 | 385 #DEFINE DECO_TR_FUNCTIONS .4 ; =1: calculate TR functions (pressure readings) |
386 #DEFINE DECO_EXTENDED_STOPS .5 ; =1: place gas changes also below 1st stop depth | |
387 #DEFINE DECO_MODE_LOOP_FLAG .6 ; =1: calculate real tissues in loop mode (CCR or pSCR) | |
388 #DEFINE DECO_MODE_PSCR_FLAG .7 ; =1: calculate real tissues in pSCR mode (loop flag needs to be set, too) | |
389 | |
634 | 390 ; ---- Bit Flags for Communication with p2_deco.c - char_O_deco_status |
623 | 391 #DEFINE DECO_START_NORM .0 ; =1: write: start calculation of a normal deco plan |
392 #DEFINE DECO_START_ALT .1 ; =1: write: start calculation of an alternative deco plan | |
393 #DEFINE DECO_COMPLETED_NORM .0 ; =1: read: calculation of a normal deco plan has completed | |
394 #DEFINE DECO_COMPLETED_ALT .1 ; =1: read: calculation of an alternative deco plan has completed | |
395 #DEFINE DECO_INITIALIZE .2 ; =1: write: initialize deco engine (to be done only once at the begin of every dive) | |
628 | 396 #DEFINE DECO_CALCULATOR_MODE .3 ; =1: deco engone is run from the deco calculator |
623 | 397 #DEFINE DECO_BAILOUT_FLAG .4 ; =1: allow gas switches before first deco stop (used in bailout plans) |
631 | 398 #DEFINE DECO_DELAY_FLAG .5 ; =1: figure in a delayed ascent (fTTS) |
623 | 399 ; DECO_MODE_LOOP_FLAG .6 ; =1: calculate simulated tissues in loop mode (CCR or pSCR) |
400 ; DECO_MODE_PSCR_FLAG .7 ; =1: calculate simulated tissues in pSCR mode (loop flag needs to be set, too) | |
401 | |
634 | 402 ; ---- Bit Flags for Communication with p2_deco.c - char_O_deco_warnings |
623 | 403 #DEFINE IBCD_warning .0 ; =1: IBCD currently occuring |
404 #DEFINE IBCD_warning_lock .1 ; =1: IBCD occured durign the dive | |
405 #DEFINE mbubble_warning .2 ; =1: microbubbles potentionally currently occuring | |
406 #DEFINE mbubble_warning_lock .3 ; =1: microbubbles potentionally occured during the dive | |
407 #DEFINE outside_warning .4 ; =1: currently outside the ZHL-16 model | |
408 #DEFINE outside_warning_lock .5 ; =1: was outside the ZHL-16 model during the dive | |
409 #DEFINE outside_attention .6 ; =1: currently near to the limits of the ZHL-16 model | |
628 | 410 #DEFINE deco_plan_incomplete .7 ; =1: internal error: deco calculation incomplete |
623 | 411 |
634 | 412 ; ---- Bit Flags for Communication with p2_deco.c - char_O_deco_info |
628 | 413 #DEFINE deco_mode .0 ; =1: in deco mode, deco ppO2 levels permitted |
604 | 414 #DEFINE ind_double_switch .1 ; =1: switch to other tank advice active |
631 | 415 #DEFINE gas_needs_fTTS .2 ; =1: indicated gas needs are calculated in fTTS mode |
623 | 416 #DEFINE deco_zone .3 ; =1: fTTS is <= TTS (not updated when in bailout mode) |
604 | 417 #DEFINE deco_ceiling .4 ; =1: ceiling depth > 0 |
631 | 418 #DEFINE deco_stops_norm .5 ; =1: deco stops found in normal plan |
419 #DEFINE deco_stops_alt .6 ; =1: deco stops found in alternative plan | |
420 #DEFINE gas_needs_cave .7 ; =1: indicated gas needs are calculated in cave mode | |
623 | 421 |
634 | 422 ; ---- Bit Flags for Status on Variables of Type char |
604 | 423 #DEFINE char_transmitter_lost .6 |
424 #DEFINE char_invalid_flag .7 | |
425 #DEFINE char_transmitter_low_bat .7 | |
426 | |
634 | 427 ; ---- Bit Flags for Status on Variables of Type int (Flags are placed in the UPPER byte!) |
604 | 428 #DEFINE int_invalid_flag .2 |
429 #DEFINE int_not_yet_computed .3 | |
430 #DEFINE int_is_zero .3 | |
431 #DEFINE int_low_flag .4 | |
432 #DEFINE int_not_avail_flag .4 | |
433 #DEFINE int_high_flag .5 | |
434 #DEFINE int_outdated_flag .5 | |
435 #DEFINE int_attention_flag .6 | |
436 #DEFINE int_warning_flag .7 | |
0 | 437 |
623 | 438 |
0 | 439 ;----------------------------------------------------------------------------- |
623 | 440 ; Timebase and Eventbase (stored in access RAM, set by the ISR, trigger flags to be cleared by the application) |
634 | 441 ;----------------------------------------------------------------------------- |
623 | 442 |
443 #DEFINE timebase_0sec timebase,0 ; counting timebase, 1/2 sec bit | |
444 #DEFINE timebase_1sec timebase,1 ; counting timebase, 1 sec bit | |
445 #DEFINE timebase_2sec timebase,2 ; counting timebase, 2 sec bit | |
446 #DEFINE trigger_quarter_second timebase,3 ; =1: a new 1/4 second has begun (not synced with the other time flags, not generated while block_sensor_interrupt is set) | |
447 #DEFINE trigger_half_second timebase,4 ; =1: a new 1/2 second has begun | |
448 #DEFINE trigger_full_second timebase,5 ; =1: a new 1/1 second has begun | |
449 #DEFINE trigger_full_minute timebase,6 ; =1: a new minute has begun | |
450 #DEFINE trigger_full_hour timebase,7 ; =1: a new hour has begun | |
451 | |
452 #DEFINE trigger_isr_updates eventbase,0 ; =1: the ISR had kicked in (set by ISR, used by ISR-safe copy macros) | |
453 #DEFINE trigger_timeout eventbase,1 ; =1: timeout signal by timeout service | |
454 #DEFINE trigger_sample_divedata eventbase,2 ; =1: time to store a new sample | |
455 #DEFINE trigger_S8_data_update eventbase,3 ; =1: new S8 digital data are available | |
634 | 456 ; eventbase,4 ; --- unused |
623 | 457 #DEFINE trigger_pres_cur_changed eventbase,5 ; =1: current pressure value has changed |
458 #DEFINE trigger_pres_max_changed eventbase,6 ; =1: maximum pressure value has changed | |
459 #DEFINE trigger_temp_changed eventbase,7 ; =1: temperature value has changed | |
460 | |
461 | |
462 ;----------------------------------------------------------------------------- | |
463 ; Flags - stored in access RAM | |
634 | 464 ;----------------------------------------------------------------------------- |
623 | 465 |
466 ;---- Hardware - OSTC Model Descriptor (stored in access RAM, cleared & rebuilt in restart, to preserve compatibility with 3rd party tools DO NOT alter bit positions) | |
467 #DEFINE battery_gauge_available HW_descriptor,0 ; =1: OSTC has rechargeable battery with battery management chip | |
468 #DEFINE ambient_sensor HW_descriptor,1 ; =1: OSTC has an ambient light sensor | |
634 | 469 #DEFINE ext_input_s8_ana HW_descriptor,2 ; =1: OSTC has S8/analog input |
470 #DEFINE ext_input_optical HW_descriptor,3 ; =1: OSTC has optical input | |
471 #DEFINE ble_available HW_descriptor,4 ; =1: OSTC has an BT module | |
623 | 472 #DEFINE ostc_rx_present HW_descriptor,5 ; =1: OSTC has RX module |
473 #DEFINE lv_core HW_descriptor,6 ; =1: OSTC has low-voltage core (2.7V) | |
634 | 474 #DEFINE flash_block_write HW_descriptor,7 ; =1: OSTC has FLASH with block-write capability |
623 | 475 |
476 ;---- Hardware - OSTC Model Variants (stored in access RAM, NOT cleared in restart) | |
628 | 477 #DEFINE screen_type1 HW_variants,0 ; =1: display type 1, =0; display type 0 |
478 #DEFINE screen_type2 HW_variants,1 ; =1: display type 2, =0: display type 0 or 1 | |
479 #DEFINE screen_type3 HW_variants,2 ; =1: display type 3, =0: display type 0 or 1 or 2 | |
480 #DEFINE compass_type1 HW_variants,3 ; =1: compass type 1, =0: compass type 0 | |
481 #DEFINE compass_type2 HW_variants,4 ; =1: compass type 2, =0: compass type 0 or 1 | |
482 #DEFINE compass_type3 HW_variants,5 ; =1: compass type 3, =0: compass type 0 or 1 or 2 | |
483 #DEFINE analog_switches HW_variants,6 ; =1: analog switches available | |
484 #DEFINE battery_is_36v HW_variants,7 ; =1: a 3.6 Volt battery is detected | |
624 | 485 |
623 | 486 |
628 | 487 ;---- Hardware - States 1 (stored in access RAM, cleared on restart) |
488 #DEFINE analog_sw1_pressed HW_flags_state1,0 ; =1: analog switch 1 pressed | |
489 #DEFINE analog_sw2_pressed HW_flags_state1,1 ; =1: analog switch 2 pressed | |
490 #DEFINE switch_left HW_flags_state1,2 ; =1: left button was pressed | |
491 #DEFINE switch_right HW_flags_state1,3 ; =1: right button was pressed | |
492 #DEFINE flip_screen HW_flags_state1,4 ; =1: screen is shown 180° turned | |
493 #DEFINE adc_is_running HW_flags_state1,5 ; =1: the ADC is in use | |
494 #DEFINE tft_is_dimming HW_flags_state1,6 ; =1: the TFT is dimming, ignore light sensor | |
495 #DEFINE compass_enabled HW_flags_state1,7 ; =1: the compass and accelerometer chip is active | |
496 | |
497 ;---- Hardware - States 2 (stored in access RAM, NOT cleared on restart) | |
498 #DEFINE cc_active HW_flags_state2,0 ; =1: constant current charging active (cR hardware only) | |
499 #DEFINE cv_active HW_flags_state2,1 ; =1: constant voltage charging active (cR hardware only) | |
631 | 500 #DEFINE i2c_error_flag HW_flags_state2,2 ; =1: an I2C error occurred |
501 #DEFINE rs232_rx_timeout HW_flags_state2,3 ; =1: RS232 receive timeout occurred | |
634 | 502 #DEFINE battery_low_condition HW_flags_state2,4 ; =1: low battery condition detected |
503 #DEFINE flash_wrap_around HW_flags_state2,5 ; =1: address wrap-around control / signalling | |
504 #DEFINE flash_wait HW_flags_state2,6 ; =1: wait for flash write operation to complete | |
628 | 505 ; HW_flags_state2,7 ; --- unused |
623 | 506 |
582 | 507 |
623 | 508 ;---- Operating System - persistent Settings (stored in access RAM, NOT cleared in restart) |
509 #DEFINE sensor1_calibrated_ok OS_flags_persist,0 ; =1: sensor 1 calibration ok | |
510 #DEFINE sensor2_calibrated_ok OS_flags_persist,1 ; =1: sensor 2 calibration ok | |
511 #DEFINE sensor3_calibrated_ok OS_flags_persist,2 ; =1: sensor 3 calibration ok | |
512 #DEFINE compass_bearing_set OS_flags_persist,3 ; =1: compass bearing is set | |
513 #DEFINE use_old_batt_flag OS_flags_persist,4 ; =1: load old battery data after power-on reset | |
634 | 514 #DEFINE option_changed OS_flags_persist,5 ; =1: option values have been changed, EEPROM needs to be updated |
631 | 515 #DEFINE restart_fast OS_flags_persist,6 ; =1: request to skip logos and waits on restart |
623 | 516 #DEFINE battery_overtemp OS_flags_persist,7 ; =1: battery charging temperature limit exceeded |
517 | |
518 | |
519 ;---- Operating System - ISR Control 1 (stored in access RAM) | |
634 | 520 #DEFINE reset_timebase OS_flags_ISR1,0 ; =1: request ISR to reset the timebase for the trigger flags |
521 #DEFINE restart_timeout OS_flags_ISR1,1 ; =1: request ISR to resart the timeout timer | |
522 #DEFINE reset_max_pressure OS_flags_ISR1,2 ; =1: request ISR to reset the maximum pressure to zero | |
523 #DEFINE reset_surface_interval OS_flags_ISR1,3 ; =1: request ISR to reset the surface interval to zero | |
524 #DEFINE reset_trip_pressure OS_flags_ISR1,4 ; =1: request ISR to reset the resettable min/max pressure | |
623 | 525 #DEFINE block_rtc_access OS_flags_ISR1,5 ; =1: suspend the ISR from accessing the RTC |
526 #DEFINE block_battery_gauge OS_flags_ISR1,6 ; =1: suspend the ISR from updating the battery gauge | |
527 #DEFINE block_sensor_interrupt OS_flags_ISR1,7 ; =1: suspend the ISR from executing sensor interrupts | |
528 | |
529 ;---- Operating System - ISR Control 2 (stored in access RAM) | |
530 #DEFINE update_surface_pressure OS_flags_ISR2,0 ; =1: request ISR to update the surface pressure | |
531 #DEFINE quit_simulatormode OS_flags_ISR2,1 ; =1: request ISR to quit the simulator mode | |
532 #DEFINE count_divetime OS_flags_ISR2,2 ; =1: request ISR to count the dive time | |
533 #DEFINE sensor_override_request OS_flags_ISR2,3 ; =1: request ISR to override the pressure sensor with a simulated depth | |
634 | 534 #DEFINE tmr5_preemtion_allowed OS_flags_ISR2,4 ; =1: allow preemption of timeout counter |
623 | 535 ; OS_flags_ISR2,5 ; --- unused |
536 #DEFINE sensor_override_active OS_flags_ISR2,6 ; =1: ISR output: switch to override-mode confirmed | |
537 #DEFINE divetime_longer_1min OS_flags_ISR2,7 ; =1: ISR output: dive time is >= one minute | |
538 | |
539 | |
540 ;---- Operating Modes (stored in access RAM, persistent) | |
541 #DEFINE sleepmode OM_flags_mode,0 ; =1: in sleep mode | |
542 #DEFINE divemode OM_flags_mode,1 ; =1: in dive mode | |
543 #DEFINE simulatormode OM_flags_mode,2 ; =1: in simulator mode | |
544 #DEFINE high_altitude_mode OM_flags_mode,3 ; =1: unit was manually turned on with absolute pressure < 880 mbar | |
634 | 545 ; OM_flags_mode,4 ; --- unused |
623 | 546 #DEFINE tr_functions_activated OM_flags_mode,5 ; =1: TR module is available and TR mode is <> off |
547 #DEFINE cold_start OM_flags_mode,6 ; =1: restart is entered from a cold start | |
548 IFDEF _screendump | |
549 #DEFINE screen_dump_avail OM_flags_mode,7 ; =1: screen dump function is available | |
550 ELSE | |
551 #DEFINE comm_mode_disabled OM_flags_mode,7 ; =1: COMM mode is disabled | |
552 ENDIF | |
553 | |
554 | |
555 ;---- Dive Modes - Deco Modes (stored in access RAM) | |
556 #DEFINE FLAG_oc_mode DM_flags_deco,0 ; =1: in OC mode active | |
557 #DEFINE FLAG_ccr_mode DM_flags_deco,1 ; =1: in CCR mode (fixed ppO2 or sensor) active | |
558 #DEFINE FLAG_gauge_mode DM_flags_deco,2 ; =1: in gauge mode | |
559 #DEFINE FLAG_apnoe_mode DM_flags_deco,3 ; =1: in apnoe mode | |
560 #DEFINE FLAG_pscr_mode DM_flags_deco,4 ; =1: in pSCR mode | |
561 #DEFINE bailout_mode DM_flags_deco,5 ; =1: in bailout mode | |
562 #DEFINE apnoe_at_surface DM_flags_deco,6 ; =1: at the surface, 0= submerged (apnoe mode only, set/reset by ISR) | |
563 #DEFINE apnoe_new_dive DM_flags_deco,7 ; =1: a new dive has begun (apnoe mode only, set by ISR) | |
564 | |
565 | |
566 ;----------------------------------------------------------------------------- | |
567 ; Flags - stored in bank common | |
634 | 568 ;----------------------------------------------------------------------------- |
623 | 569 |
570 ;---- Dive Mode - Dive States | |
571 #DEFINE use_aGF DM_flags_state,0 ; =1: use aGF, =0: use GF | |
631 | 572 #DEFINE deco_locked DM_flags_state,1 ; =1: in or has been in deco obligation during the dive |
573 #DEFINE deco_region DM_flags_state,2 ; =1: in or has been in the deco stops region during the dive | |
574 #DEFINE cave_mode DM_flags_state,3 ; =1: cave mode is active (cave mode) | |
575 #DEFINE dive_turned DM_flags_state,4 ; =1: dive is turned (cave mode) | |
576 #DEFINE backtrack_almost_full DM_flags_state,5 ; =1: the backtracking storage is almost full (cave mode) | |
577 #DEFINE backtrack_entire_full DM_flags_state,6 ; =1: the backtracking storage is entirely full (cave mode) | |
578 #DEFINE backtrack_shutdown DM_flags_state,7 ; =1: the backtracking has shut down due to entirely full (cave mode) | |
582 | 579 |
623 | 580 ;---- Dive Mode - O2 Sensors |
581 #DEFINE use_O2_sensor1 DM_flags_sensor,0 ; =1: sensor 1 shall be used | |
582 #DEFINE use_O2_sensor2 DM_flags_sensor,1 ; =1: sensor 2 shall be used | |
583 #DEFINE use_O2_sensor3 DM_flags_sensor,2 ; =1: sensor 3 shall be used | |
584 #DEFINE voting_logic_sensor1 DM_flags_sensor,3 ; =1: sensor 1 is within the voting logic threshold | |
585 #DEFINE voting_logic_sensor2 DM_flags_sensor,4 ; =1: sensor 2 is within the voting logic threshold | |
586 #DEFINE voting_logic_sensor3 DM_flags_sensor,5 ; =1: sensor 3 is within the voting logic threshold | |
634 | 587 ; DM_flags_sensor,6 ; --- unused |
623 | 588 ; DM_flags_sensor,7 ; --- unused |
589 | |
631 | 590 ;---- Dive Mode - User Requests / General |
591 #DEFINE request_gas_change DM_flags_request,0 ; =1: request to change the gas | |
592 #DEFINE request_gas_update DM_flags_request,1 ; =1: request to update the gas | |
593 #DEFINE request_reset_avg DM_flags_request,2 ; =1: request to reset the average depth | |
594 #DEFINE request_next_custview DM_flags_request,3 ; =1: request to show the next custom view | |
595 #DEFINE request_back_to_loop DM_flags_request,4 ; =1: request to switch back from bailout to loop | |
596 #DEFINE request_toggle_GF DM_flags_request,5 ; =1: request to toggle between GF and aGF | |
597 #DEFINE request_set_marker DM_flags_request,6 ; =1: request to set a marker in the logbook | |
598 #DEFINE request_restart_engine DM_flags_request,7 ; =1: request to restart the deco engine | |
599 | |
600 ;---- Dive Mode - User Requests / Cave Mode | |
601 #DEFINE request_cave_toggle DM_flags_cavereq,0 ; =1: request to toggle cave mode off/on (cave mode) | |
602 #DEFINE request_cave_off_turned DM_flags_cavereq,1 ; =1: request to switch cave mode off (cave mode) | |
603 #DEFINE request_turn_toggle DM_flags_cavereq,2 ; =1: request to toggle dive turned state (cave mode) | |
604 #DEFINE request_turn_turn DM_flags_cavereq,3 ; =1: request to switch dive turned state to turned (cave mode) | |
605 #DEFINE request_waypoint_set DM_flags_cavereq,4 ; =1: request to set a waypoint (cave mode) | |
606 #DEFINE request_waypoint_out DM_flags_cavereq,5 ; =1: request to go one waypoint out of the cave (cave mode) | |
607 #DEFINE request_waypoint_in DM_flags_cavereq,6 ; =1: request to go one waypoint into the cave (cave mode) | |
608 ; DM_flags_cavereq,7 ; --- unused | |
623 | 609 |
610 ;---- Dive Mode - Data Recording Events | |
611 #DEFINE event_occured DM_flags_event,0 ; =1: an event occurred (global indicator flag) | |
612 #DEFINE event_gas_change DM_flags_event,1 ; =1: a change to another gas or diluent occurred | |
613 #DEFINE event_gas_change_gas6 DM_flags_event,2 ; =1: a change to or of the gas 6 has occurred | |
614 #DEFINE event_bailout DM_flags_event,3 ; =1: a change to or of the OC gas occurred due to bailout | |
615 #DEFINE event_SP_change DM_flags_event,4 ; =1: a change of the setpoint has occurred | |
616 ; DM_flags_event,5 ; --- unused | |
631 | 617 ; DM_flags_event,6 ; --- unused |
618 ; DM_flags_event,7 ; --- unused | |
623 | 619 |
620 ;---- Dive Mode - Display Control / Layout | |
621 #DEFINE safety_stop_enabled DM_flags_layout1,0 ; =1: safety stop is enabled | |
622 #DEFINE safety_stop_active DM_flags_layout1,1 ; =1: safety stop is shown | |
623 #DEFINE decostop_active DM_flags_layout1,2 ; =1: decompression stop is shown | |
624 #DEFINE velocity_active_num DM_flags_layout1,3 ; =1: numerical velocity indicator is shown | |
625 #DEFINE velocity_active_vsi DM_flags_layout1,4 ; =1: graphical velocity indicator is shown | |
626 #DEFINE alt_layout_active DM_flags_layout1,5 ; =1: the alternative dive layout is used (aka "blind mode") | |
627 #DEFINE neg_flag_velocity DM_flags_layout1,6 ; =1: descending, used by velocity logic | |
628 #DEFINE show_only_divemins DM_flags_layout1,7 ; =1: only dive minutes are shown | |
629 | |
630 #DEFINE cur_depth_greater_100m DM_flags_layout2,0 ; =1: current depth > 100 meters | |
631 #DEFINE max_depth_greater_100m DM_flags_layout2,1 ; =1: max. depth > 100 meters | |
634 | 632 #DEFINE depth_color_attention DM_flags_layout2,2 ; =1: show depth in attention color |
633 #DEFINE depth_color_warning DM_flags_layout2,3 ; =1: show depth in warning color | |
634 #DEFINE depth_color_last DM_flags_layout2,4 ; =1: last depth was shown in warning or attention color | |
623 | 635 #DEFINE depth_inverse_last DM_flags_layout2,5 ; =1: last depth was shown in inverse |
634 | 636 #DEFINE gas_needs_mode_last DM_flags_layout2,6 ; =1: last gas needs were computed for cave mode, =0: vertical ascent |
637 #DEFINE tts_over_99_last DM_flags_layout2,7 ; =1: last TTS was > 99 minutes | |
623 | 638 |
631 | 639 #DEFINE tissue_graphic_layout DM_flags_layout3,0 ; =1: show pres+sat, =0: show N2/He pressures |
640 #DEFINE tissue_graphic_gf DM_flags_layout3,1 ; =1: show GF lines | |
641 #DEFINE tissue_graphic_cns DM_flags_layout3,2 ; =1: shwo CNS value (surface mode graphic only) | |
642 #DEFINE tissue_graphic_mode DM_flags_layout3,3 ; =1: logbook mode (surface mode graphic only) | |
643 ; DM_flags_layout3,4 ; --- unused | |
644 ; DM_flags_layout3,5 ; --- unused | |
645 ; DM_flags_layout3,6 ; --- unused | |
646 ; DM_flags_layout3,7 ; --- unused | |
647 | |
648 | |
649 ;---- Dive Mode - Display Control / Gas, Diluent, Depth | |
623 | 650 #DEFINE better_gas_hint DM_flags_gas_dil,0 ; =1: mark a gas when it is a better gas |
631 | 651 #DEFINE color_code_gases DM_flags_gas_dil,1 ; =1: color code the gases by ppO2 & current depth |
652 #DEFINE better_gas_available DM_flags_gas_dil,2 ; =1: a better gas is available | |
653 #DEFINE better_gas_blinking DM_flags_gas_dil,3 ; =1: gas is blinking | |
654 #DEFINE better_dil_available DM_flags_gas_dil,4 ; =1: a better diluent is available | |
655 #DEFINE better_dil_blinking DM_flags_gas_dil,5 ; =1: diluent is blinking | |
656 #DEFINE gas6_or_EXIT DM_flags_gas_dil,6 ; =1: exit menu, =0: provide gas6 option | |
634 | 657 ; DM_flags_gas_dil,7 ; --- unused |
658 | |
659 | |
660 ;---- Dive Mode - Display Control / Messages | |
661 #DEFINE sign_shown DM_flags_message,0 ; =1: the warning/attention/advice sign is shown | |
662 #DEFINE sign_advice DM_flags_message,1 ; =1: the sign shown is an advice sign | |
663 #DEFINE sign_attention DM_flags_message,2 ; =1: the sign shown is an attention sign | |
664 #DEFINE sign_warning DM_flags_message,3 ; =1: the sign shown is a warning sign | |
665 #DEFINE message_2nd_row_used DM_flags_message,4 ; =1: the second row contains a warning/attention/advice | |
666 ; DM_flags_message,5 ; --- unused | |
667 ; DM_flags_message,6 ; --- unused | |
668 ; DM_flags_message,7 ; --- unused | |
669 | |
670 | |
671 ;---- Dive Mode - Display Control / Advices | |
672 #DEFINE advc_det_change_gas DM_flags_advc_det,0 ; =1: change gas advice | |
673 #DEFINE advc_det_switch_tank DM_flags_advc_det,1 ; =1: change tank advice | |
674 ; DM_flags_advc_det,2 ; --- unused | |
675 ; DM_flags_advc_det,3 ; --- unused | |
676 ; DM_flags_advc_det,4 ; --- unused | |
677 ; DM_flags_advc_det,5 ; --- unused | |
678 ; DM_flags_advc_det,6 ; --- unused | |
679 ; DM_flags_advc_det,7 ; --- unused | |
680 | |
681 | |
682 ;---- Dive Mode - Display Control / Attentions | |
683 #DEFINE attn_det_gas_needs DM_flags_att1_det,0 ; =1: gas needs attention threshold reached | |
684 #DEFINE attn_det_ppo2_breathed DM_flags_att1_det,1 ; =1: breathed ppO2 attention threshold reached | |
685 #DEFINE attn_det_ppo2_diluent DM_flags_att1_det,2 ; =1: diluent ppO2 attention threshold reached | |
686 #DEFINE attn_det_cns_current DM_flags_att1_det,3 ; =1: current CNS attention threshold reached | |
687 #DEFINE attn_det_gas_density DM_flags_att1_det,4 ; =1: gas density attention threshold reached | |
688 #DEFINE attn_det_saturation DM_flags_att1_det,5 ; =1: tissue saturation attention threshold reached | |
689 #DEFINE attn_det_outside DM_flags_att1_det,6 ; =1: outside model attention issued | |
690 #DEFINE attn_det_microbubble DM_flags_att1_det,7 ; =1: µ-bubble attention issued | |
691 | |
692 #DEFINE attn_det_sac_rate DM_flags_att2_det,0 ; =1: SAC rate attention threshold reached | |
693 #DEFINE attn_det_pressure1 DM_flags_att2_det,1 ; =1: tank 1 pressure attention threshold reached | |
694 #DEFINE attn_det_pressure2 DM_flags_att2_det,2 ; =1: tank 2 pressure attention threshold reached | |
695 #DEFINE attn_det_ibcd DM_flags_att2_det,3 ; =1: IBCD attention issued | |
696 #DEFINE attn_det_cave_shut_down DM_flags_att2_det,4 ; =1: cave mode shutdown attention issued | |
697 #DEFINE attn_det_sensor1_lost DM_flags_att2_det,5 ; =1: sensor 1 lost attention issued | |
698 #DEFINE attn_det_sensor2_lost DM_flags_att2_det,6 ; =1: sensor 2 lost attention issued | |
699 #DEFINE attn_det_sensor3_lost DM_flags_att2_det,7 ; =1: sensor 3 lost attention issued | |
700 | |
701 #DEFINE attn_det_xmit1_bat DM_flags_att3_det,0 ; =1: xmitter 1 low batt attention issued | |
702 #DEFINE attn_det_xmit2_bat DM_flags_att3_det,1 ; =1: xmitter 2 low batt attention issued | |
703 #DEFINE attn_det_cns_eod DM_flags_att3_det,2 ; =1: end-of-dive CNS attention threshold reached | |
704 ; DM_flags_att3_det,3 ; --- unused | |
705 ; DM_flags_att3_det,4 ; --- unused | |
706 ; DM_flags_att3_det,5 ; --- unused | |
707 ; DM_flags_att3_det,6 ; --- unused | |
708 ; DM_flags_att3_det,7 ; --- unused | |
709 | |
710 ;---- Dive Mode - Display Control / Warnings | |
711 #DEFINE warn_det_gas_needs DM_flags_war1_det,0 ; =1: gas needs warning threshold reached | |
712 #DEFINE warn_det_ppO2_breathed DM_flags_war1_det,1 ; =1: breathed ppO2 warning threshold reached | |
713 #DEFINE warn_det_ppO2_diluent DM_flags_war1_det,2 ; =1: diluent ppO2 warning threshold reached | |
714 #DEFINE warn_det_cns_current DM_flags_war1_det,3 ; =1: current CNS warning threshold reached | |
715 #DEFINE warn_det_gas_density DM_flags_war1_det,4 ; =1: gas density warning threshold reached | |
716 #DEFINE warn_det_saturation DM_flags_war1_det,5 ; =1: tissue saturation warning threshold reached | |
717 #DEFINE warn_det_outside DM_flags_war1_det,6 ; =1: outside model warning issued | |
718 #DEFINE warn_det_microbubble DM_flags_war1_det,7 ; =1: µ-bubble warning issued | |
719 | |
720 #DEFINE warn_det_cave_shut_down DM_flags_war2_det,0 ; =1: cave mode shutdown warning issued | |
721 #DEFINE warn_det_pressure1 DM_flags_war2_det,1 ; =1: tank pressure 1 warning threshold reached | |
722 #DEFINE warn_det_pressure2 DM_flags_war2_det,2 ; =1: tank pressure 2 warning threshold reached | |
723 #DEFINE warn_det_batt_low DM_flags_war2_det,3 ; =1: battery low warning issued | |
724 #DEFINE warn_det_depth_limit DM_flags_war2_det,4 ; =1: depth limit warning issued | |
725 #DEFINE warn_det_sensors_lost DM_flags_war2_det,5 ; =1: sensors lost warning issued | |
726 #DEFINE warn_det_sensors_div DM_flags_war2_det,6 ; =1: sensors divergence warning issued | |
727 #DEFINE warn_det_no_bo_gas DM_flags_war2_det,7 ; =1: no B/O gas avail warning issued | |
728 | |
729 | |
730 ;---- Dive Mode - Display Control / Custom View automatic show-up | |
731 #DEFINE shown_gas_needs_attn DM_flags_shown1,0 ; =1: gas needs attention has been shown before | |
732 #DEFINE shown_gas_needs_warn DM_flags_shown1,1 ; =1: gas needs warning has been shown before | |
733 #DEFINE shown_sensors_diverg DM_flags_shown1,2 ; =1: sensor divergence has been shown before | |
734 #DEFINE shown_sensors_lost DM_flags_shown1,3 ; =1: sensor all lost has been shown before | |
735 #DEFINE shown_sensor1_fail DM_flags_shown1,4 ; =1: sensor 1 failure has been shown before | |
736 #DEFINE shown_sensor2_fail DM_flags_shown1,5 ; =1: sensor 2 failure has been shown before | |
737 #DEFINE shown_sensor3_fail DM_flags_shown1,6 ; =1: sensor 3 failure has been shown before | |
738 ; DM_flags_shown1,7 ; --- unused | |
739 | |
740 #DEFINE shown_xmit1_lost DM_flags_shown2,0 ; =1: xmitter 1 lost has been shown before | |
741 #DEFINE shown_xmit1_battery DM_flags_shown2,1 ; =1: xmitter 1 batt low has been shown before | |
742 #DEFINE shown_xmit1_pres_warn DM_flags_shown2,2 ; =1: xmitter 1 pres warn has been shown before | |
743 #DEFINE shown_xmit1_pres_attn DM_flags_shown2,3 ; =1: xmitter 1 pres attn has been shown before | |
744 #DEFINE shown_xmit2_lost DM_flags_shown2,4 ; =1: xmitter 2 lost has been shown before | |
745 #DEFINE shown_xmit2_battery DM_flags_shown2,5 ; =1: xmitter 2 batt low has been shown before | |
746 #DEFINE shown_xmit2_pres_warn DM_flags_shown2,6 ; =1: xmitter 2 pres warn has been shown before | |
747 #DEFINE shown_xmit2_pres_attn DM_flags_shown2,7 ; =1: xmitter 2 pres attn has been shown before | |
748 | |
749 #DEFINE shown_gas_density_attn DM_flags_shown3,0 ; =1: gas density atten. has been shown before | |
750 #DEFINE shown_gas_density_warn DM_flags_shown3,1 ; =1: gas density warning has been shown before | |
751 ; DM_flags_shown3,2 ; --- unused | |
752 ; DM_flags_shown3,3 ; --- unused | |
753 ; DM_flags_shown3,4 ; --- unused | |
754 ; DM_flags_shown3,5 ; --- unused | |
755 ; DM_flags_shown3,6 ; --- unused | |
756 ; DM_flags_shown3,7 ; --- unused | |
757 | |
623 | 758 |
759 ;---- Menu System - Control | |
634 | 760 #DEFINE surfmode_menu MS_flags_control,0 ; =1: surface menu is shown (i.e. returning from it) |
761 #DEFINE dive_pre_menu MS_flags_control,1 ; =1: dive pre-menu is shown (e.g. "Menu?") | |
762 #DEFINE dive_main_menu MS_flags_control,2 ; =1: dive main menu is shown (i.e. the "big" menu) | |
623 | 763 #DEFINE compass_menu MS_flags_control,3 ; =1: "set bearing" is shown |
764 #DEFINE is_diluent_menu MS_flags_control,4 ; =1: setting up diluents, =0: setting up OC gases | |
765 #DEFINE is_bailout_menu MS_flags_control,5 ; =1: in bailout menu | |
631 | 766 #DEFINE custom_view_locked MS_flags_control,6 ; =1: the custom view is locked (defer CV auto-popup) |
634 | 767 #DEFINE option_stop_at_max MS_flags_control,7 ; =1: option increment will stop at max value (no wrap around) |
623 | 768 |
769 ;---- Menu System - Data Imprinting | |
770 #DEFINE imprint_time_date MS_flags_imprint,0 ; =1: imprint current time & date | |
771 #DEFINE imprint_color_schemes MS_flags_imprint,1 ; =1: imprint color schemes | |
772 #DEFINE imprint_sensor_mv MS_flags_imprint,2 ; =1: imprint O2 sensor mV data | |
773 #DEFINE imprint_xmitter_pres MS_flags_imprint,3 ; =1: imprint transmitter pressure data | |
774 #DEFINE imprint_xmitter_ID MS_flags_imprint,4 ; =1: in transmitter-to-tank pairing menu | |
775 #DEFINE imprint_surfmode_data MS_flags_imprint,5 ; =1: imprint surface mode data | |
634 | 776 #DEFINE block_option_value MS_flags_imprint,6 ; =1: suspend displaying of option values |
777 #DEFINE short_gas_descriptions MS_flags_imprint,7 ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
623 | 778 |
0 | 779 |
623 | 780 ;---- Font & Image System |
781 #DEFINE aa_antialias AA_flags,0 ; used by aa_wordprocessor | |
782 #DEFINE aa_color_quarter AA_flags,1 ; used by aa_wordprocessor | |
783 #DEFINE aa_color_half AA_flags,2 ; used by aa_wordprocessor | |
784 #DEFINE aa_aux_flag AA_flags,3 ; auxiliary flag for various purposes | |
785 #DEFINE use_custom_colors AA_flags,4 ; =1: override default pixel colors, used by color_image | |
634 | 786 #DEFINE win_invert AA_flags,5 ; =1: print in inverse video |
623 | 787 ; AA_flags,6 ; --- unused |
788 ; AA_flags,7 ; --- unused | |
789 | |
790 | |
634 | 791 ;---- Convert Functions (Control of numerical Output) |
792 | |
793 #DEFINE hide_digit5 CVT_flags1,0 ; =1: do not print digit 5 (clip output at 9999) | |
794 #DEFINE hide_digit4 CVT_flags1,1 ; =1: do not print digits 5-4 (clip output at 999) | |
795 #DEFINE hide_digit3 CVT_flags1,2 ; =1: do not print digits 5-3 (clip output at 99) | |
796 #DEFINE hide_digit2 CVT_flags1,3 ; =1: do not print digits 5-2 (clip output at 9) | |
797 #DEFINE omit_digit_1 CVT_flags1,4 ; =1: do not print digit 1 (show output as xxxx-) | |
798 #DEFINE omit_digit_2 CVT_flags1,5 ; =1: do not print digits 2-1 (show output as xxx--) | |
631 | 799 ; CVT_flags1,6 ; --- unused |
623 | 800 ; CVT_flags1,7 ; --- unused |
0 | 801 |
634 | 802 #DEFINE decimal_digit1 CVT_flags2,0 ; =1: put a decimal point in front of digit 1 |
803 #DEFINE decimal_digit2 CVT_flags2,1 ; =1: put a decimal point in front of digit 2 | |
804 #DEFINE decimal_digit3 CVT_flags2,2 ; =1: put a decimal point in front of digit 3 | |
805 ; CVT_flags2,3 ; --- unused | |
806 #DEFINE leftbind CVT_flags2,4 ; =1: align output to the left (no leading spaces) | |
807 #DEFINE leading_zeros CVT_flags2,5 ; =1: print leading zeros | |
808 #DEFINE output_overflow CVT_flags2,6 ; =1: the printed number is clipped to 9999/999/99/9 | |
809 ; CVT_flags2,7 ; --- unused | |
623 | 810 |
811 | |
631 | 812 ;---- Miscellaneous Flags |
623 | 813 #DEFINE ignore_last_edited_gas misc_flags,0 ; =1: ignore last edited gas while cleaning up gas/dil list |
814 #DEFINE copying_dil misc_flags,1 ; =1: copying a diluent | |
631 | 815 #DEFINE comm_service_mode misc_flags,2 ; =1: service mode (extended command set) is enabled |
816 #DEFINE waypoint_reached_first misc_flags,3 ; =1: the first (most outside) waypoint is reached (cave mode) | |
817 #DEFINE waypoint_reached_last misc_flags,4 ; =1: the last (most inside) waypoint is reached (cave mode) | |
634 | 818 #DEFINE option_value_ok misc_flags,5 ; =1: option value was checked to be within min/max limits |
819 #DEFINE aux_flag misc_flags,6 ; local flag, used in various places | |
820 #DEFINE neg_flag misc_flags,7 ; =1: result is negative | |
821 | |
623 | 822 |
823 ;---- HUD Status Byte (stored in access RAM) | |
604 | 824 #DEFINE hud_connection_ok hud_status_byte,0 ; =1 HUD connection ok |
825 ; hud_status_byte,1 ; =1 HUD is calibrated | |
623 | 826 ; hud_status_byte,2 ; =1 HUD battery is low (< 3000 mV) |
604 | 827 #DEFINE sensor1_active hud_status_byte,3 ; =1: sensor 1 is active |
828 #DEFINE sensor2_active hud_status_byte,4 ; =1: sensor 2 is active | |
829 #DEFINE sensor3_active hud_status_byte,5 ; =1: sensor 3 is active | |
830 ; hud_status_byte,6 ; --- unused in stand-alone HUD | |
831 ; hud_status_byte,7 ; --- unused in stand-alone HUD | |
0 | 832 |
582 | 833 |
634 | 834 ;----------------------------------------------------------------------------- |
835 ; Macros | |
836 ;----------------------------------------------------------------------------- | |
582 | 837 |
634 | 838 ; ---- options checking |
631 | 839 |
623 | 840 TSTOSS macro opt_reg ; TeST Option Skip next instruction if Set (not zero) |
631 | 841 movff opt_reg,EEDATA ; Attention: destroys EEDATA! |
842 tstfsz EEDATA,A ; Attention: must be followed by a plain machine | |
623 | 843 bra $+4 ; command, do not let follow a macro! |
844 endm ; | |
845 | |
846 TSTOSC macro opt_reg ; TeST Option Skip next instruction if Clear (zero) | |
631 | 847 movff opt_reg,EEDATA ; Attention: destroys EEDATA! |
848 tstfsz EEDATA,A ; Attention: must be followed by a plain machine | |
623 | 849 endm ; command, do not let follow a macro! |
850 | |
851 | |
634 | 852 ; ---- literal operations |
631 | 853 |
854 CLRI macro address ; CLeaR Integer (version of clrf for 2 byte integers) | |
855 clrf address+0 ; Attention: must be in bank where target variable resides! | |
856 clrf address+1 ; | |
857 endm ; | |
858 | |
859 CLRT macro address ; CLeaR Three byte integer (version of clrf for 3 byte integers) | |
860 clrf address+0 ; Attention: must be in bank where target variable resides! | |
861 clrf address+1 ; | |
862 clrf address+2 ; | |
623 | 863 endm ; |
864 | |
631 | 865 CLRR macro address,range ; CLeaR a Range of bytes (version of clrf for 1-256 bytes) |
866 movlw low(range) ; initialize loop counter | |
867 lfsr FSR1,address ; set start address | |
868 extern memory_clear | |
869 call memory_clear | |
870 endm | |
623 | 871 |
631 | 872 SETI macro address ; SET Integer (version of setf for 2 byte integers) |
873 setf address+0 ; Attention: must be in bank where target variable resides! | |
874 setf address+1 ; | |
623 | 875 endm ; |
876 | |
631 | 877 MOVLI macro literal,address ; MOVe Literal to Integer |
878 movlw LOW (literal) ; Attention: destroys WREG! | |
879 movwf address+0 ; Attention: must be in bank where target variable resides! | |
880 movlw HIGH (literal) ; | |
881 movwf address+1 ; | |
623 | 882 endm ; |
883 | |
884 | |
634 | 885 ; ---- arithetics |
631 | 886 |
887 INCI macro address ; INCrement Integer (version of incf for 2 byte integers) | |
888 infsnz address+0,F ; Attention: must be in bank where target variable resides! | |
889 incf address+1,F ; | |
623 | 890 endm ; |
891 | |
631 | 892 DECI macro address ; DECrement Integer (version of decf for 2 byte integers) |
623 | 893 movlw .1 ; Attention: destroys WREG! |
631 | 894 subwf address+0,F ; Attention: must be in bank where target variable resides! |
623 | 895 movlw .0 ; |
631 | 896 subwfb address+1,F ; |
897 endm ; | |
898 | |
899 ADDLI macro literal, address ; ADD Literal to Integer | |
900 movlw LOW (literal) ; Attention: destroys WREG! | |
901 addwf address+0,F ; Attention: must be in bank where target variable resides! | |
902 movlw HIGH (literal) ; | |
903 addwfc address+1,F ; | |
904 endm ; | |
905 | |
906 SUBLI macro literal, address ; SUBtract Literal from Integer | |
907 movlw LOW (literal) ; Attention: destroys WREG! | |
908 subwf address+0,F ; Attention: must be in bank where target variable resides! | |
909 movlw HIGH (literal) ; | |
910 subwfb address+1,F ; | |
623 | 911 endm ; |
912 | |
913 | |
634 | 914 ; ---- moves |
631 | 915 |
916 MOVCC macro from,to ; MOVe 1 byte Char (actually an alias for movff) | |
917 movff from,to | |
918 endm | |
919 | |
920 MOVII macro from,to ; MOVe 2 byte Integer (version of movff for 2 bytes) | |
921 movff from+0,to+0 ; copy 1st byte | |
922 movff from+1,to+1 ; copy 2nd byte | |
623 | 923 endm ; |
924 | |
631 | 925 MOVTT macro from,to ; MOVe Three byte Integer (version of movff for 3 bytes) |
926 movff from+0,to+0 ; copy 1st byte | |
927 movff from+1,to+1 ; copy 2nd byte | |
928 movff from+2,to+2 ; copy 3rd byte | |
929 endm ; | |
930 | |
931 MOVRR macro from,to,range ; MOVe a Range of bytes (version of movff for 1-256 bytes) | |
932 movlw low(range) ; initialize loop counter | |
933 lfsr FSR1,from ; from | |
934 lfsr FSR2,to ; to | |
935 extern memory_move | |
936 call memory_move | |
937 endm | |
938 | |
623 | 939 |
634 | 940 ; ---- ISR-safe moves |
623 | 941 |
631 | 942 SMOVII macro from, to ; isr-Safe MOVe 2 byte Integer (version of MOVII for ISR-safe copying) |
623 | 943 local retry ; |
944 retry: | |
945 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
946 movff from+0,to+0 ; copy low byte | |
947 movff from+1,to+1 ; copy high byte | |
948 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
949 bra retry ; YES - retry copy | |
950 endm ; NO - done | |
951 | |
631 | 952 SMOVTT macro from, to ; isr-Safe MOVe Three byte integer (version of MOVTT for ISR-safe copying) |
623 | 953 local retry ; |
954 retry: | |
955 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
956 movff from+0,to+0 ; copy low byte | |
957 movff from+1,to+1 ; copy high byte | |
958 movff from+2,to+2 ; copy upper byte | |
959 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
960 bra retry ; YES - retry copy | |
961 endm ; NO - done | |
962 | |
631 | 963 SMOVQQ macro from, to ; isr-Safe MOVe Quad byte integer (version of MOVII for ISR-safe copying) |
623 | 964 local retry ; |
965 retry: | |
966 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
967 movff from+0,to+0 ; copy byte 0 (LSB) | |
968 movff from+1,to+1 ; copy byte 1 | |
969 movff from+2,to+2 ; copy byte 2 | |
970 movff from+3,to+3 ; copy byte 3 (MSB) | |
971 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
972 bra retry ; YES - retry copy | |
973 endm ; NO - done | |
974 | |
975 SMOVSS macro from, to ; isr-Safe MOVe Six byte integer to integer (version of MOVII for integers updated in ISR) | |
976 local retry ; | |
977 retry: | |
978 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
979 movff from+0,to+0 ; copy byte 0 (LSB) | |
980 movff from+1,to+1 ; copy byte 1 | |
981 movff from+2,to+2 ; copy byte 2 | |
982 movff from+3,to+3 ; copy byte 3 | |
983 movff from+4,to+4 ; copy byte 4 | |
984 movff from+5,to+5 ; copy byte 5 (MSB) | |
985 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
986 bra retry ; YES - retry copy | |
987 endm ; NO - done | |
988 | |
582 | 989 |
634 | 990 ;----------------------------------------------------------------------------- |
991 ; C-Code Routines | |
992 ;----------------------------------------------------------------------------- | |
582 | 993 |
994 extern deco_calc_desaturation_time | |
995 extern deco_calc_hauptroutine | |
604 | 996 extern deco_calc_dive_interval |
582 | 997 extern deco_calc_dive_interval_1min |
998 extern deco_calc_dive_interval_10min | |
999 extern deco_clear_tissue | |
623 | 1000 extern deco_init_output_vars |
582 | 1001 extern deco_pull_tissues_from_vault |
1002 extern deco_push_tissues_to_vault | |
560 | 1003 |
1004 | |
634 | 1005 ;----------------------------------------------------------------------------- |
1006 ; Bank0 ACCESS RAM | |
1007 ;----------------------------------------------------------------------------- | |
623 | 1008 |
1009 ; Variables located in the Access Bank are declared in hwos.asm | |
1010 | |
634 | 1011 ifndef INSIDE_HWOS_ASM |
623 | 1012 |
1013 extern HW_descriptor | |
1014 extern HW_variants | |
1015 | |
628 | 1016 extern HW_flags_state1 |
1017 extern HW_flags_state2 | |
623 | 1018 |
1019 extern OS_flags_persist | |
1020 extern OS_flags_ISR1 | |
1021 extern OS_flags_ISR2 | |
1022 | |
1023 extern OM_flags_mode | |
1024 | |
1025 extern DM_flags_deco | |
1026 | |
1027 extern cpu_speed_request | |
1028 extern cpu_speed_state | |
1029 | |
1030 extern timebase | |
1031 extern eventbase | |
604 | 1032 |
623 | 1033 extern isr_timeout_timer |
1034 extern isr_timeout_reload | |
1035 | |
1036 extern total_divetime_secs | |
1037 extern counted_divetime_mins | |
1038 extern counted_divetime_secs | |
1039 | |
1040 extern apnoe_surface_secs | |
1041 extern apnoe_surface_mins | |
1042 extern apnoe_dive_secs | |
1043 extern apnoe_dive_mins | |
1044 | |
1045 extern sampling_rate | |
1046 extern sampling_timer | |
1047 | |
1048 extern simulatormode_depth | |
1049 | |
1050 extern hud_status_byte | |
1051 extern hud_battery_mv | |
1052 | |
634 | 1053 extern battery_capacity_internal |
1054 extern battery_capacity | |
1055 extern battery_offset | |
1056 extern battery_type | |
1057 extern battery_accumulated_charge | |
1058 extern battery_temperature | |
1059 extern gauge_status_byte | |
1060 | |
631 | 1061 endif ; ACCESS_RAM_VARS |
623 | 1062 |
634 | 1063 ;----------------------------------------------------------------------------- |
1064 ; Bank0 NORMAL RAM | |
1065 ;----------------------------------------------------------------------------- | |
1066 | |
623 | 1067 isr_backup equ 0x060 ; Alias for "banksel isr_backup" |
1068 isr_backup udata_ovr isr_backup ; Bank 0 ISR data | |
604 | 1069 |
631 | 1070 ;---- Backup for general Registers, used by ISR Routines |
623 | 1071 PROD_backup res 2 |
1072 FSR0_backup res 2 | |
1073 BSR_backup res 1 | |
1074 | |
631 | 1075 ;---- Multi-Purpose Registers, used by ISR Routines |
623 | 1076 isr_mpr res 2 ; used in ms5541.asm and isr.asm |
631 | 1077 #DEFINE isr_lo isr_mpr+0 ; ... |
1078 #DEFINE isr_hi isr_mpr+1 ; ... | |
1079 | |
1080 ;---- Multi-Purpose Registers, NOT USED by ISR Routines | |
1081 backup_mpr res 2 ; used in rtc.asm | |
1082 #DEFINE backup_lo backup_mpr+0 | |
1083 #DEFINE backup_hi backup_mpr+1 | |
1084 | |
623 | 1085 |
1086 ;---- Time and Date - Real Time Clock | |
1087 rtc_year res 1 ; running year | Attention: | |
1088 rtc_month res 1 ; running month | do not change | |
1089 rtc_day res 1 ; running day | the Position of | |
1090 rtc_hour res 1 ; running hour | these Variables | |
1091 rtc_mins res 1 ; running minute | relative to | |
1092 rtc_secs res 1 ; running second | each other! | |
582 | 1093 |
623 | 1094 rtc_latched_year res 1 ; latched year | Attention: |
1095 rtc_latched_month res 1 ; latched month | do not change | |
1096 rtc_latched_day res 1 ; latched day | the Position of | |
1097 rtc_latched_hour res 1 ; latched hour | these Variables | |
1098 rtc_latched_mins res 1 ; latched minute | relative to | |
1099 rtc_latched_secs res 1 ; latched second | each other! | |
1100 | |
1101 ;--- RTC-independent Timebase | |
1102 timebase_mins res 1 ; RTC-independent timer for generating the every hour trigger | |
1103 timebase_secs res 1 ; RTC-independent timer for generating the every minute trigger | |
1104 | |
1105 ;---- other Timers | |
1106 uptime res 4 ; [sec] uptime of the OSTC since last cold start | |
629 | 1107 surface_interval_secs res 4 ; [sec] surface interval counted in seconds |
1108 surface_interval_mins res 2 ; [min] surface interval counted in minutes | |
623 | 1109 simulator_time res 1 ; [min] real runtime of the simulator |
1110 | |
1111 ;---- Data for Pressure and Temperature Calculation (MS5541) | |
1112 clock_count res 1 ; I2C clock pulse counter | |
1113 sensor_state_counter res 1 ; counter for pressure sensor state machine | |
1114 dLSB res 1 ; pressure sensor interface, LSB | |
1115 dMSB res 1 ; pressure sensor interface, MSB | |
1116 dbuffer res 1 ; pressure sensor interface, RX/TX buffer | |
582 | 1117 |
604 | 1118 C1 res 2 ; decoded calibration data |
623 | 1119 C2 res 2 ; decoded calibration data |
1120 C3 res 2 ; decoded calibration data | |
1121 C4 res 2 ; decoded calibration data, here C4-250 | |
1122 C5 res 2 ; decoded calibration data, here reference temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) | |
1123 C6 res 2 ; decoded calibration data | |
582 | 1124 D1 res 2 ; raw pressure |
1125 D2 res 2 ; raw temperature | |
1126 xdT res 2 | |
1127 xdT2 res 2 | |
1128 OFF res 2 | |
1129 SENS res 2 | |
623 | 1130 |
1131 temperature_cur res 2 ; current temperature | |
1132 temperature_min res 2 ; minimum temperature (operated by divemode.asm) | |
1133 temperature_avg res 2 ; internal register used for averaging | |
1134 temperature_last res 2 ; internal register used for detecting changes | |
1135 | |
1136 pressure_abs res 2 ; current absolute pressure | |
1137 pressure_abs_avg res 2 ; internal register used for averaging | |
1138 pressure_abs_last res 2 ; internal register used for detecting pressure changes | |
1139 | |
1140 pressure_abs_sampled res 2 ; sampled surface pressure, sampled in sleep mode every 15 minutes | |
1141 pressure_abs_ref res 2 ; reference surface pressure, surface pressure sampled 15 minutes ago | |
1142 pressure_surf res 2 ; surface pressure used by ISR to calculate relative pressures | |
1143 | |
1144 pressure_rel_cur res 2 ; current relative pressure | |
1145 pressure_rel_max res 2 ; maximum relative pressure | |
1146 pressure_rel_sim res 2 ; simulated relative pressure (simulator mode) | |
582 | 1147 |
604 | 1148 ;---- Data for ISR Math Subroutines |
623 | 1149 isr_xA res 2 ; multiplicand 1 |
1150 isr_xB res 2 ; multiplicand 2 | |
1151 isr_xC res 4 ; resulting product | |
582 | 1152 |
604 | 1153 ;---- Display Brightness |
623 | 1154 ambient_light res 2 ; ambient light level |
604 | 1155 max_CCPR1L res 1 ; max. brightness value for CCPR1L |
582 | 1156 |
604 | 1157 ;---- Battery Gauge (nAs, nC) |
1158 battery_gauge res 6 ; 48 bit -> 78 Ah max | |
582 | 1159 |
604 | 1160 ;---- IR/S8-Link |
623 | 1161 ir_s8_buffer res .18 ; buffer for data received on IR/S8 interface, |
1162 ; also used to buffer MS5541 raw calibration data | |
1163 | |
1164 IFDEF _external_sensor | |
582 | 1165 ir_s8_counter res 1 |
604 | 1166 ir_s8_timeout res 1 ; timeout for valid data |
623 | 1167 ENDIF |
582 | 1168 |
623 | 1169 ;---- raw O2 Sensor Data received on S8 Link |
1170 IFDEF _external_sensor | |
1171 s8_rawdata_sensor1 res 3 ; 24 bit A/D raw data from S8 HUD sensor 1 | |
1172 s8_rawdata_sensor2 res 3 ; 24 bit A/D raw data from S8 HUD sensor 2 | |
1173 s8_rawdata_sensor3 res 3 ; 24 bit A/D raw data from S8 HUD sensor 3 | |
1174 ENDIF | |
582 | 1175 |
623 | 1176 ;---- Switch Processing (8 byte, called by ISR and sleep mode) |
1177 analog_sw1_raw res 2 ; idle values (average) | |
1178 analog_sw2_raw res 2 ; idle values (average) | |
1179 analog_counter res 1 ; for averaging | |
1180 analog_sw1 res 1 ; analog value for switch 1 | |
1181 analog_sw2 res 1 ; analog value for switch 2 | |
1182 button_polarity res 1 ; 0xFF (both normal), 0x00 (both inverted), 0x01 (left inverted only), 0x02 (right inverted only) | |
582 | 1183 |
631 | 1184 |
623 | 1185 ;--- resettable min and max Depth Option |
1186 IFDEF _min_depth_option | |
1187 pressure_rel_min_trip res 2 ; resettable minimum relative pressure | |
1188 pressure_rel_max_trip res 2 ; resettable maximum relative pressure | |
1189 ENDIF | |
582 | 1190 |
631 | 1191 ; 143 byte used, 17 byte free |
560 | 1192 |
634 | 1193 |
1194 ;----------------------------------------------------------------------------- | |
1195 ; Common DATA | |
1196 ;----------------------------------------------------------------------------- | |
1197 | |
623 | 1198 common equ 0x100 ; Alias for "banksel common" |
1199 common udata_ovr common ; Bank 1 general variables | |
582 | 1200 |
623 | 1201 ;---- Multi-Purpose Register for Data Storage and Interface with Conversion and Display Functions (6 byte) |
1202 mpr res 6 ; will be used as base address of 1, 2, 3, 4 and 6 byte buffers | |
1203 #DEFINE lo mpr+0 ; nickname for "low" | |
1204 #DEFINE hi mpr+1 ; nickname for "high" | |
1205 #DEFINE up mpr+2 ; nickname for "upper" | |
1206 #DEFINE ex mpr+3 ; nickname for "extra" | |
1207 #DEFINE ul mpr+4 ; nickname for "ultra" | |
1208 #DEFINE hy mpr+5 ; nickname for "hyper" | |
1209 | |
582 | 1210 |
623 | 1211 ;---- Flags - Menu System (2 byte) |
1212 MS_flags_control res 1 ; menu system - control | |
1213 MS_flags_imprint res 1 ; menu system - data imprinting | |
582 | 1214 |
634 | 1215 ;---- Flags - Dive Mode (21 byte) |
623 | 1216 DM_flags_state res 1 ; dive mode - dive states |
1217 DM_flags_sensor res 1 ; dive mode - O2 sensors | |
631 | 1218 DM_flags_request res 1 ; dive mode - user requests / general |
623 | 1219 DM_flags_event res 1 ; dive mode - data recording events |
1220 DM_flags_layout1 res 1 ; dive mode - display control / layout (1) | |
1221 DM_flags_layout2 res 1 ; dive mode - display control / layout (2) | |
631 | 1222 DM_flags_layout3 res 1 ; dive mode - display control / layout (3) |
623 | 1223 DM_flags_message res 1 ; dive mode - display control / messages |
1224 DM_flags_gas_dil res 1 ; dive mode - display control / gas, diluent | |
634 | 1225 DM_flags_advc_det res 1 ; dive mode - advices detected |
1226 DM_flags_advc_ack res 1 ; dive mode - advices acknowledged | |
1227 DM_flags_att1_det res 1 ; dive mode - attentions detected (1) | |
1228 DM_flags_att2_det res 1 ; dive mode - attentions detected (2) | |
1229 DM_flags_att3_det res 1 ; dive mode - attentions detected (3) | |
1230 DM_flags_att1_ack res 1 ; dive mode - attentions acknowledged (1) | |
1231 DM_flags_att2_ack res 1 ; dive mode - attentions acknowledged (2) | |
1232 DM_flags_att3_ack res 1 ; dive mode - attentions acknowledged (3) | |
1233 DM_flags_war1_det res 1 ; dive mode - warnings detected (1) | |
1234 DM_flags_war2_det res 1 ; dive mode - warnings detected (2) | |
1235 DM_flags_war1_ack res 1 ; dive mode - warnings acknowledged (1) | |
1236 DM_flags_war2_ack res 1 ; dive mode - warnings acknowledged (2) | |
1237 DM_flags_shown1 res 1 ; dive mode - custom views shown (1) | |
1238 DM_flags_shown2 res 1 ; dive mode - custom views shown (2) | |
1239 DM_flags_shown3 res 1 ; dive mode - custom views shown (3) | |
623 | 1240 |
1241 ;---- Miscellaneous Flags (1 byte) | |
1242 misc_flags res 1 | |
1243 | |
634 | 1244 ;---- Interface to Graphic Functions (11 byte) |
582 | 1245 win_leftx2 res 1 |
1246 win_top res 1 | |
1247 win_width res 2 | |
1248 win_height res 1 | |
623 | 1249 win_bargraph res 1 ; width of the bargraph bar |
1250 win_color1 res 1 ; 2 byte color | |
1251 win_color2 res 1 ; 2 byte color | |
1252 win_color3 res 1 ; 3 byte color used for display 2 | |
1253 win_color4 res 1 ; 3 byte color used for display 2 | |
1254 win_color5 res 1 ; 3 byte color used for display 2 | |
560 | 1255 |
623 | 1256 ;---- Interface to Math Functions (16 byte) |
582 | 1257 divA res 2 |
1258 xA res 2 | |
1259 xB res 2 | |
623 | 1260 xC res 4 |
582 | 1261 sub_a res 2 |
1262 sub_b res 2 | |
623 | 1263 sub_c res 2 |
582 | 1264 |
631 | 1265 ;---- Menu System and Views (5 byte) |
623 | 1266 menu_pos_cur res 1 ; current position in main menu |
1267 menu_pos_max res 1 ; highest position in main menu | |
1268 active_premenu res 1 ; currently shown pre-menu (0: none) | |
631 | 1269 active_customview res 1 ; currently shown custom view |
1270 backup_customview res 1 ; previously shown custom view | |
623 | 1271 |
1272 ;---- Miscellaneous (6 byte) | |
1273 batt_voltage res 2 ; battery voltage in mV (no ISR involved) | |
1274 batt_percent res 1 ; battery in percent (1-100%) | |
604 | 1275 message_counter res 1 ; counts amount of messages |
623 | 1276 message_page res 1 ; current message page number |
604 | 1277 pairing_slot res 1 ; slot number, used in transmitter pairing |
1278 | |
634 | 1279 |
631 | 1280 ;---- Dive Mode / all modes (26 byte) |
623 | 1281 divesecs_avg_trip res 2 ; time accumulator for the resettable average depth & stopwatch |
1282 divesecs_avg_total res 2 ; time accumulator for the total dive average depth | |
1283 pressure_rel_avg_trip res 2 ; calculated resettable average depth | |
1284 pressure_rel_avg_total res 2 ; calculated total dive average depth | |
1285 pressure_rel_cur_cached res 2 ; cached current relative pressure | |
1286 pressure_rel_max_cached res 2 ; cached maximum relative pressure | |
1287 pressure_abs_cached res 2 ; cached current absolute pressure | |
1288 pressure_abs_10 res 2 ; cached current absolute pressure divided by 10 | |
1289 depth_meter res 1 ; current depth in meters | |
1290 safety_stop_countdown res 1 ; counter for safety stop | |
1291 dive_timeout_timer res 2 ; timeout timer for leaving dive mode after surfacing | |
582 | 1292 gaslist_gas res 1 ; used for transfer between gaslist.asm and menu_tree.asm |
604 | 1293 best_gas_number res 1 ; number of the "best gas": 0= none found, 1-5= gases 1-5, 255= not computed |
623 | 1294 active_gas res 1 ; the currently used OC/bailout gas (1-5) |
1295 | |
1296 IFDEF _ccr_pscr | |
604 | 1297 best_dil_number res 1 ; number of the "best dil": 0= none found, 1-5= dils 1-5, 255= not computed |
1298 active_dil res 1 ; the currently used diluent (1-5) | |
623 | 1299 ENDIF |
1300 | |
631 | 1301 IFDEF _cave_mode |
1302 DM_flags_cavereq res 1 ; dive mode - user requests / cave mode | |
1303 backtrack_deltatime res 1 ; time elapsed since last depth recording in seconds | |
1304 backtrack_waypoint_num res 1 ; current waypoint number | |
1305 backtrack_waypoint_turn res 1 ; waypoint number of the turn point | |
1306 ENDIF | |
1307 | |
623 | 1308 ;---- Dive Mode / apnoe mode (2 byte) |
1309 apnoe_max_pressure res 2 ; max depth over all dives in the series | |
560 | 1310 |
623 | 1311 ;---- Profile Recording (6 byte) |
634 | 1312 alarm_type res 1 ; alarm states recording |
1313 event_byte1 res 1 ; events recording | |
1314 event_byte2 res 1 ; events recording | |
623 | 1315 CNS_start res 2 ; CNS value at beginning of dive |
560 | 1316 |
631 | 1317 ;---- External Flash (14 byte) |
582 | 1318 ext_flash_address res 3 ; 24 bit address |
631 | 1319 ext_flash_length_counter res 3 ; 24 bit length counter |
582 | 1320 ext_flash_log_pointer res 3 ; 24 bit address for logbook profile storing |
1321 ext_flash_end_pointer res 3 ; 24 bit address for logbook profile storing | |
631 | 1322 ext_flash_rw res 1 ; transfer register for data read / write |
634 | 1323 ext_flash_address_limit res 1 ; wrap-around threshold while address incrementing |
560 | 1324 |
1325 | |
634 | 1326 ;------------------------------------------------------------------------------- |
1327 ; private Variables - do not access from outside of the respective source files! | |
1328 ;------------------------------------------------------------------------------- | |
560 | 1329 |
634 | 1330 ;---- aa_wordprocessor.asm, strings.asm & Co. |
623 | 1331 AA_flags res 1 ; various flags for aa_wordprocessor and strings |
582 | 1332 aa_bitlen res 1 ; count of pixels when decoding bitmaps |
623 | 1333 aa_start res 2 ; PROM pointer to start of encoded bitmap |
582 | 1334 aa_end res 2 ; and end of it |
1335 aa_temp res 2 ; current color, divided by 2 or 4 | |
634 | 1336 font_color res 1 ; selected font color |
1337 font_size res 1 ; selected font size | |
1338 pallet_color_mask res 1 ; pallet color - mask | Attention: | |
1339 pallet_color_disabled res 1 ; pallet color - disabled | do not change | |
1340 pallet_color_memo res 1 ; pallet color - memo | the relative | |
1341 pallet_color_advice res 1 ; pallet color - advice | position of | |
1342 pallet_color_attention res 1 ; pallet color - attention | these vars! | |
1343 pallet_color_warning res 1 ; pallet color - warning | | |
1344 | |
582 | 1345 |
1346 ;--- adc_lightsensor.asm | |
623 | 1347 get_bat_volt_counter res 1 ; counter for reading the charger chip |
582 | 1348 |
1349 ;---- convert.asm | |
623 | 1350 CVT_flags1 res 1 |
1351 CVT_flags2 res 1 | |
634 | 1352 bcd_lo res 1 |
1353 bcd_hi res 1 | |
1354 bcd_up res 1 | |
1355 bin_lo res 1 | |
1356 bin_hi res 1 | |
582 | 1357 |
1358 ;---- color_processor.asm | |
623 | 1359 overall_pixels res 3 ; used by color_processor.asm |
1360 pixel_count res 2 ; used by color_processor.asm | |
1361 encoding_format res 1 ; image encoding format | |
1362 | |
1363 ;---- compass_ops.asm | |
1364 compass_flags res 1 ; flags are defined in compass_ops.asm | |
582 | 1365 |
1366 ;---- comm.asm | |
623 | 1367 comm_timeout_timer res 1 ; timeout for communication |
582 | 1368 |
1369 ;---- eeprom_rs232.asm | |
631 | 1370 eeprom_loop res 1 ; loop counter (actually used in flash and serial, too) |
634 | 1371 rx_timeout_tmr5h_load res 1 ; TMR5H load value for RS232 RX timeout |
582 | 1372 |
1373 ;---- i2c.asm | |
1374 i2c_temp1 res 1 ; temporary data | |
1375 i2c_temp2 res 1 ; temporary data | |
1376 | |
623 | 1377 ;---- math.asm |
1378 math_loop res 1 ; loop counter | |
1379 | |
582 | 1380 ;---- menu_processor.asm |
623 | 1381 menustack_pointer res 1 ; pointer to menu stack |
634 | 1382 menu_item_start res 1 ; index of the first menu item (scrolling) |
1383 menu_item_curr res 1 ; index of the current menu item (loop counter) | |
1384 menu_item_count res 1 ; total number of menu items | |
582 | 1385 selected_item res 1 ; index of the current item |
634 | 1386 menu_title_addr res 2 ; address of the multi-lingual menu titel |
1387 menu_item_data_start res 3 ; base address of the menu item data blocks | |
1388 menu_vertical_start res 1 ; vertical start position of 1st menu item | |
1389 item_type res 1 ; type of the menu item | |
1390 item_title_addr res 2 ; address of item title function or title text | |
1391 item_funct_addr res 2 ; address of item call function or option definition data | |
1392 | |
582 | 1393 |
1394 ;---- options.asm | |
634 | 1395 #DEFINE opt_definition_bytes .12 ; | Attention: do not change the relative position of these vars! |
631 | 1396 opt_type res 1 ; | option type |
1397 opt_serial res 1 ; | index used for option read/write via RS232 | |
634 | 1398 opt_inc res 1 ; | increment value, also used for enum low and low (pointer to default string) |
1399 opt_min res 1 ; | minimum value, also used for enum high and high(pointer to default string) | |
1400 opt_max res 1 ; | maximum value, also used for length( default string) | |
631 | 1401 opt_default res 1 ; | default value |
1402 opt_unit res 2 ; | pointer to multi-lingual unit text | |
1403 opt_memory res 2 ; | pointer to memory position | |
1404 opt_eeprom_index res 1 ; | pointer to EEPROM position (index) | |
1405 opt_eeprom_bank res 1 ; | pointer to EEPROM position (bank) | |
1406 opt_end_token res 1 ; | =0xFF: end of table reached (does not count into opt_definiton_bytes) | |
1407 | |
582 | 1408 |
1409 ;---- tft.asm | |
623 | 1410 tft_save_top res 1 |
1411 tft_save_height res 1 | |
1412 tft_save_left res 1 | |
1413 tft_save_width res 1 | |
582 | 1414 tft_temp1 res 1 |
1415 tft_temp2 res 1 | |
1416 tft_temp3 res 1 | |
1417 tft_temp4 res 1 | |
1418 | |
623 | 1419 ;---- dump screen Function |
604 | 1420 IFDEF _screendump |
623 | 1421 ds_line res 1 ; current line (0..239) |
1422 ds_column res 1 ; current columnx2 (0..159) | |
1423 ds_pixel res 2 ; current pixel color | |
1424 ds_count res 1 ; repetition count | |
604 | 1425 ENDIF |
1426 | |
582 | 1427 ;---- wait.asm |
1428 wait_counter res 1 | |
1429 | |
634 | 1430 ;---- tft_outputs.asm |
1431 pressure_update_lag_counter res 1 ; lag time counter for fast surface pressure display updating | |
623 | 1432 |
634 | 1433 |
1434 ; 200 byte used, 8 byte free (208 byte total) | |
582 | 1435 |
1436 | |
634 | 1437 ;----------------------------------------------------------------------------- |
1438 ; LOCAL DATA | |
1439 ;----------------------------------------------------------------------------- | |
1440 | |
582 | 1441 ; Space for various overlayed local data from top-level applications, |
1442 ; i.e. applications that never run in parallel to each other | |
634 | 1443 |
582 | 1444 ; --------------------- local Data Users -------------------------------------- |
623 | 1445 ; |
1446 ; -------------- Applications using ---------------------- | |
582 | 1447 ; Mode local1 local2 local3 |
634 | 1448 ; -------------------------------------------------------------------------- |
582 | 1449 ; sleepmode sleepmode.asm (unused) (unused) |
1450 ; surfmode surfmode.asm* (unused) (unused) | |
628 | 1451 ; simulator divemode.asm divemode.asm simulator.asm |
604 | 1452 ; divemode divemode.asm divemode.asm ghostwriter.asm |
623 | 1453 ; logbook logbook.asm logbook.asm logbook.asm |
582 | 1454 ; |
1455 ; * assigned to this slot, but currently no local memory used | |
1456 | |
1457 local1 equ 0x1D0 ; Alias for CBLOCK directive | |
1458 local1 udata_ovr 0x1D0 ; Bank1 shared local space | |
1459 res 0x10 ; 16 Byte (0x1D0 ... 0x1DF) | |
1460 | |
1461 local2 equ 0x1E0 ; Alias for CBLOCK directive | |
1462 local2 udata_ovr 0x1E0 ; Bank1 shared local space | |
1463 res 0x10 ; 16 Byte (0x1E0 ... 0x1EF) | |
1464 | |
1465 local3 equ 0x1F0 ; Alias for CBLOCK directive | |
1466 local3 udata_ovr 0x1F0 ; Bank1 shared local space | |
1467 res 0x10 ; 16 Byte (0x1F0 ... 0x1FF) | |
1468 | |
1469 | |
634 | 1470 ;----------------------------------------------------------------------------- |
1471 ; Common2 DATA | |
1472 ;----------------------------------------------------------------------------- | |
1473 | |
623 | 1474 common2 equ 0xA00 ; Alias for "banksel common2" |
1475 common2 udata_ovr common2 ; Bank 10 general variables | |
582 | 1476 |
623 | 1477 ;---- Data for Logging (6 byte), sampled in divemode.asm and used in ghostwriter.asm |
1478 start_year res 1 ; year | ATTENTION: | |
1479 start_month res 1 ; month | do not change the | |
1480 start_day res 1 ; day | position of these | |
1481 start_hour res 1 ; hour | variables relative | |
1482 start_mins res 1 ; minute | to each other! | |
1483 start_secs res 1 ; second, not used, for code commonality | | |
582 | 1484 |
623 | 1485 supersat_start res 1 ; leading tissue supersaturation at beginning of the dive |
1486 | |
1487 ;---- O2 Sensors (9 byte, updated by ISR when sensors are connected via datalink) | |
1488 IFDEF _external_sensor | |
1489 sensor1_mv res 2 ; sensor 1 voltage in 0.1 mV steps | |
1490 sensor2_mv res 2 ; sensor 2 voltage in 0.1 mV steps | |
1491 sensor3_mv res 2 ; sensor 3 voltage in 0.1 mV steps | |
1492 sensor1_ppO2 res 1 ; sensor 1 ppO2 in 0.01 bar steps | |
1493 sensor2_ppO2 res 1 ; sensor 2 ppO2 in 0.01 bar steps | |
1494 sensor3_ppO2 res 1 ; sensor 3 ppO2 in 0.01 bar steps | |
1495 ENDIF | |
582 | 1496 |
623 | 1497 ;---- last Dive Statistics (7 byte) |
1498 lastdive_duration res 3 ; byte 0= minutes, low byte, 1= minutes, high byte, 2= seconds | |
1499 lastdive_maxdepth res 2 ; in mbar | |
1500 lastdive_avgdepth res 2 ; in mbar | |
582 | 1501 |
623 | 1502 ;---- Backup of last shown Custom View (2 byte) |
582 | 1503 customview_surfmode res 1 ; storage to remember last selected custom view in surface mode |
1504 customview_divemode res 1 ; storage to remember last selected custom view in dive mode | |
1505 | |
623 | 1506 ;---- Miscellaneous (0 byte) |
1507 ;old_velocity res 4 ; stores the last 4 speeds (8 seconds) in m/min | |
1508 | |
1509 ;---- Menu Processor (8 byte) | |
1510 menustack res 8 ; menu stack | |
582 | 1511 |
628 | 1512 ;---- Graphical Compass (15 byte) |
623 | 1513 xRD res 2 ; virtual compass ruler offset |
1514 xRDr res 2 ; virtual compass ruler offset - right end | |
1515 xRD180 res 2 ; virtual compass ruler offset for the -180 marker | |
1516 xLO res 1 ; lo backup to prevent trashing | |
1517 xHI res 1 ; hi backup to prevent trashing | |
1518 xCM res 1 ; compass bearing relative position | |
1519 compass_heading_new res 2 ; corrected heading (in 1°) : -180 .. 180 | |
1520 compass_heading_shown res 2 ; displayed heading | |
1521 compass_bearing res 2 ; displayed bearing | |
582 | 1522 |
623 | 1523 ;---- Compass Arithmetics (30 byte) |
1524 compass_DX res 2 ; raw data | |
1525 compass_DY res 2 ; raw data | |
1526 compass_DZ res 2 ; raw data | |
1527 accel_DX res 2 ; raw data | |
1528 accel_DY res 2 ; raw data | |
1529 accel_DZ res 2 ; raw data | |
1530 compass_DX_f res 2 ; filtered Data | |
1531 compass_DY_f res 2 ; filtered Data | |
1532 compass_DZ_f res 2 ; filtered Data | |
1533 accel_DX_f res 2 ; filtered Data | |
1534 accel_DY_f res 2 ; filtered Data | |
1535 accel_DZ_f res 2 ; filtered Data | |
631 | 1536 compass_CX_f res 2 ; calibration data (stored via options system) |
1537 compass_CY_f res 2 ; calibration data (stored via options system) | |
1538 compass_CZ_f res 2 ; calibration data (stored via options system) | |
582 | 1539 |
623 | 1540 ;---- temporary Data for Q15 Arithmetics (7 byte, compass_ops.asm, called from C) |
1541 compass_a res 2 ; | |
1542 compass_b res 2 ; | |
1543 compass_r res 3 ; | |
1544 | |
1545 ;---- Data Exchange with TR Co-Processor (50 byte) | |
604 | 1546 IFDEF _rx_functions |
1547 rx_buffer res .48 ; Buffer for RX data (slots 0-7) | |
623 | 1548 rx_firmware_cur_major res 1 ; TR module current firmware, major |
1549 rx_firmware_cur_minor res 1 ; TR module current firmware, minor | |
1550 ENDIF | |
604 | 1551 |
628 | 1552 ;---- SAC Calculation on Pressure Readings 1 & 2 (22 byte) |
623 | 1553 IFDEF _rx_functions |
604 | 1554 pres_accu_1st res 4 ; accumulator for pressure drop in 1/160 bar | ATTENTION: do not |
1555 pres_accu_2nd res 4 ; accumulator for pressure drop in 1/160 bar | change the | |
628 | 1556 time_accu_1st res 2 ; accumulator for reading ages in seconds | position |
604 | 1557 gas__last_1st res 1 ; last gas assignment | of these |
628 | 1558 time_accu_2nd res 2 ; accumulator for reading ages in seconds | variables |
604 | 1559 gas__last_2nd res 1 ; last gas assignment | relative |
1560 pres_last_1st res 2 ; last pressure reading pressure in 1/160 bar | to each | |
1561 pres_last_2nd res 2 ; last pressure reading pressure in 1/160 bar | other! | |
1562 time_last_1st res 2 ; last pressure reading time in seconds | | |
1563 time_last_2nd res 2 ; last pressure reading time in seconds | | |
1564 ENDIF | |
1565 | |
631 | 1566 ; 156 byte used, 100 byte free |
1567 | |
1568 | |
634 | 1569 ;----------------------------------------------------------------------------- |
1570 ; Bank 2 General Purpose Buffer 1 | |
1571 ;----------------------------------------------------------------------------- | |
1572 | |
631 | 1573 ; NOTE: needs to be aligned with a bank (low(buffer)=0) |
1574 | |
1575 buffer udata_ovr 0x200 | |
1576 buffer res .256 ; buffer 1 - string buffer, etc. | |
582 | 1577 |
1578 | |
634 | 1579 ;----------------------------------------------------------------------------- |
1580 ; Bank 11 General Purpose Buffer 2 | |
1581 ;----------------------------------------------------------------------------- | |
1582 | |
1583 ; NOTE: needs to be aligned with a bank (low(buffer)=0) | |
631 | 1584 ; |
1585 ; Remark: this memory block is already allocated in shared_definitions.h for | |
1586 ; use while in dive mode, so we need to make a hard reference here | |
634 | 1587 |
631 | 1588 ;buffer2 udata_ovr 0xB00 |
1589 ;buffer2 res .256 ; buffer 2 - backtracking, flash mirror, etc. | |
582 | 1590 |
631 | 1591 #DEFINE buffer2 0xB00 |
582 | 1592 |
1593 | |
634 | 1594 ;----------------------------------------------------------------------------- |
1595 ; Bank 14 Options Table | |
1596 ;----------------------------------------------------------------------------- | |
1597 | |
623 | 1598 opt_table equ 0xE00 ; Alias for "banksel opt_table" |
1599 opt_table udata_ovr opt_table ; Bank 14 options table | |
582 | 1600 |
623 | 1601 ;---- Gas and Diluent Settings |
604 | 1602 opt_gas_O2_ratio res 5 ; O2 ratios of OC/bailout gases | ATTENTION: |
1603 opt_dil_O2_ratio res 5 ; O2 ratios of diluents | keep relative | |
1604 opt_gas_He_ratio res 5 ; He ratios of OC/bailout gases | positioning of | |
1605 opt_dil_He_ratio res 5 ; He ratios of diluents | all arrays in | |
1606 opt_gas_type res 5 ; OC/bailout gas type: O=Disabled, 1=First, 2=Travel, 3=Deco | this block! | |
1607 opt_dil_type res 5 ; dil type: 0=Disabled, 1=First, 2=Normal | | |
1608 opt_gas_change res 5 ; change depths for OC/Bailout gases | | |
1609 opt_dil_change res 5 ; change depths for diluents | | |
1610 | |
634 | 1611 ;---- Gas 6 Settings |
1612 opt_gas6_O2_ratio res 1 ; gas 6 O2 ratio | ATTENTION: keep relative positioning | |
1613 opt_gas6_He_ratio res 1 ; gas 6 He ratio | of these two variables! | |
1614 | |
1615 ;---- Setpoints Settings | |
623 | 1616 opt_setpoint_cbar res 5 ; setpoints in cbar | ATTENTION: keep relative positioning |
1617 opt_setpoint_change res 5 ; change depth for the setpoints in meter | of these two arrays! | |
582 | 1618 |
623 | 1619 ;---- Dive Mode Settings |
1620 opt_dive_mode res 1 ; main dive/deco mode: =0: OC, =1: CC, =2: Gauge, =3: Apnea, =4: pSCR | |
1621 opt_ccr_mode res 1 ; CCR/pSCR sub mode: =0: fixed/calculated SP, =1: Sensor, =2: Auto SP | |
1622 | |
1623 ;---- custom Text | |
1624 #DEFINE opt_name_length .60 ; custom text string 5 rows with 12 chars | |
1625 opt_name res opt_name_length | |
1626 | |
1627 ;---- various other Settings | |
631 | 1628 opt_fw_version_major res 1 ; firmware version, major | use read-only! |
1629 opt_fw_version_minor res 1 ; firmware version, minor | | |
1630 opt_fw_version_beta res 1 ; firmware version, beta | | |
623 | 1631 opt_surface_interval res 1 ; surface interval, used by deco calculator |
582 | 1632 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full |
1633 opt_salinity res 1 ; 0-5% | |
604 | 1634 opt_language res 1 ; current language: 0=EN, 1=DE, 2=FR, 3=SP |
582 | 1635 opt_units res 1 ; 0:m/°C, 1:ft/°F |
1636 opt_dateformat res 1 ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
634 | 1637 opt_dive_color_scheme res 1 ; dive mode color scheme selection |
582 | 1638 opt_last_stop res 1 ; =3:3m, =4:4m, =5:5m, =6:6m |
604 | 1639 opt_aGF_high res 1 ; alternative GF HIGH |
1640 opt_aGF_low res 1 ; alternative GF LOW | |
582 | 1641 opt_GF_high res 1 ; GF HIGH |
1642 opt_GF_low res 1 ; GF LOW | |
1643 opt_enable_aGF res 1 ; =1: aGF can be selected underwater | |
1644 opt_compass_gain res 1 ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) | |
1645 opt_sampling_rate res 1 ; =1: 10s, =0: 2s | |
1646 opt_pressure_adjust res 1 ; SIGNED char (two's complement), -20/+20mbar max. | |
631 | 1647 opt_safetystop res 1 ; =1: a safety stop is shown |
582 | 1648 opt_calibration_O2_ratio res 1 ; %O2 of calibration gas |
634 | 1649 opt_x_s1 res 2 ; calibration factor (not stored in EEPROM) | keep relative |
1650 opt_x_s2 res 2 ; calibration factor (not stored in EEPROM) | position! | |
1651 opt_x_s3 res 2 ; calibration factor (not stored in EEPROM) | | |
582 | 1652 opt_sensor_fallback res 1 ; NOT USED ANY MORE, KEPT FOR COMPATIBILITY WITH EEPROM IMAGE |
604 | 1653 opt_flip_screen res 1 ; =1: flip the screen |
623 | 1654 opt_cR_button_left res 1 ; left button sensitivity (cR hardware) |
604 | 1655 opt_cR_button_right res 1 ; right button sensitivity (cR hardware) |
631 | 1656 opt_depth_warn res 1 ; =1:do a red blinking warning, =0:default behavior |
1657 opt_vsitext res 1 ; =1:use the depth dependent ascend rate limits | |
582 | 1658 opt_vsigraph res 1 ; =1:draw the graphical VSI bar |
1659 opt_showppo2 res 1 ; =1:always show the ppO2 value in the warning position | |
1660 opt_temperature_adjust res 1 ; SIGNED char (two's complement), -2.0/+2.0 °C max. | |
1661 opt_safety_stop_length res 1 ; [s] | |
1662 opt_safety_stop_start res 1 ; [cbar] | |
1663 opt_safety_stop_end res 1 ; [cbar] | |
1664 opt_safety_stop_reset res 1 ; [cbar] | |
604 | 1665 opt_diveTimeout res 1 ; timeout for dive mode [min] |
582 | 1666 opt_sim_setpoint_number res 1 ; setpoint to use for deco calculation |
631 | 1667 opt_calc_gasvolume res 1 ; calculate OC gas volume needs for ascent |
582 | 1668 opt_sim_use_aGF res 1 ; =0: use GF, =1: use aGF for deco calculation |
1669 opt_enable_IBCD res 1 ; enable IBCD warning | |
1670 opt_sat_multiplier_gf res 1 ; Buhlmann safety factor for GF deco | |
1671 opt_desat_multiplier_gf res 1 ; Buhlmann safety factor for GF deco | |
1672 opt_sat_multiplier_non_gf res 1 ; Buhlmann safety factor for NON-GF deco | |
1673 opt_desat_multiplier_non_gf res 1 ; Buhlmann safety factor for NON-GF deco | |
604 | 1674 opt_2ndDepthDisp res 1 ; =1: show average depth instead of max depth |
623 | 1675 opt_max_depth res 1 ; depth at which a warning will be given |
631 | 1676 opt_store_apnoe res 1 ; =1: store dives in apnoe mode into logbook |
623 | 1677 opt_tissue_graphics res 1 ; =0: show N2 and He pressures, =1: show pressures and saturations |
1678 opt_logoffset_step res 1 ; step size when adjusting log offset | |
1679 opt_layout res 1 ; initial layout of dive mode screen | |
631 | 1680 opt_ext_stops res 1 ; =1: place gas switches also below 1st stop depth |
1681 opt_s8_mode res 1 ; S8 mode - analog / digital | |
1682 opt_gas_contingency_sim res 1 ; =1: deco calculator: switch to alternative gas if best gas is used up | |
1683 opt_gas_contingency_dive res 1 ; =1: real dive mode: switch to alternative gas if best gas is used up | |
1684 opt_cave_mode res 1 ; =1: cave mode switched on | |
634 | 1685 opt_gas_density_check res 1 ; =1: gas density is checked (effective in CCR / pSCR modes only) |
1686 opt_comm_timeout res 1 ; comm RX timeout in multiples of 10 ms | |
1687 opt_fallback res 1 ; unused dummy option for compatibility with 3rd party tools | |
1688 opt_conservatism res 1 ; unused dummy option for compatibility with 3rd party tools | |
604 | 1689 |
623 | 1690 ;---- RX Function Settings |
604 | 1691 opt_transmitter_id_1 res 2 ; 16 bit transmitter ID for Gas 1 |
1692 opt_transmitter_id_2 res 2 ; 16 bit transmitter ID for Gas 2 | |
1693 opt_transmitter_id_3 res 2 ; 16 bit transmitter ID for Gas 3 | |
1694 opt_transmitter_id_4 res 2 ; 16 bit transmitter ID for Gas 4 | |
1695 opt_transmitter_id_5 res 2 ; 16 bit transmitter ID for Gas 5 | |
1696 opt_transmitter_id_6 res 2 ; 16 bit transmitter ID for Dil 1 | |
1697 opt_transmitter_id_7 res 2 ; 16 bit transmitter ID for Dil 2 | |
1698 opt_transmitter_id_8 res 2 ; 16 bit transmitter ID for Dil 3 | |
1699 opt_transmitter_id_9 res 2 ; 16 bit transmitter ID for Dil 4 | |
1700 opt_transmitter_id_10 res 2 ; 16 bit transmitter ID for Dil 5 | |
1701 opt_TR_mode res 1 ; TR functions - mode | |
1702 opt_TR_1st_pres res 1 ; TR functions - 1st pressure assignment | |
1703 opt_TR_2nd_pres res 1 ; TR functions - 2nd pressure assignment | |
1704 opt_TR_Bail_pres res 1 ; TR functions - bailout pressure assignment | |
1705 | |
634 | 1706 ; ==> 193 bytes used - 51 bytes free (244 usable bytes only in bank 14 as the upper 12 |
631 | 1707 ; bytes are reserved for special function registers) |
582 | 1708 |
1709 ;----------------------------------------------------------------------------- |