Mercurial > public > hwos_code
comparison src/customview.asm @ 623:c40025d8e750
3.03 beta released
author | heinrichsweikamp |
---|---|
date | Mon, 03 Jun 2019 14:01:48 +0200 |
parents | d866684249bd |
children | cd58f7fc86db |
comparison
equal
deleted
inserted
replaced
622:02d1386429a6 | 623:c40025d8e750 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File customview.asm REFACTORED VERSION V2.99e | 3 ; File customview.asm combined next generation V3.03.2 |
4 ; | 4 ; |
5 ; Custom Views in Surface and Dive Mode | 5 ; Custom Views in Surface and Dive Mode |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
13 | 13 |
14 #include "hwos.inc" ; mandatory header | 14 #include "hwos.inc" ; mandatory header |
15 #include "tft_outputs.inc" | 15 #include "tft_outputs.inc" |
16 #include "strings.inc" | 16 #include "strings.inc" |
17 #include "tft.inc" | 17 #include "tft.inc" |
18 #include "isr.inc" | |
19 #include "wait.inc" | 18 #include "wait.inc" |
20 #include "surfmode.inc" | 19 #include "surfmode.inc" |
21 #include "convert.inc" | 20 #include "convert.inc" |
22 #include "divemode.inc" | 21 #include "divemode.inc" |
23 #include "i2c.inc" | 22 #include "i2c.inc" |
24 #include "start.inc" | 23 #include "start.inc" |
25 | 24 |
26 | 25 |
27 extern gaslist_strcat_gas_cd | 26 extern gaslist_strcat_gas_cd |
28 extern char_I_deco_model | 27 extern char_I_deco_model |
28 | |
29 IFDEF _compass | |
29 extern TFT_surface_compass_mask | 30 extern TFT_surface_compass_mask |
30 extern TFT_dive_compass_mask | 31 extern TFT_dive_compass_mask |
32 ENDIF | |
33 | |
31 | 34 |
32 custview CODE | 35 custview CODE |
36 | |
37 ;----------------------------------------------------------------------------- | |
38 | |
33 | 39 |
34 ;============================================================================= | 40 ;============================================================================= |
35 ; Jump table for the every-second tasks for the custom view area (dive mode) | 41 ; Jump table for the every-second tasks for the custom view area (dive mode) |
36 ; | 42 ; |
37 ; Attention: the ordering must be in line with the init jump table and the | 43 ; Attention: the ordering must be in line with the init jump table and the |
38 ; index numbers defined in hwos.inc! | 44 ; index numbers defined in hwos.inc! |
39 | 45 |
40 global customview_second | 46 global dive_customview_second |
41 customview_second: | 47 dive_customview_second: |
42 movf menupos3,W ; copy current view (1-...) | 48 movf active_customview,W ; get current view |
43 dcfsnz WREG,F ; 1: | 49 dcfsnz WREG,F ; 1: |
44 goto TFT_avr_stopwatch ; average depth and stopwatch | 50 goto TFT_avr_stopwatch ; average depth and stopwatch |
45 dcfsnz WREG,F ; 2: | 51 dcfsnz WREG,F ; 2: |
46 return ; compass - will be updated separately (faster) in divemode | 52 return ; compass - will be updated separately (faster) in dive mode |
47 dcfsnz WREG,F ; 3: | 53 dcfsnz WREG,F ; 3: |
54 IFDEF _external_sensor | |
48 goto TFT_ppo2_sensors ; ppO2 sensors | 55 goto TFT_ppo2_sensors ; ppO2 sensors |
56 ELSE | |
57 return ; not available without external sensors | |
58 ENDIF | |
49 dcfsnz WREG,F ; 4: | 59 dcfsnz WREG,F ; 4: |
60 IFDEF _ccr_pscr | |
50 goto TFT_sensor_check ; sensor check | 61 goto TFT_sensor_check ; sensor check |
62 ELSE | |
63 return ; not available without CCR / pSCR mode | |
64 ENDIF | |
51 dcfsnz WREG,F ; 5; | 65 dcfsnz WREG,F ; 5; |
66 IFDEF _ccr_pscr | |
52 goto TFT_pscr_info ; pSCR data | 67 goto TFT_pscr_info ; pSCR data |
68 ELSE | |
69 return ; not available without CCR / pSCR mode | |
70 ENDIF | |
53 dcfsnz WREG,F ; 6: | 71 dcfsnz WREG,F ; 6: |
54 IFDEF _rx_functions | 72 IFDEF _rx_functions |
55 goto TFT_pressures_SAC ; tank pressure and SAC rate | 73 goto TFT_pressures_SAC ; tank pressure and SAC rate |
56 ELSE | 74 ELSE |
57 return ; not available without RX functions | 75 return ; not available without RX functions |
65 dcfsnz WREG,F ; 10: | 83 dcfsnz WREG,F ; 10: |
66 goto TFT_CNS ; CNS values | 84 goto TFT_CNS ; CNS values |
67 dcfsnz WREG,F ; 11: | 85 dcfsnz WREG,F ; 11: |
68 goto TFT_ppo2_ead_end_cns ; ppO2, END/EAD and CNS | 86 goto TFT_ppo2_ead_end_cns ; ppO2, END/EAD and CNS |
69 dcfsnz WREG,F ; 12: | 87 dcfsnz WREG,F ; 12: |
70 return ; GF factors - only static data | 88 return ; GF factors - static only |
71 dcfsnz WREG,F ; 13: | 89 dcfsnz WREG,F ; 13: |
72 goto TFT_clock_batt_surfpress ; clock, battery and surface pressure | 90 goto TFT_clock_batt_surfpress ; clock, battery and surface pressure |
73 return ; menupos3 = 0 -> do nothing | 91 return ; active_customview = 0 -> do nothing |
74 | 92 |
75 | 93 ;----------------------------------------------------------------------------- |
76 global customview_alternative_second | |
77 customview_alternative_second: | |
78 movf menupos3,W ; copy current view (0-...) | |
79 dcfsnz WREG,F | |
80 nop ; view 1 | |
81 dcfsnz WREG,F | |
82 nop ; view 2 | |
83 ;bra customview_alt_second_view0 ; default view | |
84 | |
85 customview_alt_second_view0: | |
86 bsf FLAG_TFT_big_deco_alt | |
87 return | |
88 | |
89 ;============================================================================= | |
90 ; Do every-minute tasks for the custom view area | |
91 | |
92 global customview_minute | |
93 customview_minute: ; called from dive mode, call disabled at present | |
94 return | |
95 ; movf menupos3,W ; copy | |
96 ; dcfsnz WREG,F | |
97 ; bra customview_1min_view1 | |
98 ; dcfsnz WREG,F | |
99 ; bra customview_1min_view2 | |
100 ; dcfsnz WREG,F | |
101 ; bra customview_1min_view3 | |
102 ; dcfsnz WREG,F | |
103 ; bra customview_1min_view4 | |
104 ; dcfsnz WREG,F | |
105 ; bra customview_1min_view5 | |
106 ; dcfsnz WREG,F | |
107 ; bra customview_1min_view6 | |
108 ; dcfsnz WREG,F | |
109 ; bra customview_1min_view7 | |
110 ; dcfsnz WREG,F | |
111 ; bra customview_1min_view8 | |
112 ; dcfsnz WREG,F | |
113 ; bra customview_1min_view9 | |
114 ; dcfsnz WREG,F | |
115 ; bra customview_1min_view10 | |
116 ; dcfsnz WREG,F | |
117 ; bra customview_1min_view11 | |
118 ; ; menupos3=0, do nothing | |
119 ; return | |
120 ; | |
121 ;customview_1min_view1: | |
122 ;customview_1min_view2: | |
123 ;customview_1min_view3: | |
124 ;customview_1min_view4: | |
125 ;customview_1min_view5: | |
126 ;customview_1min_view6: | |
127 ;customview_1min_view7: | |
128 ;customview_1min_view8: | |
129 ;customview_1min_view9: | |
130 ;customview_1min_view10: | |
131 ;customview_1min_view11: | |
132 ;return | |
133 | 94 |
134 global surf_customview_toggle | 95 global surf_customview_toggle |
135 surf_customview_toggle: | 96 surf_customview_toggle: |
136 bcf switch_right | 97 bcf switch_right ; clear button event |
137 incf menupos3,F ; number of custom view to show | 98 incf active_customview,F ; number of custom view to show |
138 | 99 |
100 IFDEF _compass | |
139 movlw .6 ; index of surface custom view compass | 101 movlw .6 ; index of surface custom view compass |
140 cpfseq menupos3 ; will compass be shown in custom view? | 102 cpfseq active_customview ; will compass be shown in custom view? |
141 call I2C_sleep_accelerometer ; NO - stop accelerometer | 103 call I2C_sleep_accelerometer ; NO - stop accelerometer |
142 cpfseq menupos3 ; will compass be shown in custom view? | 104 movlw .6 ; index of surface custom view compass |
105 cpfseq active_customview ; will compass be shown in custom view? | |
143 call I2C_sleep_compass ; NO - stop compass | 106 call I2C_sleep_compass ; NO - stop compass |
107 ENDIF | |
144 | 108 |
145 movlw d'10' ; max number of custom views in surface mode | 109 movlw d'10' ; max number of custom views in surface mode |
146 cpfsgt menupos3 ; max reached? | 110 cpfsgt active_customview ; max reached? |
147 bra surf_customview_mask ; NO - show | 111 bra surf_customview_mask ; NO - show |
148 movlw .1 | 112 movlw .1 ; YES - wrap around to 1st view |
149 movwf menupos3 ; reset to one (always one custom view visible) | 113 movwf active_customview ; - ... |
114 ;bra surf_customview_mask ; - show | |
115 | |
150 | 116 |
151 global surf_customview_mask | 117 global surf_customview_mask |
152 surf_customview_mask: | 118 surf_customview_mask: |
153 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right | 119 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right |
154 ; Prepare title | 120 WIN_TINY surf_customview_title_column,surf_customview_title_row ; set title position |
155 WIN_TINY surf_customview_title_column,surf_customview_title_row | 121 WIN_COLOR color_greenish ; set title color |
156 WIN_COLOR color_greenish | 122 |
157 movf menupos3,W ; menupos3 holds number of custom view function | 123 movf active_customview,W ; get custom view to show |
124 movff WREG,customview_surfmode ; save number for later recall | |
158 dcfsnz WREG,F ; 1: | 125 dcfsnz WREG,F ; 1: |
159 bra surf_customview_init_view1 ; OC gas list | 126 bra surf_customview_init_view1 ; OC gas list |
160 dcfsnz WREG,F ; 2: | 127 dcfsnz WREG,F ; 2: |
161 bra surf_customview_init_view2 ; CC dil list | 128 bra surf_customview_init_view2 ; CC dil list |
162 dcfsnz WREG,F ; 3: | 129 dcfsnz WREG,F ; 3: |
173 bra surf_customview_init_view8 ; last dive info | 140 bra surf_customview_init_view8 ; last dive info |
174 dcfsnz WREG,F ; 9: | 141 dcfsnz WREG,F ; 9: |
175 bra surf_customview_init_view9 ; sensor mV readings | 142 bra surf_customview_init_view9 ; sensor mV readings |
176 dcfsnz WREG,F ; 10: | 143 dcfsnz WREG,F ; 10: |
177 bra surf_customview_init_view10 ; tank data | 144 bra surf_customview_init_view10 ; tank data |
178 bra surf_customview_init_view4 ; default view after restart and loading new firmware | 145 bra surf_customview_init_view4 ; default view after restart and loading of new firmware |
146 | |
179 | 147 |
180 surf_customview_init_view1: ; view 1: OC Gas list | 148 surf_customview_init_view1: ; view 1: OC Gas list |
181 btfsc FLAG_gauge_mode | 149 btfsc FLAG_gauge_mode ; in gauge mode? |
182 bra surf_customview_toggle | 150 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view |
183 btfsc FLAG_apnoe_mode | 151 btfsc FLAG_apnoe_mode ; in apnoe mode? |
184 bra surf_customview_toggle | 152 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view |
185 btfss FLAG_oc_mode | 153 IFDEF _ccr_pscr |
186 bra surf_customview_init_view1a ; bailout version of "OC Gas List" | 154 btfss FLAG_oc_mode ; in OC mode? |
187 STRCPY_TEXT_PRINT tGaslist ; title of custom view / OC mode | 155 bra surf_customview_init_view1a ; NO - (1) |
188 bra surf_customview_init_view1b | 156 ENDIF |
157 STRCPY_TEXT_PRINT tGaslist ; YES - title of custom view / OC mode | |
158 IFDEF _ccr_pscr | |
159 bra surf_customview_init_view1b ; - continue with common part | |
189 surf_customview_init_view1a: | 160 surf_customview_init_view1a: |
190 STRCPY_TEXT_PRINT tDiveBailout ; title of custom view / CCR & pSCR mode | 161 STRCPY_TEXT_PRINT tDiveBailout ; (1) - title of custom view / CCR & pSCR mode |
191 surf_customview_init_view1b: ; remaining common part | 162 ENDIF |
192 call TFT_standard_color | 163 surf_customview_init_view1b: |
164 call TFT_standard_color ; set color | |
193 call TFT_gaslist_surfmode ; show gas list | 165 call TFT_gaslist_surfmode ; show gas list |
194 bra customview_toggle_exit ; done | 166 bra customview_toggle_exit ; done |
195 | 167 |
168 | |
196 surf_customview_init_view2: ; view 2: CCR / pSCR diluent list | 169 surf_customview_init_view2: ; view 2: CCR / pSCR diluent list |
197 btfsc FLAG_ccr_mode | 170 IFDEF _ccr_pscr |
198 bra surf_customview_init_view2a | 171 btfsc FLAG_ccr_mode ; in CCR mode? |
199 btfsc FLAG_pscr_mode | 172 bra surf_customview_init_view2a ; YES - (1) |
200 bra surf_customview_init_view2a | 173 btfsc FLAG_pscr_mode ; in pSCR mode? |
201 bra surf_customview_toggle | 174 bra surf_customview_init_view2a ; YES - (1) |
175 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
202 surf_customview_init_view2a: | 176 surf_customview_init_view2a: |
203 STRCPY_TEXT_PRINT tGaslistCC ; title of custom view | 177 STRCPY_TEXT_PRINT tGaslistCC ; (1) - title of custom view |
204 call TFT_standard_color | 178 call TFT_standard_color ; - set color |
205 call TFT_dillist_surfmode ; show diluent list | 179 call TFT_dillist_surfmode ; - show diluent list |
206 bra customview_toggle_exit ; done | 180 bra customview_toggle_exit ; - done |
181 ELSE | |
182 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
183 ENDIF | |
184 | |
207 | 185 |
208 surf_customview_init_view3: ; view 3: CC SP list | 186 surf_customview_init_view3: ; view 3: CC SP list |
209 btfsc FLAG_ccr_mode | 187 IFDEF _ccr_pscr |
210 bra surf_customview_init_view3a | 188 btfss FLAG_ccr_mode ; in CCR mode? |
211 bra surf_customview_toggle | 189 bra surf_customview_toggle ; NO - not available if not in CCR mode, goto next view |
212 surf_customview_init_view3a: | 190 STRCPY_TEXT_PRINT tFixedSetpoints ; YES - title of custom view |
213 STRCPY_TEXT_PRINT tFixedSetpoints ; title of custom view | 191 call TFT_standard_color ; - set color |
214 call TFT_standard_color | 192 call TFT_splist_surfmode ; - show setpoint list |
215 call TFT_splist_surfmode ; show setpoint list | 193 bra customview_toggle_exit ; - done |
216 bra customview_toggle_exit ; done | 194 ELSE |
195 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
196 ENDIF | |
197 | |
217 | 198 |
218 surf_customview_init_view9: ; view 9: sensor mV at the surface | 199 surf_customview_init_view9: ; view 9: sensor mV at the surface |
219 btfsc FLAG_ccr_mode | 200 IFDEF _external_sensor |
220 bra surf_customview_init_view9a ; we are in CCR mode | 201 btfsc FLAG_ccr_mode ; in CCR mode? |
221 btfsc FLAG_pscr_mode | 202 bra surf_customview_init_view9a ; YES - (1) |
222 bra surf_customview_init_view9a ; we are in PSCR mode | 203 btfsc FLAG_pscr_mode ; in pSCR mode? |
223 bra surf_customview_toggle ; we are not in any rebreather mode, so skip | 204 bra surf_customview_init_view9a ; YES - (1) |
205 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
224 surf_customview_init_view9a: | 206 surf_customview_init_view9a: |
225 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: Sensor, =2: auto SP | 207 movff opt_ccr_mode,WREG ; (1) - get SP mode (0: fixed SP, 1: Sensor, 2: auto SP) |
226 sublw .1 ; opt_ccr_mode = 1 (sensor)? | 208 sublw .1 ; - opt_ccr_mode = 1 (sensor)? |
227 bnz surf_customview_toggle ; sorry, no sensors, skip again | 209 bnz surf_customview_toggle ; NO - goto next view |
228 STRCPY_TEXT_PRINT tSensorMilliVolt ; title of custom view | 210 STRCPY_TEXT_PRINT tSensorMilliVolt ; YES - title of custom view |
229 call TFT_sensor_mV ; write sensor mV readings to screen | 211 call TFT_standard_color ; - set color |
230 bra customview_toggle_exit ; done | 212 call TFT_sensor_mV ; - write sensor mV readings to screen |
213 bra customview_toggle_exit ; - done | |
214 ELSE | |
215 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
216 ENDIF | |
217 | |
231 | 218 |
232 surf_customview_init_view4: ; view 4: custom text | 219 surf_customview_init_view4: ; view 4: custom text |
220 call TFT_standard_color ; set color | |
233 call TFT_custom_text ; show the custom text | 221 call TFT_custom_text ; show the custom text |
234 bra customview_toggle_exit ; done | 222 bra customview_toggle_exit ; done |
235 | 223 |
224 | |
236 surf_customview_init_view5: ; view 5: tissue diagram | 225 surf_customview_init_view5: ; view 5: tissue diagram |
237 btfsc FLAG_gauge_mode | 226 btfsc FLAG_gauge_mode ; in gauge mode? |
238 bra surf_customview_toggle | 227 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view |
239 btfsc FLAG_apnoe_mode | 228 btfsc FLAG_apnoe_mode ; in apnoe mode? |
240 bra surf_customview_toggle | 229 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view |
241 call TFT_standard_color | 230 call TFT_standard_color ; set color |
242 call TFT_surface_tissues ; show tissue diagram | 231 call TFT_surface_tissues ; show tissue diagram |
243 bra customview_toggle_exit ; done | 232 bra customview_toggle_exit ; done |
244 | 233 |
234 | |
245 surf_customview_init_view6: ; view 6: compass | 235 surf_customview_init_view6: ; view 6: compass |
236 IFDEF _compass | |
246 call I2C_init_accelerometer ; start accelerometer | 237 call I2C_init_accelerometer ; start accelerometer |
247 call I2C_init_compass ; start compass | 238 call I2C_init_compass ; start compass |
248 call TFT_surface_compass_mask ; show compass mask | 239 call TFT_surface_compass_mask ; show compass mask |
249 bra customview_toggle_exit ; done | 240 bra customview_toggle_exit ; done |
250 | 241 ELSE |
251 surf_customview_init_view7: | 242 bra surf_customview_toggle ; not available without compass compiled in, goto next view |
252 btfsc FLAG_gauge_mode ; view 7: deco settings | 243 ENDIF |
253 bra surf_customview_toggle | 244 |
254 btfsc FLAG_apnoe_mode | 245 |
255 bra surf_customview_toggle | 246 surf_customview_init_view7: ; view 7: deco settings |
247 btfsc FLAG_gauge_mode ; in gauge mode? | |
248 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
249 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
250 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
256 call TFT_surface_decosettings ; show all deco settings | 251 call TFT_surface_decosettings ; show all deco settings |
257 bra customview_toggle_exit ; done | 252 bra customview_toggle_exit ; done |
258 | 253 |
254 | |
259 surf_customview_init_view8: ; view 8: last dive info | 255 surf_customview_init_view8: ; view 8: last dive info |
260 call TFT_surface_lastdive ; show last dive interval | 256 call TFT_standard_color ; set color |
257 call TFT_surface_lastdive ; show last dive info | |
261 bra customview_toggle_exit ; done | 258 bra customview_toggle_exit ; done |
262 | 259 |
263 surf_customview_init_view10: ; transmitter data / debug | 260 |
261 surf_customview_init_view10: ; view 10: transmitter data / debug | |
264 IFDEF _rx_functions | 262 IFDEF _rx_functions |
265 btfss FLAG_tr_enabled ; TR functions enabled? | 263 btfss tr_functions_activated ; TR functions activated? |
266 bra surf_customview_toggle ; NO - show next view in list | 264 bra surf_customview_toggle ; NO - show next view in list |
267 STRCAT_PRINT "ID bar Volt" ; title of custom view (none language-dependent) | 265 STRCAT_PRINT "ID bar Volt" ; YES - title of custom view (none language-dependent) |
268 call TFT_surface_tankdata | 266 call TFT_surface_tankdata ; - show received data |
269 bra customview_toggle_exit ; done | 267 bra customview_toggle_exit ; - done |
270 ELSE | 268 ELSE |
271 bra surf_customview_toggle | 269 bra surf_customview_toggle ; not available without RX functions compiled in, goto next view |
272 ENDIF | 270 ENDIF |
273 | 271 |
274 | 272 ;----------------------------------------------------------------------------- |
275 global switch_layout_to_normal | |
276 switch_layout_to_normal: ; switch back from alternative to normal layout | |
277 ; needs custom view to be selected / restored separately! | |
278 bcf alternative_divelayout ; clear flag | |
279 bsf FLAG_TFT_divemode_mask ; set flag for normal layout mask | |
280 bsf FLAG_TFT_max_depth ; set flag for normal layout data | |
281 btfss decostop_active ; deco? | |
282 bsf FLAG_TFT_display_ndl_mask ; NO - set flag for normal layout NDL data | |
283 btfsc decostop_active ; deco? | |
284 bsf FLAG_TFT_display_deko_mask ; YES - set flag for normal layout deco data | |
285 clrf menupos3 ; set to no active custom view | |
286 call TFT_ClearScreen ; clear the whole screen | |
287 return | |
288 | |
289 | 273 |
290 global menuview_toggle | 274 global menuview_toggle |
291 menuview_toggle: ; show menu or the simulator tasks | 275 menuview_toggle: ; show main menu or the pre-menu |
292 bcf switch_left | 276 bcf switch_left ; clear button event |
293 btfss alternative_divelayout ; in alternative layout mode? | 277 movlw divemode_timeout_premenu ; get timeout for dive mode pre-menu |
294 bra menuview_toggle2 ; NO - continue with menu or simulator tasks | 278 call reset_timeout_time ; reset timeout |
295 rcall switch_layout_to_normal ; YES - switch back to normal layout | 279 bsf dive_options_menu ; flag that the dive options menu is shown |
296 movff customview_divemode,menupos3; - restore the custom view shown in normal layout | 280 incf active_premenu,F ; current number of pre-menu item |
297 rcall customview_mask ; - re-draw the custom view | 281 movlw d'10' ; max number of pre-menu items |
298 bra menuview_toggle_reset ; - suppress the menu when returning from alternative layout | 282 cpfsgt active_premenu ; max reached? |
299 | 283 bra menuview_mask ; NO - show item |
300 menuview_toggle2: | 284 ;bra menuview_toggle_reset ; YES - reset selector |
301 movlw divemode_menuview_timeout | 285 |
302 movwf timeout_counter2 | |
303 bsf menuview ; flag that the options menu is shown | |
304 incf menupos2,F ; number of option to show | |
305 movlw d'10' ; max number of options in divemode | |
306 cpfsgt menupos2 ; max reached? | |
307 bra menuview_mask ; NO - show option | |
308 global menuview_toggle_reset | 286 global menuview_toggle_reset |
309 menuview_toggle_reset: ; timeout occurred, beyond max number of options, or item executed | 287 menuview_toggle_reset: ; timeout occurred, beyond max number of options, or item executed |
310 clrf menupos2 ; reset option selector | 288 clrf active_premenu ; reset pre-menu selector |
311 bcf menuview ; revoke options menu if shown | 289 bcf dive_options_menu ; the dive options menu is not shown anymore |
312 menuview_mask: | 290 menuview_mask: |
313 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.46 ; top, bottom, left, right | 291 WIN_BOX_BLACK dm_premenu_row, dm_premenu_bot, dm_premenu_col, dm_premenu_rgt ; top, bottom, left, right |
314 btfss FLAG_gauge_mode ; in gauge mode? | 292 tstfsz active_premenu ; any pre-menu selected? |
315 bra menuview_mask2 ; NO | 293 bra menuview_items ; YES - display menu item |
316 ; YES - clear some more in gauge mode -- "Reset Avg." text is longer than all the other texts | 294 bcf win_invert ; NO - end inverse printing |
317 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.47, dm_simtext_column+.70 ; top, bottom, left, right | 295 btfss FLAG_apnoe_mode ; - in apnoe mode? |
318 menuview_mask2: | 296 goto TFT_show_temp_divemode ; YES - restore temperature and done |
319 call TFT_draw_gassep_line | 297 goto TFT_standard_color ; NO - done |
320 movlw color_yellow | 298 menuview_items: |
321 call TFT_set_color | 299 call TFT_attention_color ; set color |
322 bsf win_invert ; set invert flag | 300 bsf win_invert ; set inverse printing |
323 WIN_SMALL dm_simtext_column,dm_simtext_row | 301 WIN_SMALL dm_premenu_col,dm_premenu_row |
324 movf menupos2,W ; menupos2 holds number of menu option to show | 302 movf active_premenu,W ; get active pre-menu item |
325 dcfsnz WREG,F | 303 dcfsnz WREG,F |
326 bra menuview_view_gaschange ; check if a better gas/diluent is advised and prompt for switching if yes | 304 bra menuview_view_gaschange ; check if a better gas/diluent is advised and prompt for switching if yes |
327 dcfsnz WREG,F | 305 dcfsnz WREG,F |
328 bra menuview_view1 ; "Menu?" (skipped in gauge and apnoe modes) | 306 bra menuview_view1 ; "Menu?" (skipped in gauge and apnoe modes) |
329 dcfsnz WREG,F | 307 dcfsnz WREG,F |
330 bra menuview_view2 ; "Quit?" (in simulation mode only) | 308 bra menuview_view2 ; "Quit?" (in simulation mode only) |
331 dcfsnz WREG,F | 309 dcfsnz WREG,F |
332 bra menuview_view3 ; "Sim-1m" (in simulation mode only) | 310 bra menuview_view3 ; "Sim-1m" (in simulation mode only) |
333 dcfsnz WREG,F | 311 dcfsnz WREG,F |
334 bra menuview_view4 ; "Sim+1m" (in simulation mode only) | 312 bra menuview_view4 ; "Sim+1m" (in simulation mode only) |
335 dcfsnz WREG,F | 313 dcfsnz WREG,F |
336 bra menuview_view5 ; "Quit?" (in apnoe mode only) | 314 bra menuview_view5 ; "Quit?" (in apnoe mode only) |
337 dcfsnz WREG,F | 315 dcfsnz WREG,F |
338 bra menuview_view6 ; "Reset Avr." (in gauge mode only) | 316 bra menuview_view6 ; "Reset Avr" (in gauge mode only) |
339 dcfsnz WREG,F | 317 dcfsnz WREG,F |
340 bra menuview_view7 ; "Sim+5'" (in simulation mode only) | 318 bra menuview_view7 ; "Sim+5'" (in simulation mode only) |
341 dcfsnz WREG,F | 319 dcfsnz WREG,F |
342 bra menuview_view8 ; "Heading" (only when compass is shown) | 320 bra menuview_view8 ; "Course" (only when compass is shown) |
343 dcfsnz WREG,F | 321 dcfsnz WREG,F |
344 bra menuview_view9 ; "Layout" (offer alternative layout, aka blind mode) | 322 bra menuview_view9 ; "Layout" (offer alternative layout, aka blind mode) |
345 | 323 |
346 menuview_exit: | 324 menuview_exit: |
347 call TFT_standard_color | 325 call TFT_standard_color |
348 bcf win_invert ; reset invert flag | 326 bcf win_invert ; reset invert flag |
349 btfss alternative_divelayout ; in alternative layout? | 327 return ; active pre-menu = 0, i.e. show nothing |
350 bsf FLAG_TFT_active_gas_divemode; NO - redraw gas and setpoint (eventually needed to restore the "Bailout" text) | |
351 return ; menupos2 = 0, show nothing | |
352 | 328 |
353 | 329 |
354 menuview_view_gaschange: | 330 menuview_view_gaschange: |
355 btfsc divemode_gaschange ; last gas change done yet? | 331 btfsc request_gaschange ; last gas change request executed yet? |
356 bra menuview_toggle ; NO - call next option | 332 bra menuview_toggle ; NO - call next option |
333 IFDEF _ccr_pscr | |
357 btfsc FLAG_oc_mode ; in OC mode? | 334 btfsc FLAG_oc_mode ; in OC mode? |
358 bra menuview_view_gaschange_OC ; YES | 335 bra menuview_view_gaschange_OC ; YES |
359 btfsc FLAG_bailout_mode ; in bailout? | 336 btfsc bailout_mode ; in bailout? |
360 bra menuview_view_gaschange_OC ; YES | 337 bra menuview_view_gaschange_OC ; YES |
361 menuview_view_gaschange_DIL: | 338 menuview_view_gaschange_DIL: |
362 btfss better_dil_available ; is the better diluent still available? | 339 btfss better_dil_available ; is the better diluent still available? |
363 bra menuview_toggle ; NO - call next option | 340 bra menuview_toggle ; NO - call next option |
364 movff best_dil_number,PRODL ; number (1-5) of the "best diluent" | 341 movff best_dil_number,PRODL ; number (1-5) of the "best diluent" |
365 bsf FLAG_diluent_setup ; flag to use diluents | 342 bsf is_diluent_menu ; setting up diluents |
366 bra menuview_view_gaschange_com | 343 bra menuview_view_gaschange_com |
344 ENDIF | |
367 menuview_view_gaschange_OC: | 345 menuview_view_gaschange_OC: |
368 btfss better_gas_available ; is the better gas still available? | 346 btfss better_gas_available ; is the better gas still available? |
369 bra menuview_toggle ; NO - call next option | 347 bra menuview_toggle ; NO - call next option |
370 movff best_gas_number,PRODL ; number (1-5) of the "best gas" | 348 movff best_gas_number,PRODL ; number (1-5) of the "best gas" |
371 bcf FLAG_diluent_setup ; flag to use oc gases | 349 bcf is_diluent_menu ; setting up OC gases |
372 menuview_view_gaschange_com: | 350 menuview_view_gaschange_com: |
373 decf PRODL,F ; (1-5) -> (0-4) | 351 decf PRODL,F ; (1-5) -> (0-4) |
374 bsf short_gas_decriptions ; =1: use short version of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | 352 bsf short_gas_descriptions ; use short version of gaslist_strcat_gas_cd and gaslist_strcat_setpoint |
375 bsf better_gas_hint ; color-code as best gas/diluent | 353 bsf better_gas_hint ; color-code as best gas/diluent |
376 call gaslist_strcat_gas_cd ; append gas description of gas #PRODL (0-4) to current string | 354 call gaslist_strcat_gas_cd ; append gas description of gas #PRODL (0-4) to current string |
377 movlw .5 | 355 movlw .5 |
378 movwf FSR2L ; point to 6th character (5 chars are used for the gas/dil description) | 356 movwf FSR2L ; point to 6th character (5 chars are used for the gas/dil description) |
379 STRCAT_PRINT "?" | 357 STRCAT_PRINT "?" |
380 bra menuview_exit ; done | 358 bra menuview_exit ; done |
381 | 359 |
382 menuview_view1: | 360 menuview_view1: |
383 btfsc FLAG_apnoe_mode ; in Apnoe mode? | 361 btfsc FLAG_apnoe_mode ; in apnoe mode? |
384 bra menuview_toggle ; YES - goto next option | 362 bra menuview_toggle ; YES - goto next option |
385 btfsc FLAG_gauge_mode ; in Gauge mode? | 363 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
386 bra menuview_toggle ; YES - goto next option | 364 bra menuview_toggle ; YES - goto next option |
387 STRCPY_TEXT_PRINT tDivePreMenu ; print "Menu?" | 365 PUTC "\xb7" ; NO - print '->' symbol |
388 bra menuview_exit ; done | 366 STRCAT_TEXT_PRINT tDivePreMenu ; - print "Menu?" |
367 bra menuview_exit ; - done | |
389 | 368 |
390 menuview_view2: | 369 menuview_view2: |
391 btfss simulatormode_active ; in simulator mode? | 370 btfss simulatormode ; in simulator mode? |
371 bra menuview_toggle ; NO - goto next option | |
372 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Simulation?" | |
373 bra menuview_exit ; - done | |
374 | |
375 menuview_view3: | |
376 btfss simulatormode ; in simulator mode? | |
392 bra menuview_toggle ; NO - goto next option | 377 bra menuview_toggle ; NO - goto next option |
393 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Simulation?" | |
394 bra menuview_exit ; done | |
395 | |
396 menuview_view3: | |
397 btfss simulatormode_active ; in simulator mode? | |
398 bra menuview_toggle ; NO - goto next option | |
399 ; STRCPY_PRINT "Sim-1m" ; print "-" for going down | |
400 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down | 378 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down |
401 bra menuview_exit ; done | 379 bra menuview_exit ; done |
402 | 380 |
403 menuview_view4: | 381 menuview_view4: |
404 btfss simulatormode_active ; in simulator mode? | 382 btfss simulatormode ; in simulator mode? |
405 bra menuview_toggle ; NO - goto next option | 383 bra menuview_toggle ; NO - goto next option |
406 ; STRCPY_PRINT "Sim+1m" ; "+" for going up | 384 STRCPY_PRINT "Sim\xb9" ; YES - print up arrow for going up |
407 STRCPY_PRINT "Sim\xb9" ; print up arrow for going up | 385 bra menuview_exit ; - done |
408 bra menuview_exit ; done | |
409 | 386 |
410 menuview_view5: | 387 menuview_view5: |
411 btfss FLAG_apnoe_mode ; in Apnoe mode? | 388 btfss FLAG_apnoe_mode ; in apnoe mode? |
412 bra menuview_toggle ; NO - goto next option | 389 bra menuview_toggle ; NO - goto next option |
413 btfss FLAG_active_descent ; descending? | 390 btfss apnoe_at_surface ; YES - at the surface? |
391 bra menuview_toggle ; NO - goto next option | |
392 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Apnea mode?" | |
393 bra menuview_exit ; - done | |
394 | |
395 menuview_view6: | |
396 btfss FLAG_gauge_mode ; in gauge mode? | |
397 bra menuview_toggle ; NO - goto next option | |
398 STRCPY_TEXT_PRINT tResetAvg ; YES - print "Reset Avg." | |
399 bra menuview_exit ; - done | |
400 | |
401 menuview_view7: | |
402 btfss simulatormode ; in simulator mode? | |
403 bra menuview_toggle ; NO - goto next option | |
404 btfsc FLAG_gauge_mode ; YES - in gauge mode? | |
405 bra menuview_toggle ; YES - goto next option | |
406 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? | |
407 bra menuview_toggle ; YES - goto next option | |
408 STRCPY_PRINT "Sim+5'" ; NO - print "Sim+5'" | |
409 bra menuview_exit ; - done | |
410 | |
411 menuview_view8: | |
412 IFDEF _compass | |
413 movlw index_compass_dm ; index of compass view | |
414 cpfseq active_customview ; in compass view? | |
415 bra menuview_toggle ; NO - goto next option | |
416 STRCPY_TEXT_PRINT tSetHeading ; YES - print "Heading" | |
417 bra menuview_exit ; - done | |
418 ELSE | |
419 bra menuview_toggle ; not available without compass compiled in, goto next option | |
420 ENDIF | |
421 | |
422 menuview_view9: | |
423 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
414 bra menuview_toggle ; YES - goto next option | 424 bra menuview_toggle ; YES - goto next option |
415 ; We are at the surface: | 425 STRCPY_PRINT "Layout" ; NO - print "Layout" |
416 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Apnea mode?" | 426 bra menuview_exit ; - done |
417 bra menuview_exit ; done | 427 |
418 | 428 ;----------------------------------------------------------------------------- |
419 menuview_view6: | |
420 btfss FLAG_gauge_mode ; in Gauge mode? | |
421 bra menuview_toggle ; NO - goto next option | |
422 STRCPY_TEXT_PRINT tDivemenu_ResetAvg; print "Reset Avg." | |
423 bra menuview_exit ; done | |
424 | |
425 menuview_view7: | |
426 btfss simulatormode_active ; in simulator mode? | |
427 bra menuview_toggle ; NO - goto next option | |
428 btfsc FLAG_gauge_mode ; in Gauge mode? | |
429 bra menuview_toggle ; YES - goto next option | |
430 btfsc FLAG_apnoe_mode ; in Apnoe mode? | |
431 bra menuview_toggle ; YES - goto next option | |
432 STRCPY_PRINT "Sim+5'" ; print "Sim+5'" | |
433 bra menuview_exit ; done | |
434 | |
435 menuview_view8: | |
436 movlw index_compass_dm ; index of compass view | |
437 cpfseq menupos3 ; in compass view? | |
438 bra menuview_toggle ; NO - goto next option | |
439 STRCPY_TEXT_PRINT tSetHeading ; print "Heading" | |
440 bra menuview_exit ; done | |
441 | |
442 menuview_view9: | |
443 btfsc FLAG_apnoe_mode ; in Apnoe mode? | |
444 bra menuview_toggle ; YES - goto next option | |
445 STRCPY_PRINT "Layout" | |
446 bra menuview_exit ; done | |
447 | |
448 ;============================================================================= | |
449 | |
450 global customview_mask_alternative | |
451 customview_toggle_alternative: | |
452 call I2C_sleep_accelerometer ; no compass in alternative layout - stop accelerometer | |
453 call I2C_sleep_compass ; no compass in alternative layout - stop compass | |
454 movlw d'0' ; max number of custom views in divemode, alternative layout | |
455 cpfsgt menupos3 ; max reached? | |
456 bra customview_mask_alternative ; NO - show | |
457 clrf menupos3 ; reset to zero (zero = default custom view in alternative layout) | |
458 customview_mask_alternative: | |
459 ; Clear custom view area in divemode | |
460 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right | |
461 movf menupos3,W ; menupos3 holds number of custom view function | |
462 dcfsnz WREG,F | |
463 bra customview_alt_init_view1 ; view 1: -- for test only -- | |
464 dcfsnz WREG,F | |
465 nop ; view 2: ... | |
466 ;bra customview_alt_init_view0 ; default view: big deco/ndl and max. depth | |
467 | |
468 customview_alt_init_view0: ; default view: big deco/ndl and max. depth | |
469 call TFT_max_depth_alternative | |
470 call TFT_big_deco_alt | |
471 bra customview_alt_toggle_exit | |
472 | |
473 customview_alt_init_view1: ; view 1 - just for test use | |
474 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch | |
475 call TFT_avr_stopwatch ; data for average depth and stopwatch | |
476 bra customview_alt_toggle_exit | |
477 | |
478 customview_alt_toggle_exit: | |
479 bcf toggle_customview ; clear flag | |
480 return | |
481 | |
482 | 429 |
483 ; Show next dive mode custom view (and delete this flag) | 430 ; Show next dive mode custom view (and delete this flag) |
484 global customview_toggle | 431 global dive_customview_toggle |
485 customview_toggle: | 432 dive_customview_toggle: |
486 bcf switch_right | 433 incf active_customview,F ; increment number of custom view to show |
487 incf menupos3,F ; number of custom view to show | |
488 | |
489 btfsc alternative_divelayout ; in alternative layout mode? | |
490 bra customview_toggle_alternative ; YES - use the big ones instead | |
491 | 434 |
492 movlw index_compass_dm ; index of custom view compass | 435 movlw index_compass_dm ; index of custom view compass |
493 cpfseq menupos3 ; will compass be shown in custom view? | 436 cpfseq active_customview ; will compass be shown in custom view? |
494 call I2C_sleep_accelerometer ; NO - stop accelerometer | 437 call I2C_sleep_accelerometer ; NO - stop accelerometer |
495 cpfseq menupos3 ; will compass be shown in custom view? | 438 movlw index_compass_dm ; index of custom view compass |
439 cpfseq active_customview ; will compass be shown in custom view? | |
496 call I2C_sleep_compass ; NO - stop compass | 440 call I2C_sleep_compass ; NO - stop compass |
497 | 441 |
498 movlw index_cv_dm_max ; highest index in use in dive mode custom view | 442 movlw index_cv_dm_max ; highest index in use in dive mode custom view |
499 cpfsgt menupos3 ; max reached? | 443 cpfsgt active_customview ; max reached? |
500 bra customview_mask ; NO - show | 444 bra dive_customview_mask ; NO - show |
501 clrf menupos3 ; reset to zero (zero = no custom view) | 445 clrf active_customview ; YES - reset to zero (zero = no custom view) |
446 ;bra dive_customview_mask ; - show | |
502 | 447 |
503 ;---------------------------------------------------------------------------------- | 448 ;---------------------------------------------------------------------------------- |
504 ; Jump table for initialization of the every-second tasks in custom view area (dive mode) | 449 ; Jump table for initialization of the every-second tasks in custom view area (dive mode) |
505 ; | 450 ; |
506 ; Attention: the ordering must be in line with the every-second update jump table | 451 ; Attention: the ordering must be in line with the every-second update jump table |
507 ; and the index numbers defined in hwos.inc! | 452 ; and the index numbers defined in hwos.inc! |
508 ; | 453 ; |
509 global customview_mask | 454 global dive_customview_mask |
510 customview_mask: | 455 dive_customview_mask: |
511 bcf redraw_custview_mask ; clear redraw request flag | 456 ; clear custom view area in dive mode |
512 ; Clear custom view area in divemode | |
513 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right | 457 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
514 movf menupos3,W ; menupos3 holds number of custom view function | 458 movf active_customview,W ; get custom view to show |
515 dcfsnz WREG,F ; 1: | 459 dcfsnz WREG,F ; 1: |
516 bra init_avr_stopwatch ; average depth and stopwatch | 460 bra init_avr_stopwatch ; average depth and stopwatch |
517 dcfsnz WREG,F ; 2: | 461 dcfsnz WREG,F ; 2: |
518 bra init_TFT_dive_compass ; compass | 462 bra init_TFT_dive_compass ; compass |
519 dcfsnz WREG,F ; 3: | 463 dcfsnz WREG,F ; 3: |
540 bra init_clock_batt_surfpress ; clock, battery and surface pressure | 484 bra init_clock_batt_surfpress ; clock, battery and surface pressure |
541 bra customview_toggle_exit ; no view (blank screen in custom view area) | 485 bra customview_toggle_exit ; no view (blank screen in custom view area) |
542 | 486 |
543 | 487 |
544 init_ppo2_sensors: | 488 init_ppo2_sensors: |
489 IFDEF _external_sensor | |
490 bsf trigger_temp_changed ; fake a change of the temperature to have the resettable dive time overwritten which was shown with the compass view | |
545 btfsc FLAG_ccr_mode ; in CC mode? | 491 btfsc FLAG_ccr_mode ; in CC mode? |
546 bra customview_init_view1a ; YES | 492 bra customview_init_view1a ; YES - (1) |
547 btfsc FLAG_pscr_mode ; in PSCR mode? | 493 btfsc FLAG_pscr_mode ; in pSCR mode? |
548 bra customview_init_view1a ; YES | 494 bra customview_init_view1a ; YES - (1) |
549 bra customview_toggle ; NO to both, call next view | 495 bra dive_customview_toggle ; NO to both, goto next view |
550 customview_init_view1a: | 496 customview_init_view1a: |
551 btfsc analog_o2_input ; do we have an analog input? | 497 btfsc analog_o2_input ; (1) - do we have an analog input? |
552 bra customview_init_view1b ; YES - show this view | 498 bra customview_init_view1b ; YES - (2) |
553 btfsc s8_digital ; NO - do we have a digital input? | 499 btfsc s8_digital_avail ; NO - do we have a digital S8 interface? |
554 bra customview_init_view1b ; YES - show this view | 500 bra customview_init_view1b ; YES - (2) |
555 btfss optical_input ; NO - do we have an optical input? | 501 btfss optical_input ; NO - do we have an optical input? |
556 bra customview_toggle ; NO - call next view | 502 bra dive_customview_toggle ; NO - goto next view |
557 ; YES - show this view | 503 ; YES - (2) |
558 customview_init_view1b: | 504 customview_init_view1b: |
559 call TFT_ppo2_sensors_mask ; mask for ppO2 sensors | 505 call TFT_ppo2_sensors_mask ; (2) - mask for ppO2 sensors |
560 call TFT_ppo2_sensors ; data for ppO2 sensors | 506 call TFT_ppo2_sensors ; - data for ppO2 sensors |
561 bra customview_toggle_exit | 507 bra customview_toggle_exit ; - done |
508 ELSE | |
509 bra dive_customview_toggle ; not available without external sensors, got next view | |
510 ENDIF | |
562 | 511 |
563 init_avr_stopwatch: | 512 init_avr_stopwatch: |
564 btfsc FLAG_apnoe_mode ; in apnoe mode? | 513 btfsc FLAG_apnoe_mode ; in apnoe mode? |
565 bra customview_toggle ; YES - call next view | 514 bra dive_customview_toggle ; YES - goto next view |
566 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch | 515 call TFT_avr_stopwatch_mask ; NO - mask for average depth and stopwatch |
567 call TFT_avr_stopwatch ; data for average depth and stopwatch | 516 call TFT_avr_stopwatch ; - data for average depth and stopwatch |
568 bra customview_toggle_exit | 517 bra customview_toggle_exit ; - done |
569 | 518 |
570 init_decoplan: | 519 init_decoplan: |
571 btfsc FLAG_apnoe_mode ; in apnoe mode? | 520 btfsc FLAG_apnoe_mode ; in apnoe mode? |
572 bra customview_toggle ; YES - call next view | 521 bra dive_customview_toggle ; YES - goto next view |
573 btfsc FLAG_gauge_mode ; in gauge mode? | 522 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
574 bra customview_toggle ; YES - call next view | 523 bra dive_customview_toggle ; YES - goto next view |
575 call TFT_decoplan_mask ; mask for deco plan | 524 call TFT_decoplan_mask ; NO - mask for deco plan |
576 call TFT_decoplan ; data for deco plan | 525 call TFT_decoplan ; - data for deco plan |
577 bra customview_toggle_exit | 526 bra customview_toggle_exit ; - done |
578 | 527 |
579 init_clock_batt_surfpress: | 528 init_clock_batt_surfpress: |
580 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure | 529 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure |
581 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure | 530 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure |
582 bra customview_toggle_exit | 531 bra customview_toggle_exit ; done |
583 | 532 |
584 init_gf_factors: | 533 init_gf_factors: |
585 btfsc FLAG_apnoe_mode ; in apnoe mode? | 534 btfsc FLAG_apnoe_mode ; in apnoe mode? |
586 bra customview_toggle ; YES - call next view | 535 bra dive_customview_toggle ; YES - goto next view |
587 btfsc FLAG_gauge_mode ; in gauge mode? | 536 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
588 bra customview_toggle ; YES - call next view | 537 bra dive_customview_toggle ; YES - call next view |
589 TSTOSS char_I_deco_model ; in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? | 538 TSTOSS char_I_deco_model ; NO - in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? |
590 bra customview_toggle ; NO - no GF info for non-GF modes | 539 bra dive_customview_toggle ; NO - no GF info for non-GF modes |
591 call TFT_gf_factors_mask ; mask for GF factors | 540 call TFT_gf_factors_mask ; YES - mask for GF factors (static only) |
592 bra customview_toggle_exit | 541 bra customview_toggle_exit ; - done |
593 | 542 |
594 init_TFT_dive_compass: ; compass | 543 init_TFT_dive_compass: ; compass |
544 IFDEF _compass | |
595 call I2C_init_accelerometer ; start accelerometer | 545 call I2C_init_accelerometer ; start accelerometer |
596 call I2C_init_compass ; start compass | 546 call I2C_init_compass ; start compass |
597 call TFT_dive_compass_mask ; show compass mask | 547 call TFT_dive_compass_mask ; show compass mask |
598 bra customview_toggle_exit | 548 bra customview_toggle_exit ; done |
549 ELSE | |
550 bra dive_customview_toggle ; not available without compass compiled in, goto next view | |
551 ENDIF | |
599 | 552 |
600 init_pressures_SAC: ; tank pressure and SAC rate | 553 init_pressures_SAC: ; tank pressure and SAC rate |
601 IFDEF _rx_functions | 554 IFDEF _rx_functions |
602 btfss FLAG_tr_enabled ; TR functions enabled? | 555 btfss tr_functions_activated ; TR functions activated? |
603 bra customview_toggle ; NO - call next view | 556 bra dive_customview_toggle ; NO - goto next view |
604 call TFT_pressures_SAC_mask ; mask for pressures and SAC | 557 call TFT_pressures_SAC_mask ; YES - mask for pressures and SAC |
605 call TFT_pressures_SAC ; data for pressures and SAC | 558 call TFT_pressures_SAC ; - data for pressures and SAC |
606 bra customview_toggle_exit | 559 bra customview_toggle_exit ; - done |
607 ELSE | 560 ELSE |
608 bra customview_toggle ; skip, not available without RX functions | 561 bra dive_customview_toggle ; not available without RX functions, got next view |
609 ENDIF | 562 ENDIF |
610 | 563 |
611 init_CNS: ; CNS at end of dive | 564 init_CNS: ; CNS at end of dive |
612 btfsc FLAG_gauge_mode ; in Gauge mode? | 565 btfsc FLAG_gauge_mode ; in gauge mode? |
613 bra customview_toggle ; YES - call next view | 566 bra dive_customview_toggle ; YES - call next view |
614 btfsc FLAG_apnoe_mode ; in apnoe mode? | 567 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? |
615 bra customview_toggle ; YES - call next view | 568 bra dive_customview_toggle ; YES - call next view |
616 call TFT_CNS_mask ; mask for CNS values | 569 call TFT_CNS_mask ; NO - mask for CNS values |
617 call TFT_CNS ; data for CNS values | 570 call TFT_CNS ; - data for CNS values |
618 bra customview_toggle_exit | 571 bra customview_toggle_exit ; - done |
619 | 572 |
620 init_ceiling_GF_tissue: ; ceiling, tissues and current GF | 573 init_ceiling_GF_tissue: ; ceiling, tissues and current GF |
621 btfsc FLAG_apnoe_mode ; in apnoe mode? | 574 btfsc FLAG_apnoe_mode ; in apnoe mode? |
622 bra customview_toggle ; YES - call next view | 575 bra dive_customview_toggle ; YES - goto next view |
623 btfsc FLAG_gauge_mode ; in gauge mode? | 576 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
624 bra customview_toggle ; YES - call next view | 577 bra dive_customview_toggle ; YES - call next view |
625 call TFT_ceiling_GF_tissue_mask ; mask for ceiling, current GF and tissues | 578 call TFT_ceiling_GF_tissue_mask ; NO - mask for ceiling, current GF and tissues |
626 call TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues | 579 call TFT_ceiling_GF_tissue ; - data for ceiling, current GF and tissues |
627 bra customview_toggle_exit | 580 bra customview_toggle_exit ; - done |
628 | 581 |
629 init_sensor_check: ; sensor check | 582 init_sensor_check: ; sensor check |
630 btfsc FLAG_ccr_mode ; in CCR mode? | 583 IFDEF _ccr_pscr |
631 bra customview_init_view10a ; YES | 584 btfss FLAG_ccr_mode ; in CCR mode? |
632 ; btfsc FLAG_pscr_mode ; in pSCR mode? | 585 bra dive_customview_toggle ; NO - goto next view |
633 ; bra customview_init_view10a ; YES | 586 call TFT_sensor_check_mask ; YES - mask for sensor check |
634 bra customview_toggle ; NO to both, call next view | 587 call TFT_sensor_check ; - data for sensor check |
635 customview_init_view10a: | 588 bra customview_toggle_exit ; - done |
636 call TFT_sensor_check_mask ; mask for sensor check | 589 ELSE |
637 call TFT_sensor_check ; data for sensor check | 590 bra dive_customview_toggle ; not available without CCR mode compiled in, goto next view |
638 bra customview_toggle_exit | 591 ENDIF |
639 | 592 |
640 init_ppo2_ead_end_cns: ; ppO2, END/EAD and CNS | 593 init_ppo2_ead_end_cns: ; ppO2, END/EAD and CNS |
641 btfsc FLAG_apnoe_mode ; in apnoe mode? | 594 btfsc FLAG_apnoe_mode ; in apnoe mode? |
642 bra customview_toggle ; YES - call next view | 595 bra dive_customview_toggle ; YES - goto next view |
643 btfsc FLAG_gauge_mode ; in gauge mode? | 596 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
644 bra customview_toggle ; YES - call next view | 597 bra dive_customview_toggle ; YES - goto next view |
645 call TFT_ppo2_ead_end_cns_mask ; mask for ppO2, END/EAD and CNS | 598 call TFT_ppo2_ead_end_cns_mask ; NO - mask for ppO2, END/EAD and CNS |
646 call TFT_ppo2_ead_end_cns ; data for ppO2, END/EAD and CNS | 599 call TFT_ppo2_ead_end_cns ; - data for ppO2, END/EAD and CNS |
647 bra customview_toggle_exit | 600 bra customview_toggle_exit ; - done |
648 | 601 |
649 init_pscr_info: ; pSCR information | 602 init_pscr_info: ; pSCR information |
603 IFDEF _ccr_pscr | |
650 btfss FLAG_pscr_mode ; in pSCR mode? | 604 btfss FLAG_pscr_mode ; in pSCR mode? |
651 bra customview_toggle ; NO - call next view | 605 bra dive_customview_toggle ; NO - goto next view |
652 call TFT_pscr_info_mask ; mask for pSCR info | 606 call TFT_pscr_info_mask ; YES - mask for pSCR info |
653 call TFT_pscr_info ; data for pSCR info | 607 call TFT_pscr_info ; - data for pSCR info |
654 bra customview_toggle_exit | 608 bra customview_toggle_exit ; - done |
609 ELSE | |
610 bra dive_customview_toggle ; not available without CCR / pSCR mode, goto next view | |
611 ENDIF | |
655 | 612 |
656 init_gas_needs_ascent: ; gas needs for ascent | 613 init_gas_needs_ascent: ; gas needs for ascent |
657 btfsc FLAG_apnoe_mode ; in apnoe mode? | 614 btfsc FLAG_apnoe_mode ; in apnoe mode? |
658 bra customview_toggle ; YES - call next view | 615 bra dive_customview_toggle ; YES - goto next view |
659 btfsc FLAG_gauge_mode ; in gauge mode? | 616 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
660 bra customview_toggle ; YES - call next view | 617 bra dive_customview_toggle ; YES - goto next view |
661 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculation is switched on | 618 TSTOSS opt_calc_asc_gasvolume ; NO - check if gas volume calculation is switched on |
662 bra customview_toggle ; NO - call next view | 619 bra dive_customview_toggle ; NO - goto next view |
663 call TFT_gas_needs_ascent_mask ; mask for gas needs ascent | 620 call TFT_gas_needs_ascent_mask ; YES - mask for gas needs ascent |
664 call TFT_gas_needs_ascent ; data for gas needs ascent | 621 call TFT_gas_needs_ascent ; - data for gas needs ascent |
665 bra customview_toggle_exit | 622 bra customview_toggle_exit ; - done |
666 | 623 |
667 customview_toggle_exit: | 624 customview_toggle_exit: |
668 bcf toggle_customview ; clear flag | 625 bcf request_next_custview ; clear request flag |
669 btfsc divemode ; in dive mode? | 626 return ; done |
670 bsf FLAG_TFT_temp_divemode ; YES - set flag to redraw temp | 627 |
671 return | 628 ;----------------------------------------------------------------------------- |
672 | |
673 | |
674 global customview_show_mix | |
675 customview_show_mix: ; put "Nxlo", "Txlo/hi", "Air" or "O2" into postinc2 | |
676 tstfsz hi ; He=0? | |
677 bra customview_show_mix5 ; NO - show a TX | |
678 movlw .21 | |
679 cpfseq lo ; Air? | |
680 bra customview_show_mix2 ; NO | |
681 STRCAT_TEXT tSelectAir ; YES - show "Air" | |
682 bra customview_show_mix4b | |
683 customview_show_mix2: | |
684 movlw .100 | |
685 cpfseq lo ; O2? | |
686 bra customview_show_mix3 ; NO | |
687 STRCAT_TEXT tSelectO2 ; YES - show "O2" | |
688 bra customview_show_mix4b | |
689 customview_show_mix3: | |
690 movlw .21 | |
691 cpfslt lo ; < Nx21? | |
692 bra customview_show_mix4 ; NO | |
693 STRCAT_TEXT tGasErr ; YES - show "Err" | |
694 output_99 ; O2 ratio is still in "lo" | |
695 bra customview_show_mix4c | |
696 customview_show_mix4: | |
697 STRCAT_TEXT tSelectNx ; show "Nx" | |
698 output_99 ; O2 ratio is still in "lo" | |
699 customview_show_mix4b: | |
700 STRCAT " " | |
701 customview_show_mix4c: | |
702 btfsc divemode ; in divemode? | |
703 return ; YES | |
704 STRCAT " " | |
705 return | |
706 customview_show_mix5: | |
707 btfsc divemode | |
708 bra customview_show_mix6 | |
709 STRCAT_TEXT tSelectTx ; show "Tx" | |
710 customview_show_mix6: | |
711 output_99 ; O2 ratio is still in "lo" | |
712 PUTC "/" | |
713 movff hi,lo | |
714 output_99 ; He ratio | |
715 return | |
716 | 629 |
717 END | 630 END |