comparison src/hwos.inc @ 623:c40025d8e750

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