Mercurial > public > hwos_code
annotate src/customview.asm @ 644:1e695355dfc4
Merge
author | heinrichsweikamp |
---|---|
date | Mon, 24 May 2021 18:41:51 +0200 |
parents | 4050675965ea |
children | 75e90cd0c2c3 |
rev | line source |
---|---|
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 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
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 |
37 #DEFINE num_surface_cv .10 ; 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 | |
634 | 175 bra surf_customview_init_view4 ; 0: default view after restart and loading of new firmware |
623 | 176 |
634 | 177 surf_cv_toggle_exit: |
178 bcf request_next_custview ; clear request flag | |
179 return ; done | |
0 | 180 |
634 | 181 ; ---- view 1: OC Gas list ---- |
182 ; | |
183 surf_customview_init_view1: | |
623 | 184 btfsc FLAG_gauge_mode ; in gauge mode? |
185 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
186 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
187 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
188 IFDEF _ccr_pscr | |
189 btfss FLAG_oc_mode ; in OC mode? | |
190 bra surf_customview_init_view1a ; NO - (1) | |
191 ENDIF | |
192 STRCPY_TEXT_PRINT tGaslist ; YES - title of custom view / OC mode | |
193 IFDEF _ccr_pscr | |
194 bra surf_customview_init_view1b ; - continue with common part | |
604 | 195 surf_customview_init_view1a: |
623 | 196 STRCPY_TEXT_PRINT tDiveBailout ; (1) - title of custom view / CCR & pSCR mode |
197 ENDIF | |
198 surf_customview_init_view1b: | |
634 | 199 call TFT_surf_cv_list_gas ; show gas list |
200 bra surf_cv_toggle_exit ; done | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
184
diff
changeset
|
201 |
623 | 202 |
634 | 203 ; ---- view 2: CCR / pSCR diluent list ---- |
204 ; | |
205 surf_customview_init_view2: | |
623 | 206 IFDEF _ccr_pscr |
207 btfsc FLAG_ccr_mode ; in CCR mode? | |
208 bra surf_customview_init_view2a ; YES - (1) | |
209 btfsc FLAG_pscr_mode ; in pSCR mode? | |
210 bra surf_customview_init_view2a ; YES - (1) | |
211 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
604 | 212 surf_customview_init_view2a: |
623 | 213 STRCPY_TEXT_PRINT tGaslistCC ; (1) - title of custom view |
634 | 214 call TFT_surf_cv_list_dil ; - show diluent list |
215 bra surf_cv_toggle_exit ; - done | |
623 | 216 ELSE |
217 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
218 ENDIF | |
219 | |
582 | 220 |
634 | 221 ; ---- view 3: CC SP list ---- |
222 ; | |
223 surf_customview_init_view3: | |
623 | 224 IFDEF _ccr_pscr |
225 btfss FLAG_ccr_mode ; in CCR mode? | |
226 bra surf_customview_toggle ; NO - not available if not in CCR mode, goto next view | |
227 STRCPY_TEXT_PRINT tFixedSetpoints ; YES - title of custom view | |
634 | 228 call TFT_surf_cv_list_sp ; - show setpoint list |
229 bra surf_cv_toggle_exit ; - done | |
623 | 230 ELSE |
231 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
232 ENDIF | |
233 | |
0 | 234 |
634 | 235 ; ---- view 4: custom text |
236 ; | |
237 surf_customview_init_view4: | |
238 call TFT_surf_cv_text ; show the custom text | |
239 bra surf_cv_toggle_exit ; done | |
623 | 240 |
0 | 241 |
634 | 242 ; ---- view 5: tissue diagram |
243 ; | |
244 surf_customview_init_view5: | |
623 | 245 btfsc FLAG_gauge_mode ; in gauge mode? |
246 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
247 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
248 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
634 | 249 call TFT_surf_cv_tissues ; show tissue diagram |
250 bra surf_cv_toggle_exit ; done | |
0 | 251 |
623 | 252 |
634 | 253 ; ---- view 6: compass |
254 ; | |
255 surf_customview_init_view6: | |
623 | 256 IFDEF _compass |
604 | 257 call I2C_init_compass ; start compass |
258 call TFT_surface_compass_mask ; show compass mask | |
634 | 259 bra surf_cv_toggle_exit ; done |
604 | 260 ELSE |
623 | 261 bra surf_customview_toggle ; not available without compass compiled in, goto next view |
604 | 262 ENDIF |
263 | |
264 | |
634 | 265 ; ---- view 7: deco settings ---- |
266 ; | |
267 surf_customview_init_view7: | |
623 | 268 btfsc FLAG_gauge_mode ; in gauge mode? |
269 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
270 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
271 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
634 | 272 call TFT_surf_cv_settings ; show all deco settings |
273 bra surf_cv_toggle_exit ; done | |
274 | |
275 | |
276 ; ---- view 8: last dive info ---- | |
277 ; | |
278 surf_customview_init_view8: | |
279 call TFT_surf_cv_lastdive ; show last dive info | |
280 bra surf_cv_toggle_exit ; done | |
623 | 281 |
282 | |
634 | 283 ; ---- view 9: sensor mV at the surface ---- |
284 ; | |
285 surf_customview_init_view9: | |
286 IFDEF _external_sensor | |
287 btfsc FLAG_ccr_mode ; in CCR mode? | |
288 bra surf_customview_init_view9a ; YES - show view | |
289 btfsc FLAG_pscr_mode ; NO - in pSCR mode? | |
290 bra surf_customview_init_view9a ; YES - show view | |
291 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
292 | |
293 surf_customview_init_view9a: | |
294 movff opt_ccr_mode,WREG ; get SP mode (0: fixed SP, 1: Sensor, 2: auto SP) | |
295 decfsz WREG,W ; opt_ccr_mode = 1 (sensor)? | |
296 bra surf_customview_toggle ; NO - goto next view | |
297 STRCPY_TEXT_PRINT tSensorMilliVolt ; YES - title of custom view | |
298 call TFT_imprint_surf_mV ; - write sensor mV readings to screen | |
299 bra surf_cv_toggle_exit ; - done | |
300 ELSE | |
301 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
302 ENDIF | |
582 | 303 |
0 | 304 |
634 | 305 ; ---- view 10: transmitter data / debug ---- |
306 ; | |
307 surf_customview_init_view10: | |
623 | 308 IFDEF _rx_functions |
309 btfss tr_functions_activated ; TR functions activated? | |
310 bra surf_customview_toggle ; NO - show next view in list | |
311 STRCAT_PRINT "ID bar Volt" ; YES - title of custom view (none language-dependent) | |
634 | 312 call TFT_surf_cv_tankdata ; - show received data |
313 bra surf_cv_toggle_exit ; - done | |
623 | 314 ELSE |
315 bra surf_customview_toggle ; not available without RX functions compiled in, goto next view | |
316 ENDIF | |
317 | |
634 | 318 |
319 ;============================================================================= | |
320 custview3 CODE | |
321 ;============================================================================= | |
322 | |
323 | |
623 | 324 ;----------------------------------------------------------------------------- |
634 | 325 ; Show next Pre-Menu Item / Clear the Pre-Menu |
326 ; | |
582 | 327 global menuview_toggle |
634 | 328 menuview_toggle: |
623 | 329 bcf switch_left ; clear button event |
330 movlw divemode_timeout_premenu ; get timeout for dive mode pre-menu | |
634 | 331 call restart_timeout_time ; restart the timeout |
332 bsf dive_pre_menu ; flag that the pre-menu is shown | |
333 menuview_next_item: | |
334 incf active_premenu,F ; increment pre-menu item number | |
335 movlw num_premenu_items ; get number of pre-menu items | |
336 cpfsgt active_premenu ; beyond last item? | |
623 | 337 bra menuview_mask ; NO - show item |
634 | 338 ;bra menuview_toggle_reset ; YES - reset to first item |
339 | |
340 global menuview_toggle_reset | |
341 menuview_toggle_reset: | |
342 clrf active_premenu ; reset pre-menu item number | |
343 bcf dive_pre_menu ; flag that the pre-menu is not shown anymore | |
344 ;bra menuview_mask ; clear last item from display | |
345 | |
0 | 346 menuview_mask: |
623 | 347 WIN_BOX_BLACK dm_premenu_row, dm_premenu_bot, dm_premenu_col, dm_premenu_rgt ; top, bottom, left, right |
634 | 348 btfsc dive_pre_menu ; shall show pre-menu? |
349 bra menuview_show_item ; YES - show menu item | |
350 ;bra menuview_exit ; NO - done with pre-menu | |
631 | 351 |
634 | 352 menuview_exit: |
353 bcf win_invert ; clear inverse printing | |
354 btfss dive_pre_menu ; showing pre-menu? | |
355 goto TFT_show_temp_divemode ; NO - restore temperature display and return | |
356 return ; YES - done | |
357 | |
358 menuview_show_item: | |
359 WIN_SMALL dm_premenu_col,dm_premenu_row | |
360 FONT_COLOR_ATTENTION ; set color | |
623 | 361 bsf win_invert ; set inverse printing |
362 movf active_premenu,W ; get active pre-menu item | |
0 | 363 dcfsnz WREG,F |
631 | 364 bra menuview_view_gaschange ; 1: gas change (skipped if no better gas/dil cued) |
137 | 365 dcfsnz WREG,F |
634 | 366 bra menuview_view_ackn ; 2: "Ackn?" (skipped if no active advice/attention/warning sign) |
367 dcfsnz WREG,F | |
368 bra menuview_view_divemenu ; 3: "Menu?" (skipped in gauge and apnoe modes) | |
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
369 dcfsnz WREG,F |
631 | 370 IFDEF _cave_mode |
634 | 371 bra menuview_view_cavemenu ; 4: "Cave?" (skipped if not in cave mode) |
631 | 372 ELSE |
634 | 373 bra menuview_next_item ; 4: cave mode not implemented, goto next item |
631 | 374 ENDIF |
0 | 375 dcfsnz WREG,F |
634 | 376 bra menuview_view_sim_quit ; 5: "Quit?" (in simulation mode only) |
0 | 377 dcfsnz WREG,F |
634 | 378 bra menuview_view_sim_down ; 6: "Sim down" (in simulation mode only) |
0 | 379 dcfsnz WREG,F |
634 | 380 bra menuview_view_sim_up ; 7: "Sim up" (in simulation mode only) |
0 | 381 dcfsnz WREG,F |
634 | 382 bra menuview_view_sim_time ; 8: "Sim+5'" (in simulation mode only) |
631 | 383 dcfsnz WREG,F |
634 | 384 bra menuview_view_apnoe_quit ; 9: "Quit?" (in apnoe mode only) |
0 | 385 dcfsnz WREG,F |
634 | 386 bra menuview_view_gauge_reset ; 10: "Reset Avr" (in gauge mode only) |
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
387 dcfsnz WREG,F |
634 | 388 IFDEF _compass |
389 bra menuview_view_course ; 11: "Course" (only when compass is shown) | |
390 ELSE | |
391 bra menuview_next_item ; 11: compass not implemented, goto next item | |
392 ENDIF | |
393 dcfsnz WREG,F | |
394 bra menuview_view_layout ; 12: "Layout" (offer alternative layout, aka blind mode) | |
395 bra menuview_exit ; catch illegal item number | |
396 ; when adding or removing items, adjust the value num_premenu_items in the #DEFINE ! | |
137 | 397 |
398 | |
634 | 399 ; --- item 1: gas change advice --- |
400 ; | |
137 | 401 menuview_view_gaschange: |
634 | 402 btfsc request_gas_change ; last gas change request already executed? |
403 bra menuview_next_item ; YES - goto next option | |
623 | 404 IFDEF _ccr_pscr |
604 | 405 btfsc FLAG_oc_mode ; in OC mode? |
406 bra menuview_view_gaschange_OC ; YES | |
623 | 407 btfsc bailout_mode ; in bailout? |
604 | 408 bra menuview_view_gaschange_OC ; YES |
409 menuview_view_gaschange_DIL: | |
410 btfss better_dil_available ; is the better diluent still available? | |
634 | 411 bra menuview_next_item ; NO - goto next item |
604 | 412 movff best_dil_number,PRODL ; number (1-5) of the "best diluent" |
623 | 413 bsf is_diluent_menu ; setting up diluents |
634 | 414 bra menuview_view_gaschange_com ; continue with common part |
415 ENDIF ; _ccr_pscr | |
604 | 416 menuview_view_gaschange_OC: |
417 btfss better_gas_available ; is the better gas still available? | |
634 | 418 bra menuview_next_item ; NO - goto next item |
419 movff best_gas_number,PRODL ; YES - number (1-5) of the "best gas" | |
420 bcf is_diluent_menu ; - setting up OC gases | |
604 | 421 menuview_view_gaschange_com: |
422 decf PRODL,F ; (1-5) -> (0-4) | |
634 | 423 bsf short_gas_descriptions ; use short version of gaslist_strcat_gas_PRODL and gaslist_strcat_setpoint |
604 | 424 bsf better_gas_hint ; color-code as best gas/diluent |
634 | 425 call gaslist_strcat_gas_PRODL ; append gas description of gas #PRODL (0-4) to current string |
631 | 426 movlw .5 ; point to 6th character (5 chars are used for the gas/dil description) |
427 movwf FSR2L ; ... | |
634 | 428 PUTC_PRINT "?" ; append question and dump buffer to screen |
604 | 429 bra menuview_exit ; done |
430 | |
634 | 431 ; ---- item 2: acknowledge ---- |
432 ; | |
433 menuview_view_ackn: | |
434 btfss sign_shown ; advice, attention or warning sign shown? | |
435 bra menuview_next_item ; NO - goto next item | |
436 STRCAT_TEXT_PRINT tDiveAckn ; YES - print "Ackn?" | |
437 bra menuview_exit ; - done | |
438 | |
439 | |
440 ; ---- item 3: dive menu ---- | |
441 ; | |
631 | 442 menuview_view_divemenu: |
623 | 443 btfsc FLAG_apnoe_mode ; in apnoe mode? |
634 | 444 bra menuview_next_item ; YES - goto next item |
623 | 445 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
634 | 446 bra menuview_next_item ; YES - goto next item |
623 | 447 PUTC "\xb7" ; NO - print '->' symbol |
448 STRCAT_TEXT_PRINT tDivePreMenu ; - print "Menu?" | |
449 bra menuview_exit ; - done | |
604 | 450 |
634 | 451 |
452 ; ---- item 4: cave menu ---- | |
453 ; | |
631 | 454 IFDEF _cave_mode |
455 menuview_view_cavemenu: | |
456 TSTOSS opt_cave_mode ; cave mode switched on? | |
634 | 457 bra menuview_next_item ; NO - goto next item |
631 | 458 PUTC "\xb7" ; YES - print '->' symbol |
459 STRCAT_TEXT_PRINT tDivePreCave ; - print "Cave?" | |
460 bra menuview_exit ; - done | |
634 | 461 ENDIF ; _cave_mode |
462 | |
631 | 463 |
634 | 464 ; ---- item 5: quit simulator --- |
465 ; | |
631 | 466 menuview_view_sim_quit: |
623 | 467 btfss simulatormode ; in simulator mode? |
634 | 468 bra menuview_next_item ; NO - goto next item |
623 | 469 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Simulation?" |
470 bra menuview_exit ; - done | |
604 | 471 |
634 | 472 |
473 ; ---- item 6: simulator - go down ---- | |
474 ; | |
631 | 475 menuview_view_sim_down: |
623 | 476 btfss simulatormode ; in simulator mode? |
634 | 477 bra menuview_next_item ; NO - goto next item |
604 | 478 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down |
479 bra menuview_exit ; done | |
480 | |
634 | 481 |
482 ; ---- item 7: simulator - go up ---- | |
483 ; | |
631 | 484 menuview_view_sim_up: |
623 | 485 btfss simulatormode ; in simulator mode? |
634 | 486 bra menuview_next_item ; NO - goto next item |
623 | 487 STRCPY_PRINT "Sim\xb9" ; YES - print up arrow for going up |
488 bra menuview_exit ; - done | |
604 | 489 |
634 | 490 |
491 ; ---- item 8: simulator - advance time ---- | |
492 ; | |
631 | 493 menuview_view_sim_time: |
623 | 494 btfss simulatormode ; in simulator mode? |
634 | 495 bra menuview_next_item ; NO - goto next item |
623 | 496 btfsc FLAG_gauge_mode ; YES - in gauge mode? |
634 | 497 bra menuview_next_item ; YES - goto next item |
623 | 498 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? |
634 | 499 bra menuview_next_item ; YES - goto next item |
623 | 500 STRCPY_PRINT "Sim+5'" ; NO - print "Sim+5'" |
501 bra menuview_exit ; - done | |
604 | 502 |
634 | 503 |
504 ; ---- item 9: apnoe mode - quit ---- | |
505 ; | |
631 | 506 menuview_view_apnoe_quit: |
507 btfss FLAG_apnoe_mode ; in apnoe mode? | |
634 | 508 bra menuview_next_item ; NO - goto next option |
631 | 509 btfss apnoe_at_surface ; YES - at the surface? |
634 | 510 bra menuview_next_item ; NO - goto next item |
631 | 511 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Apnea mode?" |
512 bra menuview_exit ; - done | |
513 | |
634 | 514 |
515 ; ---- item 10: gauge mode - reset average ---- | |
516 ; | |
631 | 517 menuview_view_gauge_reset: |
518 btfss FLAG_gauge_mode ; in gauge mode? | |
634 | 519 bra menuview_next_item ; NO - goto next item |
631 | 520 STRCPY_TEXT_PRINT tResetAvg ; YES - print "Reset Avg." |
521 bra menuview_exit ; - done | |
522 | |
634 | 523 |
524 ; ---- item 11: set bearing ---- | |
525 IFDEF _compass | |
631 | 526 menuview_view_course: |
604 | 527 movlw index_compass_dm ; index of compass view |
623 | 528 cpfseq active_customview ; in compass view? |
634 | 529 bra menuview_next_item ; NO - goto next item |
623 | 530 STRCPY_TEXT_PRINT tSetHeading ; YES - print "Heading" |
531 bra menuview_exit ; - done | |
532 ENDIF | |
604 | 533 |
634 | 534 |
535 ; ---- item 12: switch layout ---- | |
536 ; | |
631 | 537 menuview_view_layout: |
623 | 538 btfsc FLAG_apnoe_mode ; in apnoe mode? |
634 | 539 bra menuview_next_item ; YES - goto next item |
628 | 540 STRCPY_TEXT_PRINT tDiveLayout ; NO - print "Layout" |
623 | 541 bra menuview_exit ; - done |
582 | 542 |
634 | 543 |
544 ;============================================================================= | |
545 custview4 CODE | |
546 ;============================================================================= | |
604 | 547 |
631 | 548 |
634 | 549 ;----------------------------------------------------------------------------- |
550 ; Show a specific Dive Mode Custom View | |
551 ; | |
631 | 552 global dive_customview_show |
553 dive_customview_show: | |
554 btfss custom_view_locked ; custom view locked? | |
555 bra dive_customview_show_1 ; NO - call-up the view | |
556 movwf backup_customview ; YES - store requested custom view for later recall | |
557 return ; - done | |
558 dive_customview_show_1: | |
559 movwf active_customview ; set the requested custom view | |
560 bra dive_customview_callup ; call-up the custom view | |
561 | |
634 | 562 |
563 ;----------------------------------------------------------------------------- | |
564 ; Show again last Dive Mode Custom View | |
565 ; | |
631 | 566 global dive_customview_recall |
567 dive_customview_recall: | |
568 movff backup_customview,active_customview ; recall the saved custom view | |
569 bra dive_customview_callup ; call-up the custom view | |
570 | |
634 | 571 |
572 ;----------------------------------------------------------------------------- | |
573 ; Show next Dive Mode Custom View | |
574 ; | |
623 | 575 global dive_customview_toggle |
576 dive_customview_toggle: | |
577 incf active_customview,F ; increment number of custom view to show | |
634 | 578 movlw index_cv_dm_max ; get highest index in use in dive mode custom view |
579 cpfsgt active_customview ; beyond last view? | |
631 | 580 bra dive_customview_callup ; NO - call-up the custom view |
581 clrf active_customview ; YES - reset to zero (zero = blank custom view) | |
582 ;bra dive_customview_callup ; call-up the custom view | |
583 | |
634 | 584 |
585 ;----------------------------------------------------------------------------- | |
586 ; Show current Dive Mode Custom View | |
587 ; | |
631 | 588 global dive_customview_callup |
589 dive_customview_callup: | |
590 movlw index_compass_dm ; get index of compass custom view | |
591 cpfseq active_customview ; will compass be shown? | |
634 | 592 call I2C_sleep_compass ; NO - stop compass to save on energy |
582 | 593 |
623 | 594 ; clear custom view area in dive mode |
604 | 595 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
634 | 596 |
597 ; jump table | |
623 | 598 movf active_customview,W ; get custom view to show |
631 | 599 dcfsnz WREG,F ; |
600 bra init_avr_stopwatch ; 1: average depth and stopwatch | |
601 dcfsnz WREG,F ; | |
602 bra init_TFT_dive_compass ; 2: compass | |
603 dcfsnz WREG,F ; | |
604 bra init_ppo2_sensors ; 3: ppO2 sensors | |
605 dcfsnz WREG,F ; | |
606 bra init_sensor_check ; 4: sensor check | |
607 dcfsnz WREG,F ; | |
608 bra init_pscr_info ; 5: pSCR data | |
609 dcfsnz WREG,F ; | |
610 bra init_pressures_SAC ; 6: tank pressure and SAC rate | |
611 dcfsnz WREG,F ; | |
612 bra init_gas_needs_ascent ; 7: gas needs for ascent / cave return | |
613 dcfsnz WREG,F ; | |
614 bra init_cave_tts ; 8: cave mode TTS | |
615 dcfsnz WREG,F ; | |
616 bra init_decoplan ; 9: deco plan (next stops) | |
617 dcfsnz WREG,F ; | |
618 bra init_ceiling_GF_tissue ; 10: ceiling, current GF and tissues | |
619 dcfsnz WREG,F ; | |
620 bra init_CNS ; 11: CNS values | |
621 dcfsnz WREG,F ; | |
634 | 622 bra init_ppo2_ead_end_cns ; 12: ppO2, END/EAD and CNS/gas density |
631 | 623 dcfsnz WREG,F ; |
624 bra init_clock_batt_surfpress ; 13: clock, battery and surface pressure | |
625 dcfsnz WREG,F ; | |
626 bra init_gf_factors ; 14: GF factors | |
627 dcfsnz WREG,F ; | |
628 bra init_cave_waypoints ; 15: cave waypoints | |
634 | 629 ;bra dive_cv_toggle_exit ; 0: no view (blank screen in custom view area) |
630 | |
631 dive_cv_toggle_exit: | |
632 bcf request_next_custview ; clear request flag | |
633 return ; done | |
582 | 634 |
0 | 635 |
634 | 636 ; ---- view 1: average depth and stopwatch ---- |
637 ; | |
604 | 638 init_avr_stopwatch: |
639 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
623 | 640 bra dive_customview_toggle ; YES - goto next view |
641 call TFT_avr_stopwatch_mask ; NO - mask for average depth and stopwatch | |
642 call TFT_avr_stopwatch ; - data for average depth and stopwatch | |
634 | 643 bra dive_cv_toggle_exit ; - done |
644 | |
0 | 645 |
634 | 646 ; ---- view 2: compass ---- |
647 ; | |
648 init_TFT_dive_compass: | |
623 | 649 IFDEF _compass |
604 | 650 call I2C_init_compass ; start compass |
634 | 651 call TFT_dive_compass_mask ; mask for compass |
652 bra dive_cv_toggle_exit ; done | |
623 | 653 ELSE |
654 bra dive_customview_toggle ; not available without compass compiled in, goto next view | |
655 ENDIF | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
656 |
634 | 657 |
658 ; ---- view 3: ppO2 sensors --- | |
659 ; | |
660 init_ppo2_sensors: | |
661 IFDEF _external_sensor | |
662 bsf trigger_temp_changed ; fake a change of the temperature to have the resettable dive time overwritten which was shown with the compass view | |
663 btfsc FLAG_ccr_mode ; in CC mode? | |
664 bra init_ppo2_sensors_1 ; YES | |
665 btfsc FLAG_pscr_mode ; in pSCR mode? | |
666 bra init_ppo2_sensors_1 ; YES | |
667 bra dive_customview_toggle ; NO to both, goto next view | |
668 init_ppo2_sensors_1: | |
669 btfsc ext_input_s8_ana ; do we have an S8/analog input? | |
670 bra init_ppo2_sensors_2 ; YES - show this view | |
671 btfsc ext_input_optical ; NO - do we have an optical input? | |
672 bra init_ppo2_sensors_2 ; YES - show this view | |
673 bra dive_customview_toggle ; NO - goto next view | |
674 | |
675 init_ppo2_sensors_2: | |
676 call TFT_ppo2_sensors_mask ; mask for ppO2 sensors | |
677 call TFT_ppo2_sensors ; data for ppO2 sensors | |
678 bra dive_cv_toggle_exit ; done | |
679 ELSE | |
680 bra dive_customview_toggle ; not available without external sensors, got next view | |
681 ENDIF | |
682 | |
683 ; ---- view 4: sensor check ---- | |
684 ; | |
685 init_sensor_check: | |
686 IFDEF _ccr_pscr | |
687 btfss FLAG_ccr_mode ; in CCR mode? | |
688 bra dive_customview_toggle ; NO - goto next view | |
689 call TFT_sensor_check_mask ; YES - mask for sensor check | |
690 call TFT_sensor_check ; - data for sensor check | |
691 bra dive_cv_toggle_exit ; - done | |
692 ELSE | |
693 bra dive_customview_toggle ; not available without CCR mode compiled in, goto next view | |
694 ENDIF | |
695 | |
696 | |
697 ; ---- view 5: pSCR data ---- | |
698 ; | |
699 init_pscr_info: | |
700 IFDEF _ccr_pscr | |
701 btfss FLAG_pscr_mode ; in pSCR mode? | |
702 bra dive_customview_toggle ; NO - goto next view | |
703 call TFT_pscr_info_mask ; YES - mask for pSCR info | |
704 call TFT_pscr_info ; - data for pSCR info | |
705 bra dive_cv_toggle_exit ; - done | |
706 ELSE | |
707 bra dive_customview_toggle ; not available without CCR / pSCR mode, goto next view | |
708 ENDIF | |
709 | |
710 | |
711 ; view 6: tank pressure and SAC rate ---- | |
712 ; | |
713 init_pressures_SAC: | |
604 | 714 IFDEF _rx_functions |
623 | 715 btfss tr_functions_activated ; TR functions activated? |
716 bra dive_customview_toggle ; NO - goto next view | |
717 call TFT_pressures_SAC_mask ; YES - mask for pressures and SAC | |
718 call TFT_pressures_SAC ; - data for pressures and SAC | |
634 | 719 bra dive_cv_toggle_exit ; - done |
604 | 720 ELSE |
623 | 721 bra dive_customview_toggle ; not available without RX functions, got next view |
604 | 722 ENDIF |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
53
diff
changeset
|
723 |
333
14b466f66a7f
Extend the Ceiling custom-view with ppO2 and current GF
Janos Kovacs <kovjanos@gmail.com>
parents:
327
diff
changeset
|
724 |
634 | 725 ; ---- view 7: gas needs ---- |
726 ; | |
727 init_gas_needs_ascent: | |
604 | 728 btfsc FLAG_apnoe_mode ; in apnoe mode? |
623 | 729 bra dive_customview_toggle ; YES - goto next view |
730 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
731 bra dive_customview_toggle ; YES - goto next view | |
631 | 732 TSTOSS opt_calc_gasvolume ; NO - check if gas volume calculation is switched on |
623 | 733 bra dive_customview_toggle ; NO - goto next view |
631 | 734 call TFT_gas_needs_mask ; YES - mask for gas needs ascent |
735 call TFT_gas_needs ; - data for gas needs ascent | |
634 | 736 bra dive_cv_toggle_exit ; - done |
737 | |
582 | 738 |
634 | 739 ; ---- view 8: cave mode TTS ---- |
740 init_cave_tts: | |
631 | 741 IFDEF _cave_mode |
742 btfss cave_mode ; in cave mode? | |
743 bra dive_customview_toggle ; NO - goto next view | |
744 call TFT_cave_tts_mask ; YES - show mask | |
745 call TFT_cave_tts ; - show data | |
634 | 746 bra dive_cv_toggle_exit ; - done |
631 | 747 ELSE |
748 bra dive_customview_toggle ; not available without cave mode, goto next view | |
749 ENDIF | |
750 | |
751 | |
634 | 752 ; ---- view 9: deco plan ---- |
753 ; | |
754 init_decoplan: | |
755 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
756 bra dive_customview_toggle ; YES - goto next view | |
757 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
758 bra dive_customview_toggle ; YES - goto next view | |
759 call TFT_decoplan_mask ; NO - mask for deco plan | |
760 call TFT_decoplan ; - data for deco plan | |
761 bra dive_cv_toggle_exit ; - done | |
762 | |
763 | |
764 ; ---- view 10: ceiling, tissues and current GF | |
765 ; | |
766 init_ceiling_GF_tissue: | |
767 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
768 bra dive_customview_toggle ; YES - goto next view | |
769 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
770 bra dive_customview_toggle ; YES - call next view | |
771 call TFT_ceiling_GF_tissue_mask ; NO - mask for ceiling, current GF and tissues | |
772 call TFT_ceiling_GF_tissue ; - data for ceiling, current GF and tissues | |
773 bra dive_cv_toggle_exit ; - done | |
774 | |
775 | |
776 ; ---- view 11: CNS values ---- | |
777 ; | |
778 init_CNS: ; CNS at end of dive | |
779 btfsc FLAG_gauge_mode ; in gauge mode? | |
780 bra dive_customview_toggle ; YES - call next view | |
781 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? | |
782 bra dive_customview_toggle ; YES - call next view | |
783 call TFT_CNS_mask ; NO - mask for CNS values | |
784 call TFT_CNS ; - data for CNS values | |
785 bra dive_cv_toggle_exit ; - done | |
786 | |
787 | |
788 ; ---- view 12: ppO2, END/EAD and CNS/gas density ---- | |
789 ; | |
790 init_ppo2_ead_end_cns: ; | |
791 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
792 bra dive_customview_toggle ; YES - goto next view | |
793 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
794 bra dive_customview_toggle ; YES - goto next view | |
795 call TFT_ppo2_ead_end_cns_mask ; NO - mask for ppO2, END/EAD and CNS | |
796 call TFT_ppo2_ead_end_cns ; - data for ppO2, END/EAD and CNS | |
797 bra dive_cv_toggle_exit ; - done | |
798 | |
799 | |
800 ; ---- view 13: clock, battery and surface pressure | |
801 ; | |
802 init_clock_batt_surfpress: | |
803 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure | |
804 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure | |
805 bra dive_cv_toggle_exit ; done | |
806 | |
807 | |
808 ; ---- view 14: GF factors | |
809 ; | |
810 init_gf_factors: | |
811 call TFT_gf_factors_mask ; show GF factors | |
812 bra dive_cv_toggle_exit ; done | |
813 | |
814 | |
815 ; ---- view 15: cave waypoints ---- | |
816 ; | |
817 init_cave_waypoints: | |
818 IFDEF _cave_mode | |
819 call TFT_cave_waypoints ; show waypoint graphics | |
820 bra dive_cv_toggle_exit ; done | |
821 ELSE | |
822 bra dive_customview_toggle ; not available without cave mode, goto next view | |
823 ENDIF | |
0 | 824 |
623 | 825 ;----------------------------------------------------------------------------- |
0 | 826 |
623 | 827 END |