0
|
1 ;=============================================================================
|
|
2 ;
|
634
|
3 ; File customview.asm * combined next generation V3.09.5
|
0
|
4 ;
|
604
|
5 ; Custom Views in Surface and Dive Mode
|
0
|
6 ;
|
654
|
7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved.
|
0
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2011-08-10 : [mH] moving from OSTC code
|
|
11
|
|
12 ;=============================================================================
|
|
13
|
604
|
14 #include "hwos.inc" ; mandatory header
|
582
|
15 #include "tft_outputs.inc"
|
|
16 #include "strings.inc"
|
|
17 #include "tft.inc"
|
|
18 #include "wait.inc"
|
|
19 #include "surfmode.inc"
|
|
20 #include "convert.inc"
|
|
21 #include "divemode.inc"
|
|
22 #include "i2c.inc"
|
|
23 #include "start.inc"
|
634
|
24 #include "colorschemes.inc"
|
0
|
25
|
582
|
26
|
634
|
27 extern gaslist_strcat_gas_PRODL
|
631
|
28 extern char_I_model
|
623
|
29
|
|
30 IFDEF _compass
|
582
|
31 extern TFT_surface_compass_mask
|
|
32 extern TFT_dive_compass_mask
|
623
|
33 ENDIF
|
|
34
|
582
|
35
|
634
|
36 #DEFINE num_premenu_items .12 ; overall number of pre-menu items
|
654
|
37 #DEFINE num_surface_cv .11 ; overall number of surface custom views
|
623
|
38
|
|
39
|
0
|
40 ;=============================================================================
|
634
|
41 custview1 CODE
|
|
42 ;=============================================================================
|
|
43
|
|
44 ;-----------------------------------------------------------------------------
|
|
45 ; Jump Table for the every-second Tasks for the Custom View Area (Dive Mode)
|
604
|
46 ;
|
|
47 ; Attention: the ordering must be in line with the init jump table and the
|
|
48 ; index numbers defined in hwos.inc!
|
634
|
49 ;
|
623
|
50 global dive_customview_second
|
|
51 dive_customview_second:
|
|
52 movf active_customview,W ; get current view
|
631
|
53 dcfsnz WREG,F ;
|
|
54 goto TFT_avr_stopwatch ; 1: average depth and stopwatch
|
|
55 dcfsnz WREG,F ;
|
|
56 IFDEF _compass
|
|
57 return ; 2: compass - will be updated separately (faster) in dive mode
|
623
|
58 ELSE
|
631
|
59 return ; 2: not available without compass
|
623
|
60 ENDIF
|
631
|
61 dcfsnz WREG,F ;
|
|
62 IFDEF _external_sensor
|
|
63 goto TFT_ppo2_sensors ; 3: ppO2 sensors
|
623
|
64 ELSE
|
631
|
65 return ; 3: not available without external sensors
|
623
|
66 ENDIF
|
631
|
67 dcfsnz WREG,F ;
|
623
|
68 IFDEF _ccr_pscr
|
631
|
69 goto TFT_sensor_check ; 4: sensor check
|
623
|
70 ELSE
|
631
|
71 return ; 4: not available without CCR / pSCR mode
|
|
72 ENDIF
|
|
73 dcfsnz WREG,F ;
|
|
74 IFDEF _ccr_pscr
|
|
75 goto TFT_pscr_info ; 5: pSCR data
|
|
76 ELSE
|
|
77 return ; 5: not available without CCR / pSCR mode
|
623
|
78 ENDIF
|
631
|
79 dcfsnz WREG,F ;
|
604
|
80 IFDEF _rx_functions
|
631
|
81 goto TFT_pressures_SAC ; 6: tank pressure and SAC rate
|
604
|
82 ELSE
|
631
|
83 return ; 6: not available without RX functions
|
|
84 ENDIF
|
|
85 dcfsnz WREG,F ;
|
|
86 goto TFT_gas_needs ; 7: gas needs for ascent / cave return
|
|
87 dcfsnz WREG,F ;
|
|
88 IFDEF _cave_mode
|
|
89 goto TFT_cave_tts ; 8: cave mode TTS
|
|
90 ELSE
|
|
91 return ; 8: not available without cave mode functions
|
604
|
92 ENDIF
|
631
|
93 dcfsnz WREG,F ;
|
|
94 goto TFT_decoplan ; 9: deco plan
|
|
95 dcfsnz WREG,F ;
|
|
96 goto TFT_ceiling_GF_tissue ; 10: ceiling, current GF and tissues
|
|
97 dcfsnz WREG,F ;
|
|
98 goto TFT_CNS ; 11: CNS values
|
|
99 dcfsnz WREG,F ;
|
|
100 goto TFT_ppo2_ead_end_cns ; 12: ppO2, END/EAD and CNS / gas density
|
|
101 dcfsnz WREG,F ;
|
|
102 goto TFT_clock_batt_surfpress ; 13: clock, battery and surface pressure
|
|
103 dcfsnz WREG,F ;
|
|
104 return ; 14: GF factors - static only
|
|
105 dcfsnz WREG,F ;
|
|
106 IFDEF _cave_mode
|
|
107 goto TFT_cave_waypoints ; 15: cave waypoints
|
|
108 ELSE
|
|
109 return ; 15: not available without cave mode functions
|
|
110 ENDIF
|
|
111 return ; 0: do nothing
|
0
|
112
|
634
|
113
|
|
114 ;=============================================================================
|
|
115 custview2 CODE
|
|
116 ;=============================================================================
|
|
117
|
|
118
|
623
|
119 ;-----------------------------------------------------------------------------
|
634
|
120 ; Show next Surface Custom View
|
|
121 ;
|
582
|
122 global surf_customview_toggle
|
0
|
123 surf_customview_toggle:
|
623
|
124 bcf switch_right ; clear button event
|
634
|
125 incf active_customview,F ; set number of the next custom view to show
|
604
|
126
|
623
|
127 IFDEF _compass
|
634
|
128 movlw .6 ; load index of surface custom view compass
|
|
129 cpfseq active_customview ; will the compass be shown in custom view?
|
|
130 call I2C_sleep_compass ; NO - can stop the compass to save on energy
|
623
|
131 ENDIF
|
604
|
132
|
634
|
133 movlw num_surface_cv ; load number of custom views available
|
|
134 cpfsgt active_customview ; beyond last view?
|
|
135 bra surf_customview_mask ; NO - show view
|
623
|
136 movlw .1 ; YES - wrap around to 1st view
|
|
137 movwf active_customview ; - ...
|
634
|
138 ;bra surf_customview_mask ; - show view
|
623
|
139
|
0
|
140
|
634
|
141 ;-----------------------------------------------------------------------------
|
|
142 ; Show Surface Custom View
|
|
143 ;
|
582
|
144 global surf_customview_mask
|
0
|
145 surf_customview_mask:
|
634
|
146
|
|
147 ; prepare output of custom view title
|
582
|
148 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right
|
634
|
149 WIN_TINY surf_customview_title_column,surf_customview_title_row ; set title position
|
|
150 FONT_COLOR color_greenish ; set title color
|
623
|
151
|
634
|
152 ; jump table
|
623
|
153 movf active_customview,W ; get custom view to show
|
|
154 movff WREG,customview_surfmode ; save number for later recall
|
604
|
155 dcfsnz WREG,F ; 1:
|
|
156 bra surf_customview_init_view1 ; OC gas list
|
|
157 dcfsnz WREG,F ; 2:
|
|
158 bra surf_customview_init_view2 ; CC dil list
|
|
159 dcfsnz WREG,F ; 3:
|
582
|
160 bra surf_customview_init_view3 ; CC SP list
|
604
|
161 dcfsnz WREG,F ; 4:
|
|
162 bra surf_customview_init_view4 ; custom text
|
|
163 dcfsnz WREG,F ; 5:
|
|
164 bra surf_customview_init_view5 ; tissue diagram
|
|
165 dcfsnz WREG,F ; 6:
|
|
166 bra surf_customview_init_view6 ; compass
|
|
167 dcfsnz WREG,F ; 7:
|
|
168 bra surf_customview_init_view7 ; deco settings
|
|
169 dcfsnz WREG,F ; 8:
|
|
170 bra surf_customview_init_view8 ; last dive info
|
|
171 dcfsnz WREG,F ; 9:
|
|
172 bra surf_customview_init_view9 ; sensor mV readings
|
|
173 dcfsnz WREG,F ; 10:
|
|
174 bra surf_customview_init_view10 ; tank data
|
654
|
175 dcfsnz WREG,F ; 11:
|
|
176 bra surf_customview_init_view11 ; Desat, noFly, CNS screen
|
634
|
177 bra surf_customview_init_view4 ; 0: default view after restart and loading of new firmware
|
623
|
178
|
634
|
179 surf_cv_toggle_exit:
|
|
180 bcf request_next_custview ; clear request flag
|
|
181 return ; done
|
0
|
182
|
634
|
183 ; ---- view 1: OC Gas list ----
|
|
184 ;
|
|
185 surf_customview_init_view1:
|
623
|
186 btfsc FLAG_gauge_mode ; in gauge mode?
|
|
187 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view
|
|
188 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
189 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view
|
|
190 IFDEF _ccr_pscr
|
|
191 btfss FLAG_oc_mode ; in OC mode?
|
|
192 bra surf_customview_init_view1a ; NO - (1)
|
|
193 ENDIF
|
|
194 STRCPY_TEXT_PRINT tGaslist ; YES - title of custom view / OC mode
|
|
195 IFDEF _ccr_pscr
|
|
196 bra surf_customview_init_view1b ; - continue with common part
|
604
|
197 surf_customview_init_view1a:
|
623
|
198 STRCPY_TEXT_PRINT tDiveBailout ; (1) - title of custom view / CCR & pSCR mode
|
|
199 ENDIF
|
|
200 surf_customview_init_view1b:
|
634
|
201 call TFT_surf_cv_list_gas ; show gas list
|
|
202 bra surf_cv_toggle_exit ; done
|
188
|
203
|
623
|
204
|
634
|
205 ; ---- view 2: CCR / pSCR diluent list ----
|
|
206 ;
|
|
207 surf_customview_init_view2:
|
623
|
208 IFDEF _ccr_pscr
|
|
209 btfsc FLAG_ccr_mode ; in CCR mode?
|
|
210 bra surf_customview_init_view2a ; YES - (1)
|
|
211 btfsc FLAG_pscr_mode ; in pSCR mode?
|
|
212 bra surf_customview_init_view2a ; YES - (1)
|
|
213 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view
|
604
|
214 surf_customview_init_view2a:
|
623
|
215 STRCPY_TEXT_PRINT tGaslistCC ; (1) - title of custom view
|
634
|
216 call TFT_surf_cv_list_dil ; - show diluent list
|
|
217 bra surf_cv_toggle_exit ; - done
|
623
|
218 ELSE
|
|
219 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view
|
|
220 ENDIF
|
|
221
|
582
|
222
|
634
|
223 ; ---- view 3: CC SP list ----
|
|
224 ;
|
|
225 surf_customview_init_view3:
|
623
|
226 IFDEF _ccr_pscr
|
|
227 btfss FLAG_ccr_mode ; in CCR mode?
|
|
228 bra surf_customview_toggle ; NO - not available if not in CCR mode, goto next view
|
|
229 STRCPY_TEXT_PRINT tFixedSetpoints ; YES - title of custom view
|
634
|
230 call TFT_surf_cv_list_sp ; - show setpoint list
|
|
231 bra surf_cv_toggle_exit ; - done
|
623
|
232 ELSE
|
|
233 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view
|
|
234 ENDIF
|
|
235
|
0
|
236
|
634
|
237 ; ---- view 4: custom text
|
|
238 ;
|
|
239 surf_customview_init_view4:
|
|
240 call TFT_surf_cv_text ; show the custom text
|
|
241 bra surf_cv_toggle_exit ; done
|
623
|
242
|
0
|
243
|
634
|
244 ; ---- view 5: tissue diagram
|
|
245 ;
|
|
246 surf_customview_init_view5:
|
623
|
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
|
634
|
251 call TFT_surf_cv_tissues ; show tissue diagram
|
|
252 bra surf_cv_toggle_exit ; done
|
0
|
253
|
623
|
254
|
634
|
255 ; ---- view 6: compass
|
|
256 ;
|
|
257 surf_customview_init_view6:
|
623
|
258 IFDEF _compass
|
604
|
259 call I2C_init_compass ; start compass
|
|
260 call TFT_surface_compass_mask ; show compass mask
|
634
|
261 bra surf_cv_toggle_exit ; done
|
604
|
262 ELSE
|
623
|
263 bra surf_customview_toggle ; not available without compass compiled in, goto next view
|
604
|
264 ENDIF
|
|
265
|
|
266
|
634
|
267 ; ---- view 7: deco settings ----
|
|
268 ;
|
|
269 surf_customview_init_view7:
|
623
|
270 btfsc FLAG_gauge_mode ; in gauge mode?
|
|
271 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view
|
|
272 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
273 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view
|
634
|
274 call TFT_surf_cv_settings ; show all deco settings
|
|
275 bra surf_cv_toggle_exit ; done
|
|
276
|
|
277
|
|
278 ; ---- view 8: last dive info ----
|
|
279 ;
|
|
280 surf_customview_init_view8:
|
|
281 call TFT_surf_cv_lastdive ; show last dive info
|
|
282 bra surf_cv_toggle_exit ; done
|
623
|
283
|
|
284
|
634
|
285 ; ---- view 9: sensor mV at the surface ----
|
|
286 ;
|
|
287 surf_customview_init_view9:
|
|
288 IFDEF _external_sensor
|
|
289 btfsc FLAG_ccr_mode ; in CCR mode?
|
|
290 bra surf_customview_init_view9a ; YES - show view
|
|
291 btfsc FLAG_pscr_mode ; NO - in pSCR mode?
|
|
292 bra surf_customview_init_view9a ; YES - show view
|
|
293 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view
|
|
294
|
|
295 surf_customview_init_view9a:
|
|
296 movff opt_ccr_mode,WREG ; get SP mode (0: fixed SP, 1: Sensor, 2: auto SP)
|
|
297 decfsz WREG,W ; opt_ccr_mode = 1 (sensor)?
|
|
298 bra surf_customview_toggle ; NO - goto next view
|
|
299 STRCPY_TEXT_PRINT tSensorMilliVolt ; YES - title of custom view
|
|
300 call TFT_imprint_surf_mV ; - write sensor mV readings to screen
|
|
301 bra surf_cv_toggle_exit ; - done
|
|
302 ELSE
|
|
303 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view
|
|
304 ENDIF
|
582
|
305
|
0
|
306
|
634
|
307 ; ---- view 10: transmitter data / debug ----
|
|
308 ;
|
|
309 surf_customview_init_view10:
|
623
|
310 IFDEF _rx_functions
|
|
311 btfss tr_functions_activated ; TR functions activated?
|
|
312 bra surf_customview_toggle ; NO - show next view in list
|
|
313 STRCAT_PRINT "ID bar Volt" ; YES - title of custom view (none language-dependent)
|
634
|
314 call TFT_surf_cv_tankdata ; - show received data
|
|
315 bra surf_cv_toggle_exit ; - done
|
623
|
316 ELSE
|
|
317 bra surf_customview_toggle ; not available without RX functions compiled in, goto next view
|
|
318 ENDIF
|
|
319
|
654
|
320 ; ---- view 11: Desat, NoFly, CNS ----
|
|
321 ;
|
|
322 surf_customview_init_view11:
|
|
323 btfsc FLAG_gauge_mode ; in gauge mode?
|
|
324 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view
|
|
325 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
326 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view
|
|
327 call TFT_surf_desat_nofly_cns ; Desat, NoFly, CNS
|
|
328 bra surf_cv_toggle_exit ; done
|
634
|
329
|
|
330 ;=============================================================================
|
|
331 custview3 CODE
|
|
332 ;=============================================================================
|
|
333
|
|
334
|
623
|
335 ;-----------------------------------------------------------------------------
|
634
|
336 ; Show next Pre-Menu Item / Clear the Pre-Menu
|
|
337 ;
|
582
|
338 global menuview_toggle
|
634
|
339 menuview_toggle:
|
623
|
340 bcf switch_left ; clear button event
|
|
341 movlw divemode_timeout_premenu ; get timeout for dive mode pre-menu
|
634
|
342 call restart_timeout_time ; restart the timeout
|
|
343 bsf dive_pre_menu ; flag that the pre-menu is shown
|
|
344 menuview_next_item:
|
|
345 incf active_premenu,F ; increment pre-menu item number
|
|
346 movlw num_premenu_items ; get number of pre-menu items
|
|
347 cpfsgt active_premenu ; beyond last item?
|
623
|
348 bra menuview_mask ; NO - show item
|
634
|
349 ;bra menuview_toggle_reset ; YES - reset to first item
|
|
350
|
|
351 global menuview_toggle_reset
|
|
352 menuview_toggle_reset:
|
|
353 clrf active_premenu ; reset pre-menu item number
|
|
354 bcf dive_pre_menu ; flag that the pre-menu is not shown anymore
|
|
355 ;bra menuview_mask ; clear last item from display
|
|
356
|
0
|
357 menuview_mask:
|
623
|
358 WIN_BOX_BLACK dm_premenu_row, dm_premenu_bot, dm_premenu_col, dm_premenu_rgt ; top, bottom, left, right
|
634
|
359 btfsc dive_pre_menu ; shall show pre-menu?
|
|
360 bra menuview_show_item ; YES - show menu item
|
|
361 ;bra menuview_exit ; NO - done with pre-menu
|
631
|
362
|
634
|
363 menuview_exit:
|
|
364 bcf win_invert ; clear inverse printing
|
|
365 btfss dive_pre_menu ; showing pre-menu?
|
|
366 goto TFT_show_temp_divemode ; NO - restore temperature display and return
|
|
367 return ; YES - done
|
|
368
|
|
369 menuview_show_item:
|
|
370 WIN_SMALL dm_premenu_col,dm_premenu_row
|
|
371 FONT_COLOR_ATTENTION ; set color
|
623
|
372 bsf win_invert ; set inverse printing
|
|
373 movf active_premenu,W ; get active pre-menu item
|
0
|
374 dcfsnz WREG,F
|
631
|
375 bra menuview_view_gaschange ; 1: gas change (skipped if no better gas/dil cued)
|
137
|
376 dcfsnz WREG,F
|
634
|
377 bra menuview_view_ackn ; 2: "Ackn?" (skipped if no active advice/attention/warning sign)
|
|
378 dcfsnz WREG,F
|
|
379 bra menuview_view_divemenu ; 3: "Menu?" (skipped in gauge and apnoe modes)
|
254
|
380 dcfsnz WREG,F
|
631
|
381 IFDEF _cave_mode
|
634
|
382 bra menuview_view_cavemenu ; 4: "Cave?" (skipped if not in cave mode)
|
631
|
383 ELSE
|
634
|
384 bra menuview_next_item ; 4: cave mode not implemented, goto next item
|
631
|
385 ENDIF
|
0
|
386 dcfsnz WREG,F
|
634
|
387 bra menuview_view_sim_quit ; 5: "Quit?" (in simulation mode only)
|
0
|
388 dcfsnz WREG,F
|
634
|
389 bra menuview_view_sim_down ; 6: "Sim down" (in simulation mode only)
|
0
|
390 dcfsnz WREG,F
|
634
|
391 bra menuview_view_sim_up ; 7: "Sim up" (in simulation mode only)
|
0
|
392 dcfsnz WREG,F
|
634
|
393 bra menuview_view_sim_time ; 8: "Sim+5'" (in simulation mode only)
|
631
|
394 dcfsnz WREG,F
|
634
|
395 bra menuview_view_apnoe_quit ; 9: "Quit?" (in apnoe mode only)
|
0
|
396 dcfsnz WREG,F
|
634
|
397 bra menuview_view_gauge_reset ; 10: "Reset Avr" (in gauge mode only)
|
216
|
398 dcfsnz WREG,F
|
634
|
399 IFDEF _compass
|
|
400 bra menuview_view_course ; 11: "Course" (only when compass is shown)
|
|
401 ELSE
|
|
402 bra menuview_next_item ; 11: compass not implemented, goto next item
|
|
403 ENDIF
|
|
404 dcfsnz WREG,F
|
|
405 bra menuview_view_layout ; 12: "Layout" (offer alternative layout, aka blind mode)
|
|
406 bra menuview_exit ; catch illegal item number
|
|
407 ; when adding or removing items, adjust the value num_premenu_items in the #DEFINE !
|
137
|
408
|
|
409
|
634
|
410 ; --- item 1: gas change advice ---
|
|
411 ;
|
137
|
412 menuview_view_gaschange:
|
634
|
413 btfsc request_gas_change ; last gas change request already executed?
|
|
414 bra menuview_next_item ; YES - goto next option
|
623
|
415 IFDEF _ccr_pscr
|
604
|
416 btfsc FLAG_oc_mode ; in OC mode?
|
|
417 bra menuview_view_gaschange_OC ; YES
|
623
|
418 btfsc bailout_mode ; in bailout?
|
604
|
419 bra menuview_view_gaschange_OC ; YES
|
|
420 menuview_view_gaschange_DIL:
|
|
421 btfss better_dil_available ; is the better diluent still available?
|
634
|
422 bra menuview_next_item ; NO - goto next item
|
604
|
423 movff best_dil_number,PRODL ; number (1-5) of the "best diluent"
|
623
|
424 bsf is_diluent_menu ; setting up diluents
|
634
|
425 bra menuview_view_gaschange_com ; continue with common part
|
|
426 ENDIF ; _ccr_pscr
|
604
|
427 menuview_view_gaschange_OC:
|
|
428 btfss better_gas_available ; is the better gas still available?
|
634
|
429 bra menuview_next_item ; NO - goto next item
|
|
430 movff best_gas_number,PRODL ; YES - number (1-5) of the "best gas"
|
|
431 bcf is_diluent_menu ; - setting up OC gases
|
604
|
432 menuview_view_gaschange_com:
|
|
433 decf PRODL,F ; (1-5) -> (0-4)
|
634
|
434 bsf short_gas_descriptions ; use short version of gaslist_strcat_gas_PRODL and gaslist_strcat_setpoint
|
604
|
435 bsf better_gas_hint ; color-code as best gas/diluent
|
634
|
436 call gaslist_strcat_gas_PRODL ; append gas description of gas #PRODL (0-4) to current string
|
631
|
437 movlw .5 ; point to 6th character (5 chars are used for the gas/dil description)
|
|
438 movwf FSR2L ; ...
|
634
|
439 PUTC_PRINT "?" ; append question and dump buffer to screen
|
604
|
440 bra menuview_exit ; done
|
|
441
|
634
|
442 ; ---- item 2: acknowledge ----
|
|
443 ;
|
|
444 menuview_view_ackn:
|
|
445 btfss sign_shown ; advice, attention or warning sign shown?
|
|
446 bra menuview_next_item ; NO - goto next item
|
|
447 STRCAT_TEXT_PRINT tDiveAckn ; YES - print "Ackn?"
|
|
448 bra menuview_exit ; - done
|
|
449
|
|
450
|
|
451 ; ---- item 3: dive menu ----
|
|
452 ;
|
631
|
453 menuview_view_divemenu:
|
623
|
454 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
634
|
455 bra menuview_next_item ; YES - goto next item
|
623
|
456 btfsc FLAG_gauge_mode ; NO - in gauge mode?
|
634
|
457 bra menuview_next_item ; YES - goto next item
|
623
|
458 PUTC "\xb7" ; NO - print '->' symbol
|
|
459 STRCAT_TEXT_PRINT tDivePreMenu ; - print "Menu?"
|
|
460 bra menuview_exit ; - done
|
604
|
461
|
634
|
462
|
|
463 ; ---- item 4: cave menu ----
|
|
464 ;
|
631
|
465 IFDEF _cave_mode
|
|
466 menuview_view_cavemenu:
|
|
467 TSTOSS opt_cave_mode ; cave mode switched on?
|
634
|
468 bra menuview_next_item ; NO - goto next item
|
631
|
469 PUTC "\xb7" ; YES - print '->' symbol
|
|
470 STRCAT_TEXT_PRINT tDivePreCave ; - print "Cave?"
|
|
471 bra menuview_exit ; - done
|
634
|
472 ENDIF ; _cave_mode
|
|
473
|
631
|
474
|
634
|
475 ; ---- item 5: quit simulator ---
|
|
476 ;
|
631
|
477 menuview_view_sim_quit:
|
623
|
478 btfss simulatormode ; in simulator mode?
|
634
|
479 bra menuview_next_item ; NO - goto next item
|
623
|
480 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Simulation?"
|
|
481 bra menuview_exit ; - done
|
604
|
482
|
634
|
483
|
|
484 ; ---- item 6: simulator - go down ----
|
|
485 ;
|
631
|
486 menuview_view_sim_down:
|
623
|
487 btfss simulatormode ; in simulator mode?
|
634
|
488 bra menuview_next_item ; NO - goto next item
|
604
|
489 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down
|
|
490 bra menuview_exit ; done
|
|
491
|
634
|
492
|
|
493 ; ---- item 7: simulator - go up ----
|
|
494 ;
|
631
|
495 menuview_view_sim_up:
|
623
|
496 btfss simulatormode ; in simulator mode?
|
634
|
497 bra menuview_next_item ; NO - goto next item
|
623
|
498 STRCPY_PRINT "Sim\xb9" ; YES - print up arrow for going up
|
|
499 bra menuview_exit ; - done
|
604
|
500
|
634
|
501
|
|
502 ; ---- item 8: simulator - advance time ----
|
|
503 ;
|
631
|
504 menuview_view_sim_time:
|
623
|
505 btfss simulatormode ; in simulator mode?
|
634
|
506 bra menuview_next_item ; NO - goto next item
|
623
|
507 btfsc FLAG_gauge_mode ; YES - in gauge mode?
|
634
|
508 bra menuview_next_item ; YES - goto next item
|
623
|
509 btfsc FLAG_apnoe_mode ; NO - in apnoe mode?
|
634
|
510 bra menuview_next_item ; YES - goto next item
|
623
|
511 STRCPY_PRINT "Sim+5'" ; NO - print "Sim+5'"
|
|
512 bra menuview_exit ; - done
|
604
|
513
|
634
|
514
|
|
515 ; ---- item 9: apnoe mode - quit ----
|
|
516 ;
|
631
|
517 menuview_view_apnoe_quit:
|
|
518 btfss FLAG_apnoe_mode ; in apnoe mode?
|
634
|
519 bra menuview_next_item ; NO - goto next option
|
631
|
520 btfss apnoe_at_surface ; YES - at the surface?
|
634
|
521 bra menuview_next_item ; NO - goto next item
|
631
|
522 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Apnea mode?"
|
|
523 bra menuview_exit ; - done
|
|
524
|
634
|
525
|
|
526 ; ---- item 10: gauge mode - reset average ----
|
|
527 ;
|
631
|
528 menuview_view_gauge_reset:
|
|
529 btfss FLAG_gauge_mode ; in gauge mode?
|
634
|
530 bra menuview_next_item ; NO - goto next item
|
631
|
531 STRCPY_TEXT_PRINT tResetAvg ; YES - print "Reset Avg."
|
|
532 bra menuview_exit ; - done
|
|
533
|
634
|
534
|
|
535 ; ---- item 11: set bearing ----
|
|
536 IFDEF _compass
|
631
|
537 menuview_view_course:
|
604
|
538 movlw index_compass_dm ; index of compass view
|
623
|
539 cpfseq active_customview ; in compass view?
|
634
|
540 bra menuview_next_item ; NO - goto next item
|
623
|
541 STRCPY_TEXT_PRINT tSetHeading ; YES - print "Heading"
|
|
542 bra menuview_exit ; - done
|
|
543 ENDIF
|
604
|
544
|
634
|
545
|
|
546 ; ---- item 12: switch layout ----
|
|
547 ;
|
631
|
548 menuview_view_layout:
|
623
|
549 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
634
|
550 bra menuview_next_item ; YES - goto next item
|
628
|
551 STRCPY_TEXT_PRINT tDiveLayout ; NO - print "Layout"
|
623
|
552 bra menuview_exit ; - done
|
582
|
553
|
634
|
554
|
|
555 ;=============================================================================
|
|
556 custview4 CODE
|
|
557 ;=============================================================================
|
604
|
558
|
631
|
559
|
634
|
560 ;-----------------------------------------------------------------------------
|
|
561 ; Show a specific Dive Mode Custom View
|
|
562 ;
|
631
|
563 global dive_customview_show
|
|
564 dive_customview_show:
|
|
565 btfss custom_view_locked ; custom view locked?
|
|
566 bra dive_customview_show_1 ; NO - call-up the view
|
|
567 movwf backup_customview ; YES - store requested custom view for later recall
|
|
568 return ; - done
|
|
569 dive_customview_show_1:
|
|
570 movwf active_customview ; set the requested custom view
|
|
571 bra dive_customview_callup ; call-up the custom view
|
|
572
|
634
|
573
|
|
574 ;-----------------------------------------------------------------------------
|
|
575 ; Show again last Dive Mode Custom View
|
|
576 ;
|
631
|
577 global dive_customview_recall
|
|
578 dive_customview_recall:
|
|
579 movff backup_customview,active_customview ; recall the saved custom view
|
|
580 bra dive_customview_callup ; call-up the custom view
|
|
581
|
634
|
582
|
|
583 ;-----------------------------------------------------------------------------
|
|
584 ; Show next Dive Mode Custom View
|
|
585 ;
|
623
|
586 global dive_customview_toggle
|
|
587 dive_customview_toggle:
|
|
588 incf active_customview,F ; increment number of custom view to show
|
634
|
589 movlw index_cv_dm_max ; get highest index in use in dive mode custom view
|
|
590 cpfsgt active_customview ; beyond last view?
|
631
|
591 bra dive_customview_callup ; NO - call-up the custom view
|
|
592 clrf active_customview ; YES - reset to zero (zero = blank custom view)
|
|
593 ;bra dive_customview_callup ; call-up the custom view
|
|
594
|
634
|
595
|
|
596 ;-----------------------------------------------------------------------------
|
|
597 ; Show current Dive Mode Custom View
|
|
598 ;
|
631
|
599 global dive_customview_callup
|
|
600 dive_customview_callup:
|
|
601 movlw index_compass_dm ; get index of compass custom view
|
|
602 cpfseq active_customview ; will compass be shown?
|
634
|
603 call I2C_sleep_compass ; NO - stop compass to save on energy
|
582
|
604
|
623
|
605 ; clear custom view area in dive mode
|
604
|
606 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right
|
634
|
607
|
|
608 ; jump table
|
623
|
609 movf active_customview,W ; get custom view to show
|
631
|
610 dcfsnz WREG,F ;
|
|
611 bra init_avr_stopwatch ; 1: average depth and stopwatch
|
|
612 dcfsnz WREG,F ;
|
|
613 bra init_TFT_dive_compass ; 2: compass
|
|
614 dcfsnz WREG,F ;
|
|
615 bra init_ppo2_sensors ; 3: ppO2 sensors
|
|
616 dcfsnz WREG,F ;
|
|
617 bra init_sensor_check ; 4: sensor check
|
|
618 dcfsnz WREG,F ;
|
|
619 bra init_pscr_info ; 5: pSCR data
|
|
620 dcfsnz WREG,F ;
|
|
621 bra init_pressures_SAC ; 6: tank pressure and SAC rate
|
|
622 dcfsnz WREG,F ;
|
|
623 bra init_gas_needs_ascent ; 7: gas needs for ascent / cave return
|
|
624 dcfsnz WREG,F ;
|
|
625 bra init_cave_tts ; 8: cave mode TTS
|
|
626 dcfsnz WREG,F ;
|
|
627 bra init_decoplan ; 9: deco plan (next stops)
|
|
628 dcfsnz WREG,F ;
|
|
629 bra init_ceiling_GF_tissue ; 10: ceiling, current GF and tissues
|
|
630 dcfsnz WREG,F ;
|
|
631 bra init_CNS ; 11: CNS values
|
|
632 dcfsnz WREG,F ;
|
634
|
633 bra init_ppo2_ead_end_cns ; 12: ppO2, END/EAD and CNS/gas density
|
631
|
634 dcfsnz WREG,F ;
|
|
635 bra init_clock_batt_surfpress ; 13: clock, battery and surface pressure
|
|
636 dcfsnz WREG,F ;
|
|
637 bra init_gf_factors ; 14: GF factors
|
|
638 dcfsnz WREG,F ;
|
|
639 bra init_cave_waypoints ; 15: cave waypoints
|
634
|
640 ;bra dive_cv_toggle_exit ; 0: no view (blank screen in custom view area)
|
|
641
|
|
642 dive_cv_toggle_exit:
|
|
643 bcf request_next_custview ; clear request flag
|
|
644 return ; done
|
582
|
645
|
0
|
646
|
634
|
647 ; ---- view 1: average depth and stopwatch ----
|
|
648 ;
|
604
|
649 init_avr_stopwatch:
|
|
650 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
623
|
651 bra dive_customview_toggle ; YES - goto next view
|
|
652 call TFT_avr_stopwatch_mask ; NO - mask for average depth and stopwatch
|
|
653 call TFT_avr_stopwatch ; - data for average depth and stopwatch
|
634
|
654 bra dive_cv_toggle_exit ; - done
|
|
655
|
0
|
656
|
634
|
657 ; ---- view 2: compass ----
|
|
658 ;
|
|
659 init_TFT_dive_compass:
|
623
|
660 IFDEF _compass
|
604
|
661 call I2C_init_compass ; start compass
|
634
|
662 call TFT_dive_compass_mask ; mask for compass
|
|
663 bra dive_cv_toggle_exit ; done
|
623
|
664 ELSE
|
|
665 bra dive_customview_toggle ; not available without compass compiled in, goto next view
|
|
666 ENDIF
|
53
|
667
|
634
|
668
|
|
669 ; ---- view 3: ppO2 sensors ---
|
|
670 ;
|
|
671 init_ppo2_sensors:
|
|
672 IFDEF _external_sensor
|
|
673 bsf trigger_temp_changed ; fake a change of the temperature to have the resettable dive time overwritten which was shown with the compass view
|
|
674 btfsc FLAG_ccr_mode ; in CC mode?
|
|
675 bra init_ppo2_sensors_1 ; YES
|
|
676 btfsc FLAG_pscr_mode ; in pSCR mode?
|
|
677 bra init_ppo2_sensors_1 ; YES
|
|
678 bra dive_customview_toggle ; NO to both, goto next view
|
|
679 init_ppo2_sensors_1:
|
|
680 btfsc ext_input_s8_ana ; do we have an S8/analog input?
|
|
681 bra init_ppo2_sensors_2 ; YES - show this view
|
|
682 btfsc ext_input_optical ; NO - do we have an optical input?
|
|
683 bra init_ppo2_sensors_2 ; YES - show this view
|
|
684 bra dive_customview_toggle ; NO - goto next view
|
|
685
|
|
686 init_ppo2_sensors_2:
|
|
687 call TFT_ppo2_sensors_mask ; mask for ppO2 sensors
|
|
688 call TFT_ppo2_sensors ; data for ppO2 sensors
|
|
689 bra dive_cv_toggle_exit ; done
|
|
690 ELSE
|
|
691 bra dive_customview_toggle ; not available without external sensors, got next view
|
|
692 ENDIF
|
|
693
|
|
694 ; ---- view 4: sensor check ----
|
|
695 ;
|
|
696 init_sensor_check:
|
|
697 IFDEF _ccr_pscr
|
|
698 btfss FLAG_ccr_mode ; in CCR mode?
|
|
699 bra dive_customview_toggle ; NO - goto next view
|
|
700 call TFT_sensor_check_mask ; YES - mask for sensor check
|
|
701 call TFT_sensor_check ; - data for sensor check
|
|
702 bra dive_cv_toggle_exit ; - done
|
|
703 ELSE
|
|
704 bra dive_customview_toggle ; not available without CCR mode compiled in, goto next view
|
|
705 ENDIF
|
|
706
|
|
707
|
|
708 ; ---- view 5: pSCR data ----
|
|
709 ;
|
|
710 init_pscr_info:
|
|
711 IFDEF _ccr_pscr
|
|
712 btfss FLAG_pscr_mode ; in pSCR mode?
|
|
713 bra dive_customview_toggle ; NO - goto next view
|
|
714 call TFT_pscr_info_mask ; YES - mask for pSCR info
|
|
715 call TFT_pscr_info ; - data for pSCR info
|
|
716 bra dive_cv_toggle_exit ; - done
|
|
717 ELSE
|
|
718 bra dive_customview_toggle ; not available without CCR / pSCR mode, goto next view
|
|
719 ENDIF
|
|
720
|
|
721
|
|
722 ; view 6: tank pressure and SAC rate ----
|
|
723 ;
|
|
724 init_pressures_SAC:
|
604
|
725 IFDEF _rx_functions
|
623
|
726 btfss tr_functions_activated ; TR functions activated?
|
|
727 bra dive_customview_toggle ; NO - goto next view
|
|
728 call TFT_pressures_SAC_mask ; YES - mask for pressures and SAC
|
|
729 call TFT_pressures_SAC ; - data for pressures and SAC
|
634
|
730 bra dive_cv_toggle_exit ; - done
|
604
|
731 ELSE
|
623
|
732 bra dive_customview_toggle ; not available without RX functions, got next view
|
604
|
733 ENDIF
|
102
|
734
|
333
|
735
|
634
|
736 ; ---- view 7: gas needs ----
|
|
737 ;
|
|
738 init_gas_needs_ascent:
|
604
|
739 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
623
|
740 bra dive_customview_toggle ; YES - goto next view
|
|
741 btfsc FLAG_gauge_mode ; NO - in gauge mode?
|
|
742 bra dive_customview_toggle ; YES - goto next view
|
631
|
743 TSTOSS opt_calc_gasvolume ; NO - check if gas volume calculation is switched on
|
623
|
744 bra dive_customview_toggle ; NO - goto next view
|
631
|
745 call TFT_gas_needs_mask ; YES - mask for gas needs ascent
|
|
746 call TFT_gas_needs ; - data for gas needs ascent
|
634
|
747 bra dive_cv_toggle_exit ; - done
|
|
748
|
582
|
749
|
634
|
750 ; ---- view 8: cave mode TTS ----
|
|
751 init_cave_tts:
|
631
|
752 IFDEF _cave_mode
|
|
753 btfss cave_mode ; in cave mode?
|
|
754 bra dive_customview_toggle ; NO - goto next view
|
|
755 call TFT_cave_tts_mask ; YES - show mask
|
|
756 call TFT_cave_tts ; - show data
|
634
|
757 bra dive_cv_toggle_exit ; - done
|
631
|
758 ELSE
|
|
759 bra dive_customview_toggle ; not available without cave mode, goto next view
|
|
760 ENDIF
|
|
761
|
|
762
|
634
|
763 ; ---- view 9: deco plan ----
|
|
764 ;
|
|
765 init_decoplan:
|
|
766 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
767 bra dive_customview_toggle ; YES - goto next view
|
|
768 btfsc FLAG_gauge_mode ; NO - in gauge mode?
|
|
769 bra dive_customview_toggle ; YES - goto next view
|
|
770 call TFT_decoplan_mask ; NO - mask for deco plan
|
|
771 call TFT_decoplan ; - data for deco plan
|
|
772 bra dive_cv_toggle_exit ; - done
|
|
773
|
|
774
|
|
775 ; ---- view 10: ceiling, tissues and current GF
|
|
776 ;
|
|
777 init_ceiling_GF_tissue:
|
|
778 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
779 bra dive_customview_toggle ; YES - goto next view
|
|
780 btfsc FLAG_gauge_mode ; NO - in gauge mode?
|
|
781 bra dive_customview_toggle ; YES - call next view
|
|
782 call TFT_ceiling_GF_tissue_mask ; NO - mask for ceiling, current GF and tissues
|
|
783 call TFT_ceiling_GF_tissue ; - data for ceiling, current GF and tissues
|
|
784 bra dive_cv_toggle_exit ; - done
|
|
785
|
|
786
|
|
787 ; ---- view 11: CNS values ----
|
|
788 ;
|
|
789 init_CNS: ; CNS at end of dive
|
|
790 btfsc FLAG_gauge_mode ; in gauge mode?
|
|
791 bra dive_customview_toggle ; YES - call next view
|
|
792 btfsc FLAG_apnoe_mode ; NO - in apnoe mode?
|
|
793 bra dive_customview_toggle ; YES - call next view
|
|
794 call TFT_CNS_mask ; NO - mask for CNS values
|
|
795 call TFT_CNS ; - data for CNS values
|
|
796 bra dive_cv_toggle_exit ; - done
|
|
797
|
|
798
|
|
799 ; ---- view 12: ppO2, END/EAD and CNS/gas density ----
|
|
800 ;
|
|
801 init_ppo2_ead_end_cns: ;
|
|
802 btfsc FLAG_apnoe_mode ; in apnoe mode?
|
|
803 bra dive_customview_toggle ; YES - goto next view
|
|
804 btfsc FLAG_gauge_mode ; NO - in gauge mode?
|
|
805 bra dive_customview_toggle ; YES - goto next view
|
|
806 call TFT_ppo2_ead_end_cns_mask ; NO - mask for ppO2, END/EAD and CNS
|
|
807 call TFT_ppo2_ead_end_cns ; - data for ppO2, END/EAD and CNS
|
|
808 bra dive_cv_toggle_exit ; - done
|
|
809
|
|
810
|
|
811 ; ---- view 13: clock, battery and surface pressure
|
|
812 ;
|
|
813 init_clock_batt_surfpress:
|
|
814 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure
|
|
815 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure
|
|
816 bra dive_cv_toggle_exit ; done
|
|
817
|
|
818
|
|
819 ; ---- view 14: GF factors
|
|
820 ;
|
|
821 init_gf_factors:
|
|
822 call TFT_gf_factors_mask ; show GF factors
|
|
823 bra dive_cv_toggle_exit ; done
|
|
824
|
|
825
|
|
826 ; ---- view 15: cave waypoints ----
|
|
827 ;
|
|
828 init_cave_waypoints:
|
|
829 IFDEF _cave_mode
|
|
830 call TFT_cave_waypoints ; show waypoint graphics
|
|
831 bra dive_cv_toggle_exit ; done
|
|
832 ELSE
|
|
833 bra dive_customview_toggle ; not available without cave mode, goto next view
|
|
834 ENDIF
|
0
|
835
|
623
|
836 ;-----------------------------------------------------------------------------
|
0
|
837
|
623
|
838 END
|