Mercurial > public > hwos_code
annotate src/hwos.inc @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | 7bdcc591196c |
children | 237931377539 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
628 | 3 ; File hwos.inc combined next generation V3.04.3 |
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 |
14 ; Hardware Configuration | |
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 |
623 | 20 ; Software Configuration |
21 #include "configuration.inc" ; OSTC hwOS configuration | |
582 | 22 |
0 | 23 |
623 | 24 ; Language Codes |
604 | 25 #DEFINE none 0 ; no language selected |
623 | 26 #DEFINE en 1 ; select English |
27 #DEFINE de 2 ; select German | |
28 #DEFINE fr 3 ; select French | |
29 #DEFINE it 4 ; select Italian | |
604 | 30 |
560 | 31 |
623 | 32 ; Magic Cookie Definition |
33 #DEFINE comm_service_key 0xABCDEF ; simsalabim to establish data connection | |
0 | 34 |
35 | |
604 | 36 ; Logo Address Vectors |
37 #DEFINE hw_logo_block 0x01E000 ; color image data for heinrichsweikamp logo | |
628 | 38 #DEFINE usb_ble_logo_1 0x01EEDE ; color image data for USB or BLE logo |
39 #DEFINE usb_ble_logo_2 0x01EA04 ; color image data for USB or BLE logo, "+" bootloader | |
604 | 40 |
41 | |
582 | 42 ;-----------------------------EEPROM DATA ------------------------------------ |
43 ; Automatic reset of all options when this is changed: | |
604 | 44 #DEFINE eeprom_opt_serial 0x0008 ; Version 0.8 |
0 | 45 ;----------------------------------------------------------------------------- |
46 | |
623 | 47 |
582 | 48 #DEFINE CCP1CON_VALUE b'00001100' ; PWM1 for LED dimming |
623 | 49 #DEFINE T2CON_ECO b'01111110' |
50 #DEFINE T2CON_NORMAL b'01111110' | |
51 #DEFINE T2CON_FASTEST b'01111110' | |
52 | |
53 | |
54 ; CPU speeds | |
55 #DEFINE coding_speed_eco .1 ; 1 MHz = eco speed | |
56 #DEFINE coding_speed_normal .2 ; 16 MHz = normal speed | |
57 #DEFINE coding_speed_fastest .4 ; 64 MHz = fastest speed (32 MHz on OSTC Sport BLE) | |
58 | |
59 #DEFINE speed_is_eco cpu_speed_state,0 ; =1: CPU is running at eco speed | |
60 #DEFINE speed_is_normal cpu_speed_state,1 ; =1: CPU is running at normal speed | |
61 #DEFINE speed_is_fastest cpu_speed_state,2 ; =1: CPU is running at fastest speed | |
62 | |
604 | 63 |
64 ; Divemode Custom View Indexes - Attention: these numbers need to be in line with the jump tables in customview.asm! | |
65 #DEFINE index_avr_stopwatch .1 ; average depth and stopwatch | |
66 #DEFINE index_compass_dm .2 ; compass | |
67 #DEFINE index_ppo2_sensors .3 ; ppO2 sensors | |
68 #DEFINE index_sensor_check .4 ; sensor check | |
69 #DEFINE index_pscr_info .5 ; pSCR data | |
70 #DEFINE index_pressures_SAC .6 ; tank pressure and SAC rate | |
71 #DEFINE index_gas_needs_ascent .7 ; gas needs for ascent / cave return | |
72 #DEFINE index_decoplan .8 ; deco plan | |
73 #DEFINE index_ceiling_GF_tissue .9 ; ceiling, current GF and tissues | |
74 #DEFINE index_CNS .10 ; CNS values | |
628 | 75 #DEFINE index_ppo2_ead_end_cns .11 ; ppO2, END/EAD and CNS or gas density |
604 | 76 #DEFINE index_gf_factors .12 ; GF factors |
77 #DEFINE index_clock_batt_surfpress .13 ; clock, battery and surface pressure | |
78 #DEFINE index_cv_dm_max .13 ; highest index in use in dive mode custom view | |
28 | 79 |
623 | 80 |
0 | 81 ; Timing for button hold-down flags |
604 | 82 #DEFINE TMR1H_VALUE_FIRST .255-.128 ; in steps of 7.8125 ms -> 1 s |
83 #DEFINE TMR1H_VALUE_CONT .255-.32 ; in steps of 7.8125 ms -> 0.25 s | |
84 #DEFINE TMR1H_VALUE_CONT_DIVE .255-.64 ; in steps of 7.8125 ms -> 0.5 s | |
0 | 85 |
623 | 86 |
604 | 87 ; Color Definitions: 8 bit RGB b'RRRGGGBB' |
582 | 88 #DEFINE color_red b'11100000' ; (7,0,0) |
89 #DEFINE color_dark_red b'10000101' ; (4,1,1) | |
90 #DEFINE color_violet b'11101011' ; (7,2,3) | |
91 #DEFINE color_blue b'11000111' ; (6,1,3) | |
92 #DEFINE color_green b'00011100' ; (0,7,0) | |
93 #DEFINE color_greenish b'00111110' ; (1,7,2) | |
94 #DEFINE color_dark_green b'00111001' ; (1,6,1) | |
95 #DEFINE color_yellow b'11111101' ; (7,7,1) | |
96 #DEFINE color_white b'11111111' ; (7,7,3) | |
97 #DEFINE color_black b'00000000' ; (0,0,0) | |
98 #DEFINE color_deepblue b'00000010' ; (0,0,2) | |
99 #DEFINE color_grey b'11011111' ; (6,7,3) | |
100 #DEFINE color_cyan b'11011111' ; (6,7,3) | |
101 #DEFINE color_lightblue b'11011011' ; (6,7,3) | |
102 #DEFINE color_orange b'11111000' ; (7,6,0) | |
103 #DEFINE color_pink b'11111010' ; (7,6,2) | |
0 | 104 |
623 | 105 |
106 ; Font Sizes | |
107 #DEFINE FT_TINY .0 ; aa_font16_block, full character set | |
108 #DEFINE FT_SMALL .1 ; aa_font28_block, full character set | |
109 #DEFINE FT_STANDARD .2 ; aa_font34_block, full character set | |
110 #DEFINE FT_MEDIUM .3 ; aa_font48_block, only digits, /, ., :, ;, <, =, > and ? | |
111 #DEFINE FT_LARGE .4 ; aa_font90_block, only digits, / and . | |
112 #DEFINE FT_HUGE .5 ; aa_font92_block, only digits, / and . | |
113 | |
0 | 114 |
604 | 115 ; External O2 cell input Parameters |
628 | 116 #DEFINE min_mv .70 ; = 7 mV |
604 | 117 #DEFINE max_mv .2500 ; = 250 mV |
118 #DEFINE ignore_mv .3500 ; = 350 mV (to suppress ghost readings for long, open cables) | |
0 | 119 |
623 | 120 |
604 | 121 ; Profile Recording Parameters |
582 | 122 #DEFINE logbook_profile_version 0x24 |
123 #DEFINE samplingrate_apnoe .1 ; [seconds] | |
560 | 124 |
623 | 125 |
126 ; Profile Recording Rates - Attention: all Divisors must be < 16 ! | |
604 | 127 #DEFINE div_temperature .6 ; x sampling rate [s] |
128 #DEFINE div_deco .6 ; x sampling rate [s] | |
129 #DEFINE div_gf .12 ; x sampling rate [s] | |
130 #DEFINE div_ppo2_sensors .2 ; x sampling rate [s] | |
131 #DEFINE div_decoplan .12 ; x sampling rate [s] | |
132 #DEFINE div_cns .12 ; x sampling rate [s] | |
628 | 133 #DEFINE div_tank .12 ; x sampling rate [s] |
560 | 134 |
623 | 135 |
136 ; Profile Recording Data - Attention: Information Lengths must be < 16 ! | |
582 | 137 #DEFINE infolength_temperature .2 ; [byte] |
138 #DEFINE infolength_deco .2 ; [byte] | |
139 #DEFINE infolength_gf .1 ; [byte] | |
140 #DEFINE infolength_ppo2_sensors .9 ; [byte] | |
141 #DEFINE infolength_decoplan .15 ; [byte] | |
142 #DEFINE infolength_cns .2 ; [byte] | |
628 | 143 #DEFINE infolength_tank .2 ; [byte] |
0 | 144 |
623 | 145 |
146 ; RX Functions | |
628 | 147 #DEFINE rx_packet_overdue_timeout .120 ; [seconds] timeout for pressure measurements becomming declared as outdated (max. 255) |
604 | 148 #DEFINE max_pres_diff_min .5 ; [bar] minimum selectable pressure difference for ind.double mode |
149 #DEFINE max_pres_diff_max .50 ; [bar] maximum selectable pressure difference for ind.double mode | |
0 | 150 |
628 | 151 |
623 | 152 IFDEF _ccr_pscr |
153 #DEFINE tr_pres_options .15 ; number of options for pressure measurement source / with diluents | |
154 ELSE | |
155 #DEFINE tr_pres_options .6 ; number of options for pressure measurement source / OC gases only | |
156 ENDIF | |
157 | |
158 ; Cave Mode | |
159 IFDEF _cave_mode | |
160 #DEFINE calc_gas_options .3 ; 3 options: off, on, cave | |
161 ELSE | |
162 #DEFINE calc_gas_options .2 ; 2 options: off, on | |
163 ENDIF | |
164 | |
165 | |
604 | 166 ; Gas Needs Settings |
167 #DEFINE min_tank_size .1 ; [liter] | |
168 #DEFINE max_tank_size .40 ; [liter] | |
169 #DEFINE min_fill_press .5 ; [0 bar] value is in multiples of 10 bar | |
170 #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 | |
171 | |
172 | |
623 | 173 ; Timeouts for Menus |
174 #DEFINE surfmode_timeout_default .90 ; [s] default timeout for surface mode and surface menus | |
175 #DEFINE surfmode_timeout_simulator .240 ; [s] special timeout for simulator (deco calculator) mode | |
176 #DEFINE surfmode_timeout_sensor .240 ; [s] special timeout for surface mode when in CCR/pSCR sensor mode | |
177 #DEFINE surfmode_timeout_calibrate .240 ; [s] special timeout when in surface CCR calibrate sensors menu | |
178 #DEFINE surfmode_timeout_xmitter .240 ; [s] special timeout when in surface transmitter pairing menu | |
604 | 179 |
623 | 180 #DEFINE divemode_timeout_premenu .10 ; [s] timeout for dive mode pre-menu |
181 #DEFINE divemode_timeout_mainmenu .30 ; [s] timeout for dive mode main menu | |
182 | |
183 | |
184 ; other Timeouts | |
185 #DEFINE simulator_timeout .15 ; [s] | |
582 | 186 #DEFINE apnoe_timeout .15 ; [min] |
628 | 187 #DEFINE deep_sleep_10mins .144 ; [x 10mins] (24h in this example) |
582 | 188 |
623 | 189 ; Surface Mode Thresholds and Limits |
190 #DEFINE high_altitude_threshold .880 ; [mbar] ambient pressure at which to switch into high altitude mode | |
191 #DEFINE max_surfpressure .1030 ; [mbar] maximum value for internal surface pressure | |
560 | 192 |
193 | |
623 | 194 ; Dive Mode Thresholds and Limits |
195 #DEFINE wake_up_from_sleep .1160 ; [mbar] absolute pressure at which to switch from sleep mode to surface / dive mode | |
196 #DEFINE dive_threshold_norm_alt_start .125 ; [mbar] relative pressure for normal altitude start-of-dive (equals depth in cm) | |
197 #DEFINE dive_threshold_norm_alt_end .75 ; [mbar] relative pressure for normal altitude end-of-dive (equals depth in cm) | |
198 #DEFINE dive_threshold_high_alt_start .325 ; [mbar] relative pressure for high altitude start-of-dive (equals depth in cm) | |
199 #DEFINE dive_threshold_high_alt_end .75 ; [mbar] relative pressure for high altitude end-of-dive (equals depth in cm) | |
200 #DEFINE ostc_depth_max .120 ; [m] maximum allowed operational depth for OSTC 2, 3, cR, TR, Plus & Sport | |
628 | 201 #DEFINE deco_region_distance .2 ; [m] distance below first stop for the deco region to begin |
192 | 202 |
582 | 203 |
623 | 204 ; Dive Mode Margins |
205 #DEFINE ppO2_margin_on_max .300 ; [0.1 mbar] extra margin on ppO2 max values to compensate for surface pressures > 1000 hPa | |
604 | 206 #DEFINE sensor_voting_logic_threshold .10 ; threshold in 0.01 bar |
0 | 207 |
623 | 208 |
209 ; ppO2 Limits | |
210 #DEFINE ppo2_warning_low_lowest .15 ; [cbar] minimum value for minimum ppO2 on OC | |
211 #DEFINE ppo2_warning_low_default .17 ; [cbar] default value for minimum ppO2 on OC | |
212 #DEFINE ppo2_warning_low_highest .21 ; [cbar] maximum value for minimum ppO2 on OC | |
213 | |
214 #DEFINE ppo2_warning_loop_lowest .20 ; [cbar] minimum value for minimum ppO2 on loop | |
215 #DEFINE ppo2_warning_loop_default .40 ; [cbar] default value for minimum ppO2 on loop | |
216 #DEFINE ppo2_warning_loop_highest .60 ; [cbar] maximum value for minimum ppO2 on loop | |
217 | |
218 #DEFINE ppo2_warning_high_lowest .120 ; [cbar] minimum value for maximum ppO2 in none-deco phase | |
628 | 219 #DEFINE ppo2_warning_deco_lowest .120 ; [cbar] minimum value for maximum ppO2 in deco phase |
220 | |
623 | 221 #DEFINE ppo2_warning_high_default .140 ; [cbar] default value for maximum ppO2 in none-deco phase |
222 #DEFINE ppo2_warning_deco_default .160 ; [cbar] default value for maximum ppO2 in deco phase | |
628 | 223 |
224 IFDEF _high_ppO2_max | |
225 #DEFINE ppo2_warning_high_highest .200 ; [cbar] maximum value for maximum ppO2 in none-deco phase | |
226 #DEFINE ppo2_warning_deco_highest .200 ; [cbar] maximum value for maximum ppO2 in deco phase | |
227 ELSE | |
228 #DEFINE ppo2_warning_high_highest .160 ; [cbar] maximum value for maximum ppO2 in none-deco phase | |
623 | 229 #DEFINE ppo2_warning_deco_highest .160 ; [cbar] maximum value for maximum ppO2 in deco phase |
628 | 230 ENDIF |
623 | 231 |
0 | 232 |
604 | 233 ; Color-Code Parameters for the Dive Mode |
582 | 234 #DEFINE color_code_velocity_warn_high .11 ; [m/min] |
235 #DEFINE color_code_velocity_attn_high .10 ; [m/min] | |
623 | 236 #DEFINE velocity_display_threshold .3 ; [m/min] |
237 | |
238 | |
239 ; Simulator Parameters | |
240 #DEFINE simulator_startdepth .200 ; [mbar] initial depth (relative pressure) when entering simulator mode | |
241 #DEFINE simulator_descent_threshold .50 ; [mbar] remaining distance to target pressure when to slow down descent | |
242 #DEFINE simulator_ascent_threshold .50 ; [mbar] remaining distance to target pressure when to slow down ascent | |
628 | 243 #DEFINE simulator_descent_rate .5 ; [mbar/0.125 sec] normal descent speed, 5 equals 24 m/min |
623 | 244 #DEFINE simulator_ascent_rate .2 ; [mbar/0.125 sec] normal ascent speed, 2 equals 9 m/min |
245 | |
0 | 246 |
604 | 247 ; Battery Thresholds |
623 | 248 #DEFINE max_battery_charge_temp .3231 ; [0.1 Kelvin] max allowed battery temperature during charging (equals 50°C) |
604 | 249 #DEFINE lithium_36v_empty .2400 ; [mV] Saft 3.6 V LS14500 AA - threshold for battery percent display |
623 | 250 #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! |
251 #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! | |
252 #DEFINE aa_15v_low .1100 ; [mV] Energizer 1.5 V E2 AA - lowest possible voltage, according to Energizer data sheet EBC-4201R, page 2 | |
253 #DEFINE battery_show_level .30 ; [%] threshold when to show battery level | |
628 | 254 #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 |
255 #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 modebattery warning level, also acts as threshold for setting display brightness level to ECO when in dive mode | |
0 | 256 |
623 | 257 |
258 ; 3.6 Volt Battery Sensing Data Points at 70 mA Load | |
582 | 259 #DEFINE lithium_36v_75 .3000 ; [mV] |
260 #DEFINE lithium_36v_50 .2900 ; [mV] | |
261 #DEFINE lithium_36v_25 .2600 ; [mV] | |
262 #DEFINE lithium_36v_10 .2500 ; [mV] | |
604 | 263 |
628 | 264 |
604 | 265 ; Capacity for 2.4 Ah Saft LS14500 and 0.8 Ah Panasonic UR14500P |
623 | 266 ; battery_gauge: 6 is nAs |
448 | 267 ; devide through 65536 |
604 | 268 ; a) devide through 364 -> result is in percent of a 2.4 Ah battery |
269 ; 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
|
270 |
628 | 271 |
604 | 272 ; internal Battery Gauging |
623 | 273 #DEFINE capacity_saft_internal .364 |
274 #DEFINE capacity_panasonic_internal .121 | |
275 | |
448 | 276 |
604 | 277 ; Gauge IC |
623 | 278 #DEFINE capacity_saft .281 ; 2.4Ah/0.085mAh/100 [%] |
279 #DEFINE offset_saft .37300 ; 65536-(2.4Ah/0.085mAh) | |
448 | 280 |
623 | 281 #DEFINE capacity_panasonic .94 ; 0.8Ah/0.085mAh/100 [%] |
282 #DEFINE offset_panasonic .56124 ; 65536-(0.8Ah/0.085mAh) | |
582 | 283 |
623 | 284 #DEFINE capacity_ncr18650 .364 ; 3.1Ah/0.085mAh/100 [%] |
285 #DEFINE offset_ncr18650 .29065 ; 65536-(3.1Ah/0.085mAh) | |
448 | 286 |
623 | 287 #DEFINE capacity_ur16650 .271 ; 2.3Ah/0.085mAh/100 [%] |
288 #DEFINE offset_ur16650 .38477 ; 65536-(2.3Ah/0.085mAh) | |
289 | |
582 | 290 |
623 | 291 ; Power Consumption Values |
582 | 292 #DEFINE current_sleepmode .31 |
623 | 293 #DEFINE current_backlight_multi .115 ; * CCPR1L + current_backlight_offset (restricted to <= 255) |
582 | 294 #DEFINE current_backlight_offset .216 |
295 #DEFINE current_speed_eco .1914 | |
296 #DEFINE current_speed_normal .4027 | |
297 #DEFINE current_speed_fastest .5050 | |
298 #DEFINE current_ir_receiver .139 | |
299 #DEFINE current_compass .28 | |
0 | 300 |
623 | 301 |
302 ; Brightness Thresholds (between zero (off) and 255 (max. power consumption)) | |
582 | 303 #DEFINE ambient_light_max_high_36V .170 |
304 #DEFINE ambient_light_max_high_cr .240 | |
305 #DEFINE ambient_light_max_high_15V .140 | |
306 #DEFINE ambient_light_min_high .35 | |
307 #DEFINE ambient_light_max_medium .125 | |
308 #DEFINE ambient_light_min_medium .25 | |
309 #DEFINE ambient_light_max_eco .70 | |
310 #DEFINE ambient_light_min_eco .10 ; must be the lowest value! | |
0 | 311 |
623 | 312 |
604 | 313 ; IR Link Timeout |
628 | 314 #DEFINE ir_timeout_value .128 ; in multiples of 62.5 ms |
623 | 315 |
0 | 316 |
604 | 317 ; Setpoint Control |
582 | 318 #DEFINE surface_sp .50 ; in cbar |
352
5c6da9fa5cb0
add setpoint change to first sample in CCR mode
heinrichsweikamp
parents:
344
diff
changeset
|
319 |
623 | 320 |
604 | 321 ; Gaslist hard-coded Limits |
623 | 322 IFDEF _helium |
323 #DEFINE gaslist_min_o2 .7 ; minimum O2 [%] ( 7% is minimum value to keep MOD < 255 meters / 1 Byte) | |
324 #DEFINE gaslist_max_He .100-gaslist_min_o2 ; maximum He [%] | |
325 #DEFINE gaslist_max_change_depth .220 ; max. change depth [m] (219 is maximum value that can be produced by gaslist_calc_mod with 7% O2) | |
326 #DEFINE tissue_graphics_options .2 ; tissue graphics "Pres+Sat" and "N2+He" available | |
327 ELSE | |
328 #DEFINE gaslist_min_o2 .21 ; minimum O2 [%] | |
329 #DEFINE gaslist_max_He .0 ; maximum He [%] | |
330 #DEFINE gaslist_max_change_depth .70 ; max. change depth [m] (67 is maximum value that can be produced by gaslist_calc_mod with 21% O2) | |
331 #DEFINE tissue_graphics_options .1 ; tissue graphics "Pres+Sat" only available | |
332 ENDIF | |
333 | |
334 | |
335 ; Setpoint list hard-coded Limits | |
604 | 336 #DEFINE gaslist_sp_stepsize .10 ; steps for setpoint setup [cbar] |
337 #DEFINE gaslist_sp_max .160 ; max. setpoint [cbar] | |
338 #DEFINE gaslist_sp_min .50 ; min. setpoint [cbar] | |
582 | 339 |
623 | 340 |
604 | 341 ; Compass Display |
623 | 342 #DEFINE compass_fast_treshold .9 ; show new heading instantly if angular difference > compass_fast_treshold, else show animated turning of compass rose |
343 #DEFINE compass_averaging .10 ; number of averaging cycles | |
0 | 344 |
345 | |
604 | 346 ; Bit Flags for Communication with p2_deco.c - char_O_main_status |
623 | 347 #DEFINE DECO_VOLUME_FLAG .0 ; =1: calculate gas needs |
348 #DEFINE DECO_BOTTOM_FLAG .1 ; =1: calculate gas needs for full bottom segment, =0: ...for extra time only | |
349 #DEFINE DECO_CAVE_MODE .2 ; =1: calculate ascent and gas needs using backtracking data | |
350 #DEFINE DECO_Z_FACTOR_FLAG .3 ; =1: calculate with Z factor when converting gas volumes <-> pressures | |
351 #DEFINE DECO_TR_FUNCTIONS .4 ; =1: calculate TR functions (pressure readings) | |
352 #DEFINE DECO_EXTENDED_STOPS .5 ; =1: place gas changes also below 1st stop depth | |
353 #DEFINE DECO_MODE_LOOP_FLAG .6 ; =1: calculate real tissues in loop mode (CCR or pSCR) | |
354 #DEFINE DECO_MODE_PSCR_FLAG .7 ; =1: calculate real tissues in pSCR mode (loop flag needs to be set, too) | |
355 | |
0 | 356 |
604 | 357 ; Bit Flags for Communication with p2_deco.c - char_O_deco_status |
623 | 358 #DEFINE DECO_START_NORM .0 ; =1: write: start calculation of a normal deco plan |
359 #DEFINE DECO_START_ALT .1 ; =1: write: start calculation of an alternative deco plan | |
360 #DEFINE DECO_COMPLETED_NORM .0 ; =1: read: calculation of a normal deco plan has completed | |
361 #DEFINE DECO_COMPLETED_ALT .1 ; =1: read: calculation of an alternative deco plan has completed | |
362 #DEFINE DECO_INITIALIZE .2 ; =1: write: initialize deco engine (to be done only once at the begin of every dive) | |
628 | 363 #DEFINE DECO_CALCULATOR_MODE .3 ; =1: deco engone is run from the deco calculator |
623 | 364 #DEFINE DECO_BAILOUT_FLAG .4 ; =1: allow gas switches before first deco stop (used in bailout plans) |
365 #DEFINE DECO_ASCENT_FLAG .5 ; =1: figure in a delayed ascent (fTTS) | |
366 ; DECO_MODE_LOOP_FLAG .6 ; =1: calculate simulated tissues in loop mode (CCR or pSCR) | |
367 ; DECO_MODE_PSCR_FLAG .7 ; =1: calculate simulated tissues in pSCR mode (loop flag needs to be set, too) | |
368 | |
268
29acdb601548
BUGFIX: Increase timing tolerance for S8 HUD (cR only)
heinrichsweikamp
parents:
266
diff
changeset
|
369 |
604 | 370 ; Bit Flags for Communication with p2_deco.c - char_O_deco_warnings |
623 | 371 #DEFINE IBCD_warning .0 ; =1: IBCD currently occuring |
372 #DEFINE IBCD_warning_lock .1 ; =1: IBCD occured durign the dive | |
373 #DEFINE mbubble_warning .2 ; =1: microbubbles potentionally currently occuring | |
374 #DEFINE mbubble_warning_lock .3 ; =1: microbubbles potentionally occured during the dive | |
375 #DEFINE outside_warning .4 ; =1: currently outside the ZHL-16 model | |
376 #DEFINE outside_warning_lock .5 ; =1: was outside the ZHL-16 model during the dive | |
377 #DEFINE outside_attention .6 ; =1: currently near to the limits of the ZHL-16 model | |
628 | 378 #DEFINE deco_plan_incomplete .7 ; =1: internal error: deco calculation incomplete |
623 | 379 |
0 | 380 |
604 | 381 ; Bit Flags for Communication with p2_deco.c - char_O_deco_info |
628 | 382 #DEFINE deco_mode .0 ; =1: in deco mode, deco ppO2 levels permitted |
604 | 383 #DEFINE ind_double_switch .1 ; =1: switch to other tank advice active |
623 | 384 ; .2 ; --- unused |
385 #DEFINE deco_zone .3 ; =1: fTTS is <= TTS (not updated when in bailout mode) | |
604 | 386 #DEFINE deco_ceiling .4 ; =1: ceiling depth > 0 |
623 | 387 #DEFINE deco_stops .5 ; =1: deco stops found |
388 #DEFINE gas_needs_cave .6 ; =1: indicated gas needs are calculated in cave mode | |
389 ; .7 ; --- unused | |
390 | |
0 | 391 |
604 | 392 ; Bit Flags for Status on Variables of Type char |
393 #DEFINE char_transmitter_lost .6 | |
394 #DEFINE char_invalid_flag .7 | |
395 #DEFINE char_transmitter_low_bat .7 | |
396 | |
623 | 397 |
604 | 398 ; Bit Flags for Status on Variables of Type int (Flags are placed in the upper byte) |
399 #DEFINE int_invalid_flag .2 | |
400 #DEFINE int_not_yet_computed .3 | |
401 #DEFINE int_is_zero .3 | |
402 #DEFINE int_low_flag .4 | |
403 #DEFINE int_not_avail_flag .4 | |
404 #DEFINE int_high_flag .5 | |
405 #DEFINE int_outdated_flag .5 | |
406 #DEFINE int_attention_flag .6 | |
407 #DEFINE int_warning_flag .7 | |
0 | 408 |
623 | 409 |
0 | 410 ;----------------------------------------------------------------------------- |
623 | 411 ; Timebase and Eventbase (stored in access RAM, set by the ISR, trigger flags to be cleared by the application) |
412 | |
413 #DEFINE timebase_0sec timebase,0 ; counting timebase, 1/2 sec bit | |
414 #DEFINE timebase_1sec timebase,1 ; counting timebase, 1 sec bit | |
415 #DEFINE timebase_2sec timebase,2 ; counting timebase, 2 sec bit | |
416 #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) | |
417 #DEFINE trigger_half_second timebase,4 ; =1: a new 1/2 second has begun | |
418 #DEFINE trigger_full_second timebase,5 ; =1: a new 1/1 second has begun | |
419 #DEFINE trigger_full_minute timebase,6 ; =1: a new minute has begun | |
420 #DEFINE trigger_full_hour timebase,7 ; =1: a new hour has begun | |
421 | |
422 #DEFINE trigger_isr_updates eventbase,0 ; =1: the ISR had kicked in (set by ISR, used by ISR-safe copy macros) | |
423 #DEFINE trigger_timeout eventbase,1 ; =1: timeout signal by timeout service | |
424 #DEFINE trigger_sample_divedata eventbase,2 ; =1: time to store a new sample | |
425 #DEFINE trigger_S8_data_update eventbase,3 ; =1: new S8 digital data are available | |
426 #DEFINE trigger_pres_update eventbase,4 ; =1: new pressure value is available | |
427 #DEFINE trigger_pres_cur_changed eventbase,5 ; =1: current pressure value has changed | |
428 #DEFINE trigger_pres_max_changed eventbase,6 ; =1: maximum pressure value has changed | |
429 #DEFINE trigger_temp_changed eventbase,7 ; =1: temperature value has changed | |
430 | |
431 | |
432 ;----------------------------------------------------------------------------- | |
433 ; Flags - stored in access RAM | |
434 | |
435 ;---- Hardware - OSTC Model Descriptor (stored in access RAM, cleared & rebuilt in restart, to preserve compatibility with 3rd party tools DO NOT alter bit positions) | |
436 #DEFINE battery_gauge_available HW_descriptor,0 ; =1: OSTC has rechargeable battery with battery management chip | |
437 #DEFINE ambient_sensor HW_descriptor,1 ; =1: OSTC has an ambient light sensor | |
438 #DEFINE analog_o2_input HW_descriptor,2 ; =1: OSTC has analog inputs and S8 digital | |
439 #DEFINE optical_input HW_descriptor,3 ; =1: OSTC has an digital optical input | |
440 #DEFINE ble_available HW_descriptor,4 ; =1: OSTC has an BLE module | |
441 #DEFINE ostc_rx_present HW_descriptor,5 ; =1: OSTC has RX module | |
442 #DEFINE lv_core HW_descriptor,6 ; =1: OSTC has low-voltage core (2.7V) | |
443 ; HW_descriptor,7 ; --- reserved | |
444 | |
445 ;---- Hardware - OSTC Model Variants (stored in access RAM, NOT cleared in restart) | |
628 | 446 #DEFINE screen_type1 HW_variants,0 ; =1: display type 1, =0; display type 0 |
447 #DEFINE screen_type2 HW_variants,1 ; =1: display type 2, =0: display type 0 or 1 | |
448 #DEFINE screen_type3 HW_variants,2 ; =1: display type 3, =0: display type 0 or 1 or 2 | |
449 #DEFINE compass_type1 HW_variants,3 ; =1: compass type 1, =0: compass type 0 | |
450 #DEFINE compass_type2 HW_variants,4 ; =1: compass type 2, =0: compass type 0 or 1 | |
451 #DEFINE compass_type3 HW_variants,5 ; =1: compass type 3, =0: compass type 0 or 1 or 2 | |
452 #DEFINE analog_switches HW_variants,6 ; =1: analog switches available | |
453 #DEFINE battery_is_36v HW_variants,7 ; =1: a 3.6 Volt battery is detected | |
624 | 454 |
623 | 455 |
628 | 456 ;---- Hardware - States 1 (stored in access RAM, cleared on restart) |
457 #DEFINE analog_sw1_pressed HW_flags_state1,0 ; =1: analog switch 1 pressed | |
458 #DEFINE analog_sw2_pressed HW_flags_state1,1 ; =1: analog switch 2 pressed | |
459 #DEFINE switch_left HW_flags_state1,2 ; =1: left button was pressed | |
460 #DEFINE switch_right HW_flags_state1,3 ; =1: right button was pressed | |
461 #DEFINE flip_screen HW_flags_state1,4 ; =1: screen is shown 180° turned | |
462 #DEFINE adc_is_running HW_flags_state1,5 ; =1: the ADC is in use | |
463 #DEFINE tft_is_dimming HW_flags_state1,6 ; =1: the TFT is dimming, ignore light sensor | |
464 #DEFINE compass_enabled HW_flags_state1,7 ; =1: the compass and accelerometer chip is active | |
465 | |
466 ;---- Hardware - States 2 (stored in access RAM, NOT cleared on restart) | |
467 #DEFINE cc_active HW_flags_state2,0 ; =1: constant current charging active (cR hardware only) | |
468 #DEFINE cv_active HW_flags_state2,1 ; =1: constant voltage charging active (cR hardware only) | |
469 ; HW_flags_state2,2 ; --- unused | |
470 ; HW_flags_state2,3 ; --- unused | |
471 ; HW_flags_state2,4 ; --- unused | |
472 ; HW_flags_state2,5 ; --- unused | |
473 ; HW_flags_state2,6 ; --- unused | |
474 ; HW_flags_state2,7 ; --- unused | |
623 | 475 |
582 | 476 |
623 | 477 ;---- Operating System - persistent Settings (stored in access RAM, NOT cleared in restart) |
478 #DEFINE sensor1_calibrated_ok OS_flags_persist,0 ; =1: sensor 1 calibration ok | |
479 #DEFINE sensor2_calibrated_ok OS_flags_persist,1 ; =1: sensor 2 calibration ok | |
480 #DEFINE sensor3_calibrated_ok OS_flags_persist,2 ; =1: sensor 3 calibration ok | |
481 #DEFINE compass_bearing_set OS_flags_persist,3 ; =1: compass bearing is set | |
482 #DEFINE use_old_batt_flag OS_flags_persist,4 ; =1: load old battery data after power-on reset | |
483 #DEFINE option_repaired OS_flags_persist,5 ; =1: options have been repaired | |
484 #DEFINE restart_fast OS_flags_persist,6 ; =1: skip logos and waits on restart | |
485 #DEFINE battery_overtemp OS_flags_persist,7 ; =1: battery charging temperature limit exceeded | |
486 | |
487 | |
488 ;---- Operating System - ISR Control 1 (stored in access RAM) | |
489 #DEFINE reset_timebase OS_flags_ISR1,0 ; =1: request ISR to reset the timebase for the trigger flags | |
490 #DEFINE reset_timeout OS_flags_ISR1,1 ; =1: request ISR to reset the timeout timer | |
491 #DEFINE reset_max_pressure OS_flags_ISR1,2 ; =1: request ISR to reset the maximum pressure to zero | |
492 #DEFINE reset_surface_interval OS_flags_ISR1,3 ; =1: request ISR to reset the surface interval to zero | |
493 #DEFINE reset_trip_pressure OS_flags_ISR1,4 ; =1: request ISR to reset the resettable min/max pressure | |
494 #DEFINE block_rtc_access OS_flags_ISR1,5 ; =1: suspend the ISR from accessing the RTC | |
495 #DEFINE block_battery_gauge OS_flags_ISR1,6 ; =1: suspend the ISR from updating the battery gauge | |
496 #DEFINE block_sensor_interrupt OS_flags_ISR1,7 ; =1: suspend the ISR from executing sensor interrupts | |
497 | |
498 ;---- Operating System - ISR Control 2 (stored in access RAM) | |
499 #DEFINE update_surface_pressure OS_flags_ISR2,0 ; =1: request ISR to update the surface pressure | |
500 #DEFINE quit_simulatormode OS_flags_ISR2,1 ; =1: request ISR to quit the simulator mode | |
501 #DEFINE count_divetime OS_flags_ISR2,2 ; =1: request ISR to count the dive time | |
502 #DEFINE sensor_override_request OS_flags_ISR2,3 ; =1: request ISR to override the pressure sensor with a simulated depth | |
503 ; OS_flags_ISR2,4 ; --- unused | |
504 ; OS_flags_ISR2,5 ; --- unused | |
505 #DEFINE sensor_override_active OS_flags_ISR2,6 ; =1: ISR output: switch to override-mode confirmed | |
506 #DEFINE divetime_longer_1min OS_flags_ISR2,7 ; =1: ISR output: dive time is >= one minute | |
507 | |
508 | |
509 ;---- Operating Modes (stored in access RAM, persistent) | |
510 #DEFINE sleepmode OM_flags_mode,0 ; =1: in sleep mode | |
511 #DEFINE divemode OM_flags_mode,1 ; =1: in dive mode | |
512 #DEFINE simulatormode OM_flags_mode,2 ; =1: in simulator mode | |
513 #DEFINE high_altitude_mode OM_flags_mode,3 ; =1: unit was manually turned on with absolute pressure < 880 mbar | |
514 #DEFINE s8_digital_avail OM_flags_mode,4 ; =1: S8 digital interface is available | |
515 #DEFINE tr_functions_activated OM_flags_mode,5 ; =1: TR module is available and TR mode is <> off | |
516 #DEFINE cold_start OM_flags_mode,6 ; =1: restart is entered from a cold start | |
517 IFDEF _screendump | |
518 #DEFINE screen_dump_avail OM_flags_mode,7 ; =1: screen dump function is available | |
519 ELSE | |
520 #DEFINE comm_mode_disabled OM_flags_mode,7 ; =1: COMM mode is disabled | |
521 ENDIF | |
522 | |
523 | |
524 ;---- Dive Modes - Deco Modes (stored in access RAM) | |
525 #DEFINE FLAG_oc_mode DM_flags_deco,0 ; =1: in OC mode active | |
526 #DEFINE FLAG_ccr_mode DM_flags_deco,1 ; =1: in CCR mode (fixed ppO2 or sensor) active | |
527 #DEFINE FLAG_gauge_mode DM_flags_deco,2 ; =1: in gauge mode | |
528 #DEFINE FLAG_apnoe_mode DM_flags_deco,3 ; =1: in apnoe mode | |
529 #DEFINE FLAG_pscr_mode DM_flags_deco,4 ; =1: in pSCR mode | |
530 #DEFINE bailout_mode DM_flags_deco,5 ; =1: in bailout mode | |
531 #DEFINE apnoe_at_surface DM_flags_deco,6 ; =1: at the surface, 0= submerged (apnoe mode only, set/reset by ISR) | |
532 #DEFINE apnoe_new_dive DM_flags_deco,7 ; =1: a new dive has begun (apnoe mode only, set by ISR) | |
533 | |
534 | |
535 ;----------------------------------------------------------------------------- | |
536 ; Flags - stored in bank common | |
537 | |
538 ;---- Dive Mode - Dive States | |
539 #DEFINE use_aGF DM_flags_state,0 ; =1: use aGF, =0: use GF | |
540 #DEFINE sp_fallback DM_flags_state,1 ; =1: fall-back to SP1 due to external O2 sensor failure | |
541 #DEFINE dive_turned DM_flags_state,2 ; =1: dive is turned | |
542 #DEFINE cave_mode DM_flags_state,3 ; =1: in cave mode (gas needs by backtracking) | |
543 #DEFINE depth_limit_exceeded DM_flags_state,4 ; =1: depth limit exceeded | |
628 | 544 #DEFINE deco_locked DM_flags_state,5 ; =1: in or has been in deco obligation during the dive |
545 #DEFINE deco_region DM_flags_state,6 ; =1: in or has been in the deco stops region during the dive | |
623 | 546 ; DM_flags_state,7 ; --- unused |
582 | 547 |
623 | 548 ;---- Dive Mode - O2 Sensors |
549 #DEFINE use_O2_sensor1 DM_flags_sensor,0 ; =1: sensor 1 shall be used | |
550 #DEFINE use_O2_sensor2 DM_flags_sensor,1 ; =1: sensor 2 shall be used | |
551 #DEFINE use_O2_sensor3 DM_flags_sensor,2 ; =1: sensor 3 shall be used | |
552 #DEFINE voting_logic_sensor1 DM_flags_sensor,3 ; =1: sensor 1 is within the voting logic threshold | |
553 #DEFINE voting_logic_sensor2 DM_flags_sensor,4 ; =1: sensor 2 is within the voting logic threshold | |
554 #DEFINE voting_logic_sensor3 DM_flags_sensor,5 ; =1: sensor 3 is within the voting logic threshold | |
555 ; DM_flags_sensor,6 ; --- unused | |
556 ; DM_flags_sensor,7 ; --- unused | |
557 | |
558 ;---- Dive Mode - User Requests | |
559 #DEFINE request_gaschange DM_flags_request,0 ; =1: request to change the gas | |
560 #DEFINE request_reset_avg DM_flags_request,1 ; =1: request to reset the average depth | |
561 #DEFINE request_next_custview DM_flags_request,2 ; =1: request to show the next custom view | |
562 #DEFINE request_back_to_loop DM_flags_request,3 ; =1: request to switch back from bailout to loop | |
563 #DEFINE request_toggle_GF DM_flags_request,4 ; =1: request to toggle between GF and aGF | |
564 #DEFINE request_set_marker DM_flags_request,5 ; =1: request to set a marker in the logbook | |
565 #DEFINE request_turn_dive DM_flags_request,6 ; =1: request to toggle the dive turned status | |
566 ; DM_flags_request,7 ; --- unused | |
567 | |
568 ;---- Dive Mode - Data Recording Events | |
569 #DEFINE event_occured DM_flags_event,0 ; =1: an event occurred (global indicator flag) | |
570 #DEFINE event_gas_change DM_flags_event,1 ; =1: a change to another gas or diluent occurred | |
571 #DEFINE event_gas_change_gas6 DM_flags_event,2 ; =1: a change to or of the gas 6 has occurred | |
572 #DEFINE event_bailout DM_flags_event,3 ; =1: a change to or of the OC gas occurred due to bailout | |
573 #DEFINE event_SP_change DM_flags_event,4 ; =1: a change of the setpoint has occurred | |
574 ; DM_flags_event,5 ; --- unused | |
575 #DEFINE rs232_rx_timeout DM_flags_event,6 ; =1: RS232 receive timeout occurred | no better place found | |
576 #DEFINE i2c_error_flag DM_flags_event,7 ; =1: an I2C error occurred | for these two flags... | |
577 | |
578 ;---- Dive Mode - Display Control / Layout | |
579 #DEFINE safety_stop_enabled DM_flags_layout1,0 ; =1: safety stop is enabled | |
580 #DEFINE safety_stop_active DM_flags_layout1,1 ; =1: safety stop is shown | |
581 #DEFINE decostop_active DM_flags_layout1,2 ; =1: decompression stop is shown | |
582 #DEFINE velocity_active_num DM_flags_layout1,3 ; =1: numerical velocity indicator is shown | |
583 #DEFINE velocity_active_vsi DM_flags_layout1,4 ; =1: graphical velocity indicator is shown | |
584 #DEFINE alt_layout_active DM_flags_layout1,5 ; =1: the alternative dive layout is used (aka "blind mode") | |
585 #DEFINE neg_flag_velocity DM_flags_layout1,6 ; =1: descending, used by velocity logic | |
586 #DEFINE show_only_divemins DM_flags_layout1,7 ; =1: only dive minutes are shown | |
587 | |
588 #DEFINE cur_depth_greater_100m DM_flags_layout2,0 ; =1: current depth > 100 meters | |
589 #DEFINE max_depth_greater_100m DM_flags_layout2,1 ; =1: max. depth > 100 meters | |
590 #DEFINE depth_attention DM_flags_layout2,2 ; =1: show depth in attention color | |
591 #DEFINE depth_warning DM_flags_layout2,3 ; =1: show depth in warning color | |
592 #DEFINE depth_warn_att_last DM_flags_layout2,4 ; =1: last depth was shown in warning or attention color | |
593 #DEFINE depth_inverse_last DM_flags_layout2,5 ; =1: last depth was shown in inverse | |
594 #DEFINE gas_needs_mode_last DM_flags_layout2,6 ; =1: last gas needs were computed for cave mode, =0: direct ascent | |
595 #DEFINE tts_greater_99 DM_flags_layout2,7 ; =1: TTS > 99 minutes | |
596 | |
597 ;---- Dive Mode - Display Control / Messages | |
598 #DEFINE message_advice DM_flags_message,0 ; =1: an advice is active in dive mode | |
599 #DEFINE message_attention DM_flags_message,1 ; =1: an attention is active in dive mode or surface mode | |
600 #DEFINE message_warning DM_flags_message,2 ; =1: a warning is active in dive mode or surface mode | |
601 #DEFINE message_2nd_row_used DM_flags_message,3 ; =1: the second row contains a warning/attention/advice | |
602 #DEFINE sign_shown DM_flags_message,4 ; =1: the warning/attention/advice sign is shown | |
603 #DEFINE gas_needs_attention DM_flags_message,5 ; =1: the gas needs attention has been shown before | |
604 #DEFINE gas_needs_warning DM_flags_message,6 ; =1: the gas needs warning has been shown before | |
605 #DEFINE o2_sensors_warning DM_flags_message,7 ; =1: the O2 sensors warning has been shown before | |
604 | 606 |
623 | 607 ;---- Dive Mode - Display Control / Gas, Diluent |
608 #DEFINE better_gas_hint DM_flags_gas_dil,0 ; =1: mark a gas when it is a better gas | |
609 #DEFINE better_gas_available DM_flags_gas_dil,1 ; =1: a better gas is available | |
610 #DEFINE better_gas_blinking DM_flags_gas_dil,2 ; =1: gas is blinking | |
611 #DEFINE better_dil_available DM_flags_gas_dil,3 ; =1: a better diluent is available | |
612 #DEFINE better_dil_blinking DM_flags_gas_dil,4 ; =1: diluent is blinking | |
613 ; DM_flags_gas_dil,5 ; --- unused | |
614 ; DM_flags_gas_dil,6 ; --- unused | |
615 ; DM_flags_gas_dil,7 ; --- unused | |
616 | |
617 | |
618 ;---- Menu System - Control | |
619 #DEFINE surfmode_menu MS_flags_control,0 ; =1: surface menu is shown (i.e. returning from it) | |
620 #DEFINE dive_options_menu MS_flags_control,1 ; =1: dive options menu is shown (e.g. "Menu?") | |
621 #DEFINE dive_main_menu MS_flags_control,2 ; =1: dive mode menu is shown (i.e. the "big" menu) | |
622 #DEFINE compass_menu MS_flags_control,3 ; =1: "set bearing" is shown | |
623 #DEFINE is_diluent_menu MS_flags_control,4 ; =1: setting up diluents, =0: setting up OC gases | |
624 #DEFINE is_bailout_menu MS_flags_control,5 ; =1: in bailout menu | |
625 ; MS_flags_control,6 ; --- unused | |
626 ; MS_flags_control,7 ; --- unused | |
627 | |
628 ;---- Menu System - Data Imprinting | |
629 #DEFINE imprint_time_date MS_flags_imprint,0 ; =1: imprint current time & date | |
630 #DEFINE imprint_color_schemes MS_flags_imprint,1 ; =1: imprint color schemes | |
631 #DEFINE imprint_sensor_mv MS_flags_imprint,2 ; =1: imprint O2 sensor mV data | |
632 #DEFINE imprint_xmitter_pres MS_flags_imprint,3 ; =1: imprint transmitter pressure data | |
633 #DEFINE imprint_xmitter_ID MS_flags_imprint,4 ; =1: in transmitter-to-tank pairing menu | |
634 #DEFINE imprint_surfmode_data MS_flags_imprint,5 ; =1: imprint surface mode data | |
635 #DEFINE block_option_value MS_flags_imprint,6 ; =1: suspend display of option values | |
636 ; MS_flags_imprint,7 ; --- unused | |
637 | |
0 | 638 |
623 | 639 ;---- Font & Image System |
640 #DEFINE aa_antialias AA_flags,0 ; used by aa_wordprocessor | |
641 #DEFINE aa_color_quarter AA_flags,1 ; used by aa_wordprocessor | |
642 #DEFINE aa_color_half AA_flags,2 ; used by aa_wordprocessor | |
643 #DEFINE aa_aux_flag AA_flags,3 ; auxiliary flag for various purposes | |
644 #DEFINE use_custom_colors AA_flags,4 ; =1: override default pixel colors, used by color_image | |
645 ; AA_flags,5 ; --- unused | |
646 ; AA_flags,6 ; --- unused | |
647 ; AA_flags,7 ; --- unused | |
648 | |
649 | |
650 ;---- Convert and Display Functions (Control of numerical and other Output) | |
651 #DEFINE leftbind CVT_flags1,0 ; =1: align numbers to the left | |
652 #DEFINE win_invert CVT_flags1,1 ; =1: the text shall be printed in inverse | |
653 #DEFINE short_gas_descriptions CVT_flags1,2 ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
654 #DEFINE ignore_digit3 CVT_flags1,3 | |
655 #DEFINE ignore_digit4 CVT_flags1,4 | |
656 #DEFINE ignore_digit5 CVT_flags1,5 | |
657 #DEFINE aux_flag CVT_flags1,6 ; provided for local boolean arguments and storage | |
658 ; CVT_flags1,7 ; --- unused | |
0 | 659 |
623 | 660 #DEFINE pre_zero_flag CVT_flags2,0 |
661 #DEFINE all_zeros_flag CVT_flags2,1 | |
662 #DEFINE DP_done CVT_flags2,2 | |
663 #DEFINE DP_done2 CVT_flags2,3 | |
664 #DEFINE show_last3 CVT_flags2,4 | |
665 #DEFINE leading_zeros CVT_flags2,5 | |
666 #DEFINE show_last4 CVT_flags2,6 | |
667 #DEFINE neg_flag CVT_flags2,7 ; =1: result is negative | |
668 | |
669 | |
670 ;---- Miscellaneous Flags | |
671 #DEFINE ignore_last_edited_gas misc_flags,0 ; =1: ignore last edited gas while cleaning up gas/dil list | |
672 #DEFINE copying_dil misc_flags,1 ; =1: copying a diluent | |
673 #DEFINE comm_service_enabled misc_flags,2 ; =1: COMM service mode is enabled | |
674 ; misc_flags,3 ; --- unused | |
675 ; misc_flags,4 ; --- unused | |
676 ; misc_flags,5 ; --- unused | |
677 ; misc_flags,6 ; --- unused | |
678 ; misc_flags,7 ; --- unused | |
679 | |
680 ;---- HUD Status Byte (stored in access RAM) | |
604 | 681 #DEFINE hud_connection_ok hud_status_byte,0 ; =1 HUD connection ok |
682 ; hud_status_byte,1 ; =1 HUD is calibrated | |
623 | 683 ; hud_status_byte,2 ; =1 HUD battery is low (< 3000 mV) |
604 | 684 #DEFINE sensor1_active hud_status_byte,3 ; =1: sensor 1 is active |
685 #DEFINE sensor2_active hud_status_byte,4 ; =1: sensor 2 is active | |
686 #DEFINE sensor3_active hud_status_byte,5 ; =1: sensor 3 is active | |
687 ; hud_status_byte,6 ; --- unused in stand-alone HUD | |
688 ; hud_status_byte,7 ; --- unused in stand-alone HUD | |
0 | 689 |
582 | 690 |
691 ;---------------------------- Macros ------------------------------------ | |
692 | |
623 | 693 TSTOSS macro opt_reg ; TeST Option Skip next instruction if Set (not zero) |
694 movff opt_reg,WREG ; Attention: destroys WREG! | |
695 tstfsz WREG,A ; Attention: must be followed by a plain machine | |
696 bra $+4 ; command, do not let follow a macro! | |
697 endm ; | |
698 | |
699 | |
700 TSTOSC macro opt_reg ; TeST Option Skip next instruction if Clear (zero) | |
701 movff opt_reg,WREG ; Attention: destroys WREG! | |
702 tstfsz WREG,A ; Attention: must be followed by a plain machine | |
703 endm ; command, do not let follow a macro! | |
704 | |
705 | |
706 CLRI macro int ; CLeaR Integer (version of clrf for 2 byte integers) | |
707 clrf int+0 ; Attention: must be in bank where target variable resides! | |
708 clrf int+1 ; | |
709 endm ; | |
710 | |
711 | |
712 SETI macro int ; SET Integer (version of setf for 2 byte integers) | |
713 setf int+0 ; Attention: must be in bank where target variable resides! | |
714 setf int+1 ; | |
715 endm ; | |
716 | |
717 | |
718 MOVLI macro lit, int ; MOVe Literal to Integer | |
719 movlw LOW (lit) ; Attention: destroys WREG! | |
720 movwf int+0 ; Attention: must be in bank where target variable resides! | |
721 movlw HIGH (lit) ; | |
722 movwf int+1 ; | |
723 endm ; | |
724 | |
725 | |
726 INCI macro int ; INCrement Integer (version of incf for 2 byte integers) | |
727 infsnz int+0,F ; Attention: must be in bank where target variable resides! | |
728 incf int+1,F ; | |
729 endm ; | |
730 | |
731 | |
732 DECI macro int ; DECrement Integer (version of decf for 2 byte integers) | |
733 movlw .1 ; Attention: destroys WREG! | |
734 subwf int+0,F ; Attention: must be in bank where target variable resides! | |
735 movlw .0 ; | |
736 subwfb int+1,F ; | |
737 endm ; | |
738 | |
739 | |
740 ADDLI macro lit, int ; ADD Literal to Integer | |
741 movlw LOW (lit) ; Attention: destroys WREG! | |
742 addwf int+0,F ; Attention: must be in bank where target variable resides! | |
743 movlw HIGH (lit) ; | |
744 addwfc int+1,F ; | |
745 endm ; | |
746 | |
747 | |
748 SUBLI macro lit, int ; SUBtract Literal from Integer | |
749 movlw LOW (lit) ; Attention: destroys WREG! | |
750 subwf int+0,F ; Attention: must be in bank where target variable resides! | |
751 movlw HIGH (lit) ; | |
752 subwfb int+1,F ; | |
753 endm ; | |
754 | |
755 | |
756 MOVII macro from, to ; MOVe Integer to Integer (version of movff for 2 byte integers) | |
757 movff from+0,to+0 ; banksafe | |
758 movff from+1,to+1 ; | |
759 endm ; | |
760 | |
761 | |
762 SMOVII macro from, to ; isr-Safe MOVe 2 byte Integer to Integer (version of MOVII for integers updated in ISR) | |
763 local retry ; | |
764 retry: | |
765 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
766 movff from+0,to+0 ; copy low byte | |
767 movff from+1,to+1 ; copy high byte | |
768 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
769 bra retry ; YES - retry copy | |
770 endm ; NO - done | |
771 | |
772 | |
773 SMOVTT macro from, to ; isr-Safe MOVe Three byte integer to integer (version of MOVII for integers updated in ISR) | |
774 local retry ; | |
775 retry: | |
776 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
777 movff from+0,to+0 ; copy low byte | |
778 movff from+1,to+1 ; copy high byte | |
779 movff from+2,to+2 ; copy upper byte | |
780 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
781 bra retry ; YES - retry copy | |
782 endm ; NO - done | |
783 | |
784 | |
785 SMOVFF macro from, to ; isr-Safe MOVe Four byte integer to integer (version of MOVII for integers updated in ISR) | |
786 local retry ; | |
787 retry: | |
788 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
789 movff from+0,to+0 ; copy byte 0 (LSB) | |
790 movff from+1,to+1 ; copy byte 1 | |
791 movff from+2,to+2 ; copy byte 2 | |
792 movff from+3,to+3 ; copy byte 3 (MSB) | |
793 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
794 bra retry ; YES - retry copy | |
795 endm ; NO - done | |
796 | |
797 | |
798 SMOVSS macro from, to ; isr-Safe MOVe Six byte integer to integer (version of MOVII for integers updated in ISR) | |
799 local retry ; | |
800 retry: | |
801 bcf trigger_isr_updates ; clear flag, it will be set by the ISR in case it had kicked in | |
802 movff from+0,to+0 ; copy byte 0 (LSB) | |
803 movff from+1,to+1 ; copy byte 1 | |
804 movff from+2,to+2 ; copy byte 2 | |
805 movff from+3,to+3 ; copy byte 3 | |
806 movff from+4,to+4 ; copy byte 4 | |
807 movff from+5,to+5 ; copy byte 5 (MSB) | |
808 btfsc trigger_isr_updates ; did the ISR kicked in since we cleared the flag? | |
809 bra retry ; YES - retry copy | |
810 endm ; NO - done | |
811 | |
582 | 812 |
604 | 813 ;---------------------------- C-Code Routines ---------------------------- |
582 | 814 |
815 extern deco_calc_desaturation_time | |
816 extern deco_calc_hauptroutine | |
604 | 817 extern deco_calc_dive_interval |
582 | 818 extern deco_calc_dive_interval_1min |
819 extern deco_calc_dive_interval_10min | |
820 extern deco_clear_tissue | |
623 | 821 extern deco_init_output_vars |
582 | 822 extern deco_pull_tissues_from_vault |
823 extern deco_push_tissues_to_vault | |
560 | 824 |
825 | |
623 | 826 ;---------------------------- Bank0 ACCESS RAM ------------------------------ |
827 | |
828 ; Variables located in the Access Bank are declared in hwos.asm | |
829 | |
830 ifndef ACCESS_RAM_VARS | |
831 | |
832 extern HW_descriptor | |
833 extern HW_variants | |
834 | |
628 | 835 extern HW_flags_state1 |
836 extern HW_flags_state2 | |
623 | 837 |
838 extern OS_flags_persist | |
839 extern OS_flags_ISR1 | |
840 extern OS_flags_ISR2 | |
841 | |
842 extern OM_flags_mode | |
843 | |
844 extern DM_flags_deco | |
845 | |
846 extern cpu_speed_request | |
847 extern cpu_speed_state | |
848 | |
849 extern timebase | |
850 extern eventbase | |
604 | 851 |
623 | 852 extern isr_timeout_timer |
853 extern isr_timeout_reload | |
854 | |
855 extern total_divetime_secs | |
856 extern counted_divetime_mins | |
857 extern counted_divetime_secs | |
858 | |
859 extern apnoe_surface_secs | |
860 extern apnoe_surface_mins | |
861 extern apnoe_dive_secs | |
862 extern apnoe_dive_mins | |
863 | |
864 extern sampling_rate | |
865 extern sampling_timer | |
866 | |
867 extern simulatormode_depth | |
868 | |
869 extern hud_status_byte | |
870 extern hud_battery_mv | |
871 | |
872 endif | |
873 | |
874 ;---------------------------- Bank0 NORMAL RAM ------------------------------ | |
875 isr_backup equ 0x060 ; Alias for "banksel isr_backup" | |
876 isr_backup udata_ovr isr_backup ; Bank 0 ISR data | |
604 | 877 |
878 ;---- Backup for general Registers | |
623 | 879 PROD_backup res 2 |
880 FSR0_backup res 2 | |
881 BSR_backup res 1 | |
882 | |
883 ;---- Multi-Purpose Register for ISR Routines | |
884 isr_mpr res 2 ; used in ms5541.asm and isr.asm | |
885 #DEFINE isr_lo isr_mpr+0 ; | |
886 #DEFINE isr_hi isr_mpr+1 ; | |
887 | |
888 ;---- Time and Date - Real Time Clock | |
889 rtc_year res 1 ; running year | Attention: | |
890 rtc_month res 1 ; running month | do not change | |
891 rtc_day res 1 ; running day | the Position of | |
892 rtc_hour res 1 ; running hour | these Variables | |
893 rtc_mins res 1 ; running minute | relative to | |
894 rtc_secs res 1 ; running second | each other! | |
582 | 895 |
623 | 896 rtc_latched_year res 1 ; latched year | Attention: |
897 rtc_latched_month res 1 ; latched month | do not change | |
898 rtc_latched_day res 1 ; latched day | the Position of | |
899 rtc_latched_hour res 1 ; latched hour | these Variables | |
900 rtc_latched_mins res 1 ; latched minute | relative to | |
901 rtc_latched_secs res 1 ; latched second | each other! | |
902 | |
903 ;--- RTC-independent Timebase | |
904 timebase_mins res 1 ; RTC-independent timer for generating the every hour trigger | |
905 timebase_secs res 1 ; RTC-independent timer for generating the every minute trigger | |
906 | |
907 ;---- other Timers | |
908 uptime res 4 ; [sec] uptime of the OSTC since last cold start | |
909 lastdive_time res 4 ; [sec] time since last dive | |
910 surface_interval res 2 ; [min] surface interval | |
911 simulator_time res 1 ; [min] real runtime of the simulator | |
912 | |
913 ;---- Data for Pressure and Temperature Calculation (MS5541) | |
914 clock_count res 1 ; I2C clock pulse counter | |
915 sensor_state_counter res 1 ; counter for pressure sensor state machine | |
916 dLSB res 1 ; pressure sensor interface, LSB | |
917 dMSB res 1 ; pressure sensor interface, MSB | |
918 dbuffer res 1 ; pressure sensor interface, RX/TX buffer | |
582 | 919 |
604 | 920 C1 res 2 ; decoded calibration data |
623 | 921 C2 res 2 ; decoded calibration data |
922 C3 res 2 ; decoded calibration data | |
923 C4 res 2 ; decoded calibration data, here C4-250 | |
924 C5 res 2 ; decoded calibration data, here reference temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) | |
925 C6 res 2 ; decoded calibration data | |
582 | 926 D1 res 2 ; raw pressure |
927 D2 res 2 ; raw temperature | |
928 xdT res 2 | |
929 xdT2 res 2 | |
930 OFF res 2 | |
931 SENS res 2 | |
623 | 932 |
933 temperature_cur res 2 ; current temperature | |
934 temperature_min res 2 ; minimum temperature (operated by divemode.asm) | |
935 temperature_avg res 2 ; internal register used for averaging | |
936 temperature_last res 2 ; internal register used for detecting changes | |
937 | |
938 pressure_abs res 2 ; current absolute pressure | |
939 pressure_abs_avg res 2 ; internal register used for averaging | |
940 pressure_abs_last res 2 ; internal register used for detecting pressure changes | |
941 | |
942 pressure_abs_sampled res 2 ; sampled surface pressure, sampled in sleep mode every 15 minutes | |
943 pressure_abs_ref res 2 ; reference surface pressure, surface pressure sampled 15 minutes ago | |
944 pressure_surf res 2 ; surface pressure used by ISR to calculate relative pressures | |
945 | |
946 pressure_rel_cur res 2 ; current relative pressure | |
947 pressure_rel_max res 2 ; maximum relative pressure | |
948 pressure_rel_sim res 2 ; simulated relative pressure (simulator mode) | |
582 | 949 |
604 | 950 ;---- Data for ISR Math Subroutines |
623 | 951 isr_xA res 2 ; multiplicand 1 |
952 isr_xB res 2 ; multiplicand 2 | |
953 isr_xC res 4 ; resulting product | |
582 | 954 |
604 | 955 ;---- Display Brightness |
623 | 956 ambient_light res 2 ; ambient light level |
604 | 957 max_CCPR1L res 1 ; max. brightness value for CCPR1L |
582 | 958 |
604 | 959 ;---- Battery Gauge (nAs, nC) |
960 battery_gauge res 6 ; 48 bit -> 78 Ah max | |
582 | 961 |
604 | 962 ;---- IR/S8-Link |
623 | 963 ir_s8_buffer res .18 ; buffer for data received on IR/S8 interface, |
964 ; also used to buffer MS5541 raw calibration data | |
965 | |
966 IFDEF _external_sensor | |
582 | 967 ir_s8_counter res 1 |
604 | 968 ir_s8_timeout res 1 ; timeout for valid data |
623 | 969 ENDIF |
582 | 970 |
623 | 971 ;---- raw O2 Sensor Data received on S8 Link |
972 IFDEF _external_sensor | |
973 s8_rawdata_sensor1 res 3 ; 24 bit A/D raw data from S8 HUD sensor 1 | |
974 s8_rawdata_sensor2 res 3 ; 24 bit A/D raw data from S8 HUD sensor 2 | |
975 s8_rawdata_sensor3 res 3 ; 24 bit A/D raw data from S8 HUD sensor 3 | |
976 ENDIF | |
582 | 977 |
623 | 978 ;---- Switch Processing (8 byte, called by ISR and sleep mode) |
979 analog_sw1_raw res 2 ; idle values (average) | |
980 analog_sw2_raw res 2 ; idle values (average) | |
981 analog_counter res 1 ; for averaging | |
982 analog_sw1 res 1 ; analog value for switch 1 | |
983 analog_sw2 res 1 ; analog value for switch 2 | |
984 button_polarity res 1 ; 0xFF (both normal), 0x00 (both inverted), 0x01 (left inverted only), 0x02 (right inverted only) | |
582 | 985 |
623 | 986 ;--- resettable min and max Depth Option |
987 IFDEF _min_depth_option | |
988 pressure_rel_min_trip res 2 ; resettable minimum relative pressure | |
989 pressure_rel_max_trip res 2 ; resettable maximum relative pressure | |
990 ENDIF | |
582 | 991 |
623 | 992 ; 141 byte used, 19 byte free |
560 | 993 |
623 | 994 |
582 | 995 ;---------------------------- Common DATA ------------------------------------ |
623 | 996 common equ 0x100 ; Alias for "banksel common" |
997 common udata_ovr common ; Bank 1 general variables | |
582 | 998 |
623 | 999 ;---- Multi-Purpose Register for Data Storage and Interface with Conversion and Display Functions (6 byte) |
1000 mpr res 6 ; will be used as base address of 1, 2, 3, 4 and 6 byte buffers | |
1001 #DEFINE lo mpr+0 ; nickname for "low" | |
1002 #DEFINE hi mpr+1 ; nickname for "high" | |
1003 #DEFINE up mpr+2 ; nickname for "upper" | |
1004 #DEFINE ex mpr+3 ; nickname for "extra" | |
1005 #DEFINE ul mpr+4 ; nickname for "ultra" | |
1006 #DEFINE hy mpr+5 ; nickname for "hyper" | |
1007 | |
582 | 1008 |
623 | 1009 ;---- Flags - Menu System (2 byte) |
1010 MS_flags_control res 1 ; menu system - control | |
1011 MS_flags_imprint res 1 ; menu system - data imprinting | |
582 | 1012 |
623 | 1013 ;---- Flags - Dive Mode (7 byte) |
1014 DM_flags_state res 1 ; dive mode - dive states | |
1015 DM_flags_sensor res 1 ; dive mode - O2 sensors | |
1016 DM_flags_request res 1 ; dive mode - user requests | |
1017 DM_flags_event res 1 ; dive mode - data recording events | |
1018 DM_flags_layout1 res 1 ; dive mode - display control / layout (1) | |
1019 DM_flags_layout2 res 1 ; dive mode - display control / layout (2) | |
1020 DM_flags_message res 1 ; dive mode - display control / messages | |
1021 DM_flags_gas_dil res 1 ; dive mode - display control / gas, diluent | |
1022 | |
1023 ;---- Miscellaneous Flags (1 byte) | |
1024 misc_flags res 1 | |
1025 | |
1026 ;---- Interface to numerical Display Functions (1 byte) | |
582 | 1027 ignore_digits res 1 |
1028 | |
623 | 1029 ;---- Interface to Graphic Functions (12 byte) |
582 | 1030 win_leftx2 res 1 |
1031 win_top res 1 | |
1032 win_width res 2 | |
1033 win_height res 1 | |
623 | 1034 win_bargraph res 1 ; width of the bargraph bar |
1035 win_color1 res 1 ; 2 byte color | |
1036 win_color2 res 1 ; 2 byte color | |
1037 win_color3 res 1 ; 3 byte color used for display 2 | |
1038 win_color4 res 1 ; 3 byte color used for display 2 | |
1039 win_color5 res 1 ; 3 byte color used for display 2 | |
1040 win_font res 1 ; font size selector | |
560 | 1041 |
623 | 1042 ;---- Interface to Math Functions (16 byte) |
582 | 1043 divA res 2 |
1044 xA res 2 | |
1045 xB res 2 | |
623 | 1046 xC res 4 |
582 | 1047 sub_a res 2 |
1048 sub_b res 2 | |
623 | 1049 sub_c res 2 |
582 | 1050 |
623 | 1051 ;---- Menu System and Views (4 byte) |
1052 menu_pos_cur res 1 ; current position in main menu | |
1053 menu_pos_max res 1 ; highest position in main menu | |
1054 active_premenu res 1 ; currently shown pre-menu (0: none) | |
1055 active_customview res 1 ; currently shown custom view | |
1056 | |
1057 ;---- Miscellaneous (6 byte) | |
1058 batt_voltage res 2 ; battery voltage in mV (no ISR involved) | |
1059 batt_percent res 1 ; battery in percent (1-100%) | |
604 | 1060 message_counter res 1 ; counts amount of messages |
623 | 1061 message_page res 1 ; current message page number |
604 | 1062 pairing_slot res 1 ; slot number, used in transmitter pairing |
1063 | |
623 | 1064 ;---- Dive Mode / all modes (25 byte) |
1065 divesecs_avg_trip res 2 ; time accumulator for the resettable average depth & stopwatch | |
1066 divesecs_avg_total res 2 ; time accumulator for the total dive average depth | |
1067 pressure_rel_avg_trip res 2 ; calculated resettable average depth | |
1068 pressure_rel_avg_total res 2 ; calculated total dive average depth | |
1069 pressure_rel_cur_cached res 2 ; cached current relative pressure | |
1070 pressure_rel_max_cached res 2 ; cached maximum relative pressure | |
1071 pressure_abs_cached res 2 ; cached current absolute pressure | |
1072 pressure_abs_10 res 2 ; cached current absolute pressure divided by 10 | |
1073 depth_meter res 1 ; current depth in meters | |
1074 safety_stop_countdown res 1 ; counter for safety stop | |
1075 dive_timeout_timer res 2 ; timeout timer for leaving dive mode after surfacing | |
582 | 1076 gaslist_gas res 1 ; used for transfer between gaslist.asm and menu_tree.asm |
604 | 1077 best_gas_number res 1 ; number of the "best gas": 0= none found, 1-5= gases 1-5, 255= not computed |
623 | 1078 active_gas res 1 ; the currently used OC/bailout gas (1-5) |
1079 | |
1080 IFDEF _ccr_pscr | |
604 | 1081 best_dil_number res 1 ; number of the "best dil": 0= none found, 1-5= dils 1-5, 255= not computed |
1082 active_dil res 1 ; the currently used diluent (1-5) | |
623 | 1083 ENDIF |
1084 | |
1085 ;---- Dive Mode / apnoe mode (2 byte) | |
1086 apnoe_max_pressure res 2 ; max depth over all dives in the series | |
560 | 1087 |
623 | 1088 ;---- Gas 6 Data (2 byte) |
1089 gas6_O2_ratio res 1 ; gas 6 O2 ratio | |
1090 IFDEF _helium | |
1091 gas6_He_ratio res 1 ; gas 6 He ratio | |
1092 ENDIF | |
582 | 1093 |
623 | 1094 ;---- Profile Recording (6 byte) |
1095 alarm_type res 1 ; | |
1096 event_byte1 res 1 ; | |
1097 event_byte2 res 1 ; | |
1098 CNS_start res 2 ; CNS value at beginning of dive | |
560 | 1099 |
623 | 1100 ;---- External Flash (13 byte) |
582 | 1101 ext_flash_rw res 1 ; transfer register for data read / write |
1102 ext_flash_address res 3 ; 24 bit address | |
1103 ext_flash_log_pointer res 3 ; 24 bit address for logbook profile storing | |
1104 ext_flash_end_pointer res 3 ; 24 bit address for logbook profile storing | |
1105 ext_flash_dive_counter res 3 ; 24 bit counter for dive length (increased in write_byte_ext_flash_plus) | |
1106 | |
623 | 1107 ;---- Battery Management (12 byte) |
1108 battery_capacity_internal res 2 ; for internal battery gauging | |
1109 battery_capacity res 2 ; for battery gauge IC | |
1110 battery_offset res 2 ; for battery gauge IC | |
1111 battery_type res 1 ; =0:1.5V, =1:3.6V Saft, =2:LiIon 3.7V/0.8Ah, =3:LiIon 3.7V/3.1Ah, =4: LiIon 3.7V/2.3Ah | |
1112 battery_accumulated_charge res 2 ; raw values in battery gauge IC | |
1113 battery_temperature res 2 ; battery temperature in 0.1 Kelvin | |
1114 gauge_status_byte res 1 ; gauge IC status byte | |
560 | 1115 |
1116 | |
604 | 1117 ;========================= private Variables =================================== |
582 | 1118 ; do not access from outside of the respective source files! |
560 | 1119 |
623 | 1120 ;---- aa_wordprocessor.asm and strings.asm |
1121 AA_flags res 1 ; various flags for aa_wordprocessor and strings | |
582 | 1122 aa_bitlen res 1 ; count of pixels when decoding bitmaps |
623 | 1123 aa_start res 2 ; PROM pointer to start of encoded bitmap |
582 | 1124 aa_end res 2 ; and end of it |
1125 aa_temp res 2 ; current color, divided by 2 or 4 | |
1126 | |
1127 ;--- adc_lightsensor.asm | |
623 | 1128 get_bat_volt_counter res 1 ; counter for reading the charger chip |
582 | 1129 |
1130 ;---- convert.asm | |
623 | 1131 CVT_flags1 res 1 |
1132 CVT_flags2 res 1 | |
582 | 1133 cvt_temp1 res 1 |
1134 cvt_temp2 res 1 | |
1135 cvt_temp3 res 1 | |
1136 cvt_temp4 res 1 | |
623 | 1137 cvt_temp_lo res 1 |
1138 cvt_temp_hi res 1 | |
582 | 1139 |
1140 ;---- color_processor.asm | |
623 | 1141 overall_pixels res 3 ; used by color_processor.asm |
1142 pixel_count res 2 ; used by color_processor.asm | |
1143 encoding_format res 1 ; image encoding format | |
1144 | |
1145 ;---- compass_ops.asm | |
1146 compass_flags res 1 ; flags are defined in compass_ops.asm | |
582 | 1147 |
1148 ;---- comm.asm | |
623 | 1149 comm_timeout_timer res 1 ; timeout for communication |
582 | 1150 |
1151 ;---- eeprom_rs232.asm | |
623 | 1152 uart_timeout_timer res 3 ; RS232 receive timeout counter |
582 | 1153 |
1154 ;---- i2c.asm | |
1155 i2c_temp1 res 1 ; temporary data | |
1156 i2c_temp2 res 1 ; temporary data | |
1157 | |
623 | 1158 ;---- math.asm |
1159 math_loop res 1 ; loop counter | |
1160 | |
582 | 1161 ;---- menu_processor.asm |
623 | 1162 menustack_pointer res 1 ; pointer to menu stack |
582 | 1163 menu_flags res 1 ; flags for menu entries |
1164 menu_item res 1 ; index of the current item | |
1165 start_item res 1 ; index of the first item (scrolling) | |
1166 item_max res 1 ; number of items in menu | |
1167 selected_item res 1 ; index of the current item | |
1168 value_type res 1 ; type for vertical menu | |
623 | 1169 dynamic_item res 3 ; callback address |
582 | 1170 menu_block res 3 ; address of the menu block (i.e. item 0) |
623 | 1171 menu_title res 3 ; text or procedure for dynamic menu |
582 | 1172 menu_center res 1 ; centering for line menu |
623 | 1173 proc_item res 3 ; address of the current procedure |
582 | 1174 text_item res 2 ; address of the current text |
1175 | |
1176 ;---- options.asm | |
623 | 1177 opt_type res 1 ; option type |
1178 opt_default res 1 ; default value | |
582 | 1179 opt_inc res 1 ; also used for default+1 (string) and enum low |
623 | 1180 opt_min res 1 ; minimum value, also used for enum high |
1181 opt_max res 1 ; maximum value | |
582 | 1182 opt_unit res 2 ; multi-lingual unit text |
623 | 1183 opt_eeprom res 1 ; storage position in EEPROM |
582 | 1184 opt_backup_tbl res 3 ; buffer for table pointer |
1185 | |
1186 ;---- tft.asm | |
623 | 1187 tft_save_top res 1 |
1188 tft_save_height res 1 | |
1189 tft_save_left res 1 | |
1190 tft_save_width res 1 | |
582 | 1191 tft_temp1 res 1 |
1192 tft_temp2 res 1 | |
1193 tft_temp3 res 1 | |
1194 tft_temp4 res 1 | |
1195 | |
623 | 1196 ;---- dump screen Function |
604 | 1197 IFDEF _screendump |
623 | 1198 ds_line res 1 ; current line (0..239) |
1199 ds_column res 1 ; current columnx2 (0..159) | |
1200 ds_pixel res 2 ; current pixel color | |
1201 ds_count res 1 ; repetition count | |
604 | 1202 ENDIF |
1203 | |
582 | 1204 ;---- wait.asm |
1205 wait_counter res 1 | |
1206 | |
623 | 1207 |
1208 ; 193 byte used, 15 byte free (208 byte total) | |
582 | 1209 |
1210 | |
1211 ;============================ LOCAL DATA ====================================== | |
1212 ; Space for various overlayed local data from top-level applications, | |
1213 ; i.e. applications that never run in parallel to each other | |
1214 ; | |
1215 ; --------------------- local Data Users -------------------------------------- | |
623 | 1216 ; |
1217 ; -------------- Applications using ---------------------- | |
582 | 1218 ; Mode local1 local2 local3 |
1219 ; ----------------------------------------------------------------------------- | |
1220 ; sleepmode sleepmode.asm (unused) (unused) | |
1221 ; surfmode surfmode.asm* (unused) (unused) | |
628 | 1222 ; simulator divemode.asm divemode.asm simulator.asm |
604 | 1223 ; divemode divemode.asm divemode.asm ghostwriter.asm |
623 | 1224 ; logbook logbook.asm logbook.asm logbook.asm |
582 | 1225 ; |
1226 ; * assigned to this slot, but currently no local memory used | |
1227 | |
1228 local1 equ 0x1D0 ; Alias for CBLOCK directive | |
1229 local1 udata_ovr 0x1D0 ; Bank1 shared local space | |
1230 res 0x10 ; 16 Byte (0x1D0 ... 0x1DF) | |
1231 | |
1232 local2 equ 0x1E0 ; Alias for CBLOCK directive | |
1233 local2 udata_ovr 0x1E0 ; Bank1 shared local space | |
1234 res 0x10 ; 16 Byte (0x1E0 ... 0x1EF) | |
1235 | |
1236 local3 equ 0x1F0 ; Alias for CBLOCK directive | |
1237 local3 udata_ovr 0x1F0 ; Bank1 shared local space | |
1238 res 0x10 ; 16 Byte (0x1F0 ... 0x1FF) | |
1239 | |
1240 | |
1241 ;---------------------------- Common2 DATA ------------------------------------ | |
623 | 1242 common2 equ 0xA00 ; Alias for "banksel common2" |
1243 common2 udata_ovr common2 ; Bank 10 general variables | |
582 | 1244 |
623 | 1245 ;---- Data for Logging (6 byte), sampled in divemode.asm and used in ghostwriter.asm |
1246 start_year res 1 ; year | ATTENTION: | |
1247 start_month res 1 ; month | do not change the | |
1248 start_day res 1 ; day | position of these | |
1249 start_hour res 1 ; hour | variables relative | |
1250 start_mins res 1 ; minute | to each other! | |
1251 start_secs res 1 ; second, not used, for code commonality | | |
582 | 1252 |
623 | 1253 supersat_start res 1 ; leading tissue supersaturation at beginning of the dive |
1254 | |
1255 ;---- Backup for lost Gas Function (10 byte) | |
1256 opt_gas_type_backup res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco | ATTENTION: | |
1257 opt_dil_type_backup res 5 ; 0=Disabled, 1=First, 2=Normal | (as above) | |
582 | 1258 |
623 | 1259 ;---- O2 Sensors (9 byte, updated by ISR when sensors are connected via datalink) |
1260 IFDEF _external_sensor | |
1261 sensor1_mv res 2 ; sensor 1 voltage in 0.1 mV steps | |
1262 sensor2_mv res 2 ; sensor 2 voltage in 0.1 mV steps | |
1263 sensor3_mv res 2 ; sensor 3 voltage in 0.1 mV steps | |
1264 sensor1_ppO2 res 1 ; sensor 1 ppO2 in 0.01 bar steps | |
1265 sensor2_ppO2 res 1 ; sensor 2 ppO2 in 0.01 bar steps | |
1266 sensor3_ppO2 res 1 ; sensor 3 ppO2 in 0.01 bar steps | |
1267 ENDIF | |
582 | 1268 |
623 | 1269 ;---- last Dive Statistics (7 byte) |
1270 lastdive_duration res 3 ; byte 0= minutes, low byte, 1= minutes, high byte, 2= seconds | |
1271 lastdive_maxdepth res 2 ; in mbar | |
1272 lastdive_avgdepth res 2 ; in mbar | |
582 | 1273 |
623 | 1274 ;---- Backup of last shown Custom View (2 byte) |
582 | 1275 customview_surfmode res 1 ; storage to remember last selected custom view in surface mode |
1276 customview_divemode res 1 ; storage to remember last selected custom view in dive mode | |
1277 | |
623 | 1278 ;---- Miscellaneous (0 byte) |
1279 ;old_velocity res 4 ; stores the last 4 speeds (8 seconds) in m/min | |
1280 | |
1281 ;---- Menu Processor (8 byte) | |
1282 menustack res 8 ; menu stack | |
582 | 1283 |
628 | 1284 ;---- Graphical Compass (15 byte) |
623 | 1285 xRD res 2 ; virtual compass ruler offset |
1286 xRDr res 2 ; virtual compass ruler offset - right end | |
1287 xRD180 res 2 ; virtual compass ruler offset for the -180 marker | |
1288 xLO res 1 ; lo backup to prevent trashing | |
1289 xHI res 1 ; hi backup to prevent trashing | |
1290 xCM res 1 ; compass bearing relative position | |
1291 compass_heading_new res 2 ; corrected heading (in 1°) : -180 .. 180 | |
1292 compass_heading_shown res 2 ; displayed heading | |
1293 compass_bearing res 2 ; displayed bearing | |
582 | 1294 |
623 | 1295 ;---- Compass Arithmetics (30 byte) |
1296 compass_DX res 2 ; raw data | |
1297 compass_DY res 2 ; raw data | |
1298 compass_DZ res 2 ; raw data | |
1299 accel_DX res 2 ; raw data | |
1300 accel_DY res 2 ; raw data | |
1301 accel_DZ res 2 ; raw data | |
1302 compass_DX_f res 2 ; filtered Data | |
1303 compass_DY_f res 2 ; filtered Data | |
1304 compass_DZ_f res 2 ; filtered Data | |
1305 accel_DX_f res 2 ; filtered Data | |
1306 accel_DY_f res 2 ; filtered Data | |
1307 accel_DZ_f res 2 ; filtered Data | |
1308 compass_CX_f res 2 ; calibration data | |
1309 compass_CY_f res 2 ; calibration data | |
1310 compass_CZ_f res 2 ; calibration data | |
582 | 1311 |
623 | 1312 ;---- temporary Data for Q15 Arithmetics (7 byte, compass_ops.asm, called from C) |
1313 compass_a res 2 ; | |
1314 compass_b res 2 ; | |
1315 compass_r res 3 ; | |
1316 | |
1317 ;---- Data Exchange with TR Co-Processor (50 byte) | |
604 | 1318 IFDEF _rx_functions |
1319 rx_buffer res .48 ; Buffer for RX data (slots 0-7) | |
623 | 1320 rx_firmware_cur_major res 1 ; TR module current firmware, major |
1321 rx_firmware_cur_minor res 1 ; TR module current firmware, minor | |
1322 ENDIF | |
604 | 1323 |
628 | 1324 ;---- SAC Calculation on Pressure Readings 1 & 2 (22 byte) |
623 | 1325 IFDEF _rx_functions |
604 | 1326 pres_accu_1st res 4 ; accumulator for pressure drop in 1/160 bar | ATTENTION: do not |
1327 pres_accu_2nd res 4 ; accumulator for pressure drop in 1/160 bar | change the | |
628 | 1328 time_accu_1st res 2 ; accumulator for reading ages in seconds | position |
604 | 1329 gas__last_1st res 1 ; last gas assignment | of these |
628 | 1330 time_accu_2nd res 2 ; accumulator for reading ages in seconds | variables |
604 | 1331 gas__last_2nd res 1 ; last gas assignment | relative |
1332 pres_last_1st res 2 ; last pressure reading pressure in 1/160 bar | to each | |
1333 pres_last_2nd res 2 ; last pressure reading pressure in 1/160 bar | other! | |
1334 time_last_1st res 2 ; last pressure reading time in seconds | | |
1335 time_last_2nd res 2 ; last pressure reading time in seconds | | |
1336 ENDIF | |
1337 | |
623 | 1338 |
1339 ; 166 byte used, 90 byte free | |
582 | 1340 |
1341 | |
604 | 1342 ;----------------------- Bank 2 General Purpose Buffer ------------------------- |
582 | 1343 ; Reserved for general purpose buffer (strings, images, etc). |
1344 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0). | |
1345 | |
1346 buffer udata_ovr 0x200 | |
1347 | |
604 | 1348 buffer res .256 ; used for string assembly / display output |
582 | 1349 |
1350 | |
604 | 1351 ;---------------------- Bank 14 Options Table --------------------------------- |
623 | 1352 opt_table equ 0xE00 ; Alias for "banksel opt_table" |
1353 opt_table udata_ovr opt_table ; Bank 14 options table | |
582 | 1354 |
623 | 1355 ;---- Gas and Diluent Settings |
604 | 1356 opt_gas_O2_ratio res 5 ; O2 ratios of OC/bailout gases | ATTENTION: |
1357 opt_dil_O2_ratio res 5 ; O2 ratios of diluents | keep relative | |
1358 opt_gas_He_ratio res 5 ; He ratios of OC/bailout gases | positioning of | |
1359 opt_dil_He_ratio res 5 ; He ratios of diluents | all arrays in | |
1360 opt_gas_type res 5 ; OC/bailout gas type: O=Disabled, 1=First, 2=Travel, 3=Deco | this block! | |
1361 opt_dil_type res 5 ; dil type: 0=Disabled, 1=First, 2=Normal | | |
1362 opt_gas_change res 5 ; change depths for OC/Bailout gases | | |
1363 opt_dil_change res 5 ; change depths for diluents | | |
1364 | |
623 | 1365 ;---- Setpoints |
1366 opt_setpoint_cbar res 5 ; setpoints in cbar | ATTENTION: keep relative positioning | |
1367 opt_setpoint_change res 5 ; change depth for the setpoints in meter | of these two arrays! | |
582 | 1368 |
623 | 1369 ;---- Dive Mode Settings |
1370 opt_dive_mode res 1 ; main dive/deco mode: =0: OC, =1: CC, =2: Gauge, =3: Apnea, =4: pSCR | |
1371 opt_ccr_mode res 1 ; CCR/pSCR sub mode: =0: fixed/calculated SP, =1: Sensor, =2: Auto SP | |
1372 | |
1373 ;---- custom Text | |
1374 #DEFINE opt_name_length .60 ; custom text string 5 rows with 12 chars | |
1375 opt_name res opt_name_length | |
1376 | |
1377 ;---- various other Settings | |
1378 opt_surface_interval res 1 ; surface interval, used by deco calculator | |
582 | 1379 opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full |
1380 opt_salinity res 1 ; 0-5% | |
604 | 1381 opt_language res 1 ; current language: 0=EN, 1=DE, 2=FR, 3=SP |
582 | 1382 opt_units res 1 ; 0:m/°C, 1:ft/°F |
1383 opt_dateformat res 1 ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
1384 opt_last_stop res 1 ; =3:3m, =4:4m, =5:5m, =6:6m | |
604 | 1385 opt_aGF_high res 1 ; alternative GF HIGH |
1386 opt_aGF_low res 1 ; alternative GF LOW | |
582 | 1387 opt_GF_high res 1 ; GF HIGH |
1388 opt_GF_low res 1 ; GF LOW | |
1389 opt_enable_aGF res 1 ; =1: aGF can be selected underwater | |
1390 opt_compass_gain res 1 ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) | |
1391 opt_sampling_rate res 1 ; =1: 10s, =0: 2s | |
1392 opt_dive_color_scheme res 1 ; 0-3 | |
1393 opt_pressure_adjust res 1 ; SIGNED char (two's complement), -20/+20mbar max. | |
604 | 1394 opt_enable_safetystop res 1 ; =1: a safety stop is shown |
582 | 1395 opt_calibration_O2_ratio res 1 ; %O2 of calibration gas |
604 | 1396 opt_x_s1 res 2 ; calibration factor (Not stored in EEPROM) |
1397 opt_x_s2 res 2 ; calibration factor (Not stored in EEPROM) | |
1398 opt_x_s3 res 2 ; calibration factor (Not stored in EEPROM) | |
582 | 1399 opt_sensor_fallback res 1 ; NOT USED ANY MORE, KEPT FOR COMPATIBILITY WITH EEPROM IMAGE |
604 | 1400 opt_flip_screen res 1 ; =1: flip the screen |
623 | 1401 opt_cR_button_left res 1 ; left button sensitivity (cR hardware) |
604 | 1402 opt_cR_button_right res 1 ; right button sensitivity (cR hardware) |
1403 opt_modwarning res 1 ; =1:do a red blinking warning, =0:default behavior | |
582 | 1404 opt_vsitextv2 res 1 ; =1:use the depth dependent ascend rate limits |
1405 opt_vsigraph res 1 ; =1:draw the graphical VSI bar | |
1406 opt_showppo2 res 1 ; =1:always show the ppO2 value in the warning position | |
1407 opt_temperature_adjust res 1 ; SIGNED char (two's complement), -2.0/+2.0 °C max. | |
1408 opt_safety_stop_length res 1 ; [s] | |
1409 opt_safety_stop_start res 1 ; [cbar] | |
1410 opt_safety_stop_end res 1 ; [cbar] | |
1411 opt_safety_stop_reset res 1 ; [cbar] | |
604 | 1412 opt_diveTimeout res 1 ; timeout for dive mode [min] |
582 | 1413 opt_sim_setpoint_number res 1 ; setpoint to use for deco calculation |
1414 opt_calc_asc_gasvolume res 1 ; calculate OC gas volume needs for ascent | |
1415 opt_sim_use_aGF res 1 ; =0: use GF, =1: use aGF for deco calculation | |
1416 opt_enable_IBCD res 1 ; enable IBCD warning | |
1417 opt_sat_multiplier_gf res 1 ; Buhlmann safety factor for GF deco | |
1418 opt_desat_multiplier_gf res 1 ; Buhlmann safety factor for GF deco | |
1419 opt_sat_multiplier_non_gf res 1 ; Buhlmann safety factor for NON-GF deco | |
1420 opt_desat_multiplier_non_gf res 1 ; Buhlmann safety factor for NON-GF deco | |
604 | 1421 opt_ZfactorUse res 1 ; =1: figure in compression factor Z when converting gas volume <-> gas pressure |
1422 opt_ZfactorTemp res 1 ; temperature setpoint for compression factor Z | |
1423 opt_2ndDepthDisp res 1 ; =1: show average depth instead of max depth | |
623 | 1424 opt_max_depth res 1 ; depth at which a warning will be given |
1425 opt_store_apnoe_dive res 1 ; =1: store dives in apnoe mode into logbook | |
1426 opt_tissue_graphics res 1 ; =0: show N2 and He pressures, =1: show pressures and saturations | |
1427 opt_logoffset_step res 1 ; step size when adjusting log offset | |
1428 opt_layout res 1 ; initial layout of dive mode screen | |
1429 opt_extended_stops res 1 ; =1: place gas switches also below 1st stop depth | |
604 | 1430 |
623 | 1431 ;---- RX Function Settings |
604 | 1432 opt_transmitter_id_1 res 2 ; 16 bit transmitter ID for Gas 1 |
1433 opt_transmitter_id_2 res 2 ; 16 bit transmitter ID for Gas 2 | |
1434 opt_transmitter_id_3 res 2 ; 16 bit transmitter ID for Gas 3 | |
1435 opt_transmitter_id_4 res 2 ; 16 bit transmitter ID for Gas 4 | |
1436 opt_transmitter_id_5 res 2 ; 16 bit transmitter ID for Gas 5 | |
1437 opt_transmitter_id_6 res 2 ; 16 bit transmitter ID for Dil 1 | |
1438 opt_transmitter_id_7 res 2 ; 16 bit transmitter ID for Dil 2 | |
1439 opt_transmitter_id_8 res 2 ; 16 bit transmitter ID for Dil 3 | |
1440 opt_transmitter_id_9 res 2 ; 16 bit transmitter ID for Dil 4 | |
1441 opt_transmitter_id_10 res 2 ; 16 bit transmitter ID for Dil 5 | |
1442 opt_TR_mode res 1 ; TR functions - mode | |
1443 opt_TR_1st_pres res 1 ; TR functions - 1st pressure assignment | |
1444 opt_TR_2nd_pres res 1 ; TR functions - 2nd pressure assignment | |
1445 opt_TR_Bail_pres res 1 ; TR functions - bailout pressure assignment | |
1446 | |
623 | 1447 ; ==> 187 bytes used - 57 bytes free (244 usable bytes only in bank 14 as the upper 12 |
1448 ; bytes may be used for SFRs on some PIC devices) | |
582 | 1449 |
1450 ;----------------------------------------------------------------------------- |