comparison src/customview.asm @ 560:b7eb98dbd800

bump to 2.96beta (REFACTORED VERSION)
author heinrichsweikamp
date Wed, 31 Jan 2018 19:39:37 +0100
parents d36f9fca10ae
children 690bfb76911c
comparison
equal deleted inserted replaced
559:9cb967d844f0 560:b7eb98dbd800
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File customview.asm 3 ; File customview.asm REFACTORED VERSION V2.95
4 ; 4 ;
5 ; Customview in Surfacemode and Divemode 5 ; Customview in Surfacemode and Divemode
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
19 #include "wait.inc" 19 #include "wait.inc"
20 #include "surfmode.inc" 20 #include "surfmode.inc"
21 #include "convert.inc" 21 #include "convert.inc"
22 #include "divemode.inc" 22 #include "divemode.inc"
23 #include "i2c.inc" 23 #include "i2c.inc"
24 #include "start.inc"
24 25
25 gui CODE 26 gui CODE
26 27
27 ;============================================================================= 28 ;=============================================================================
28 ; Do every-second tasks for the custom view area (Dive mode) 29 ; Do every-second tasks for the custom view area (Dive mode)
29 30
30 global customview_second 31 global customview_second
31 customview_second: 32 customview_second:
32 movff menupos3,WREG ; copy current view (1-...) 33 movff menupos3,WREG ; copy current view (1-...)
33 dcfsnz WREG,F 34 dcfsnz WREG,F
34 goto TFT_update_ppo2_sensors ; Update Sensor data ; and return 35 goto TFT_update_ppo2_sensors ; Update Sensor data ; and return
35 dcfsnz WREG,F 36 dcfsnz WREG,F
36 goto TFT_update_avr_stopwatch ; Update average depth and stopwatch; and return 37 goto TFT_update_avr_stopwatch ; Update average depth and stopwatch; and return
37 dcfsnz WREG,F 38 dcfsnz WREG,F
38 goto TFT_decoplan ; Show decoplan ; and return 39 goto TFT_decoplan ; Show decoplan ; and return
39 dcfsnz WREG,F 40 dcfsnz WREG,F
40 goto TFT_battinfo_tissues_clock ; Update Battery, Tissues and clock ; and return 41 goto TFT_battinfo_tissues_clock ; Update Battery, Tissues and clock ; and return
41 dcfsnz WREG,F 42 dcfsnz WREG,F
42 goto TFT_gf_info ; Update GF informations ; and return 43 goto TFT_gf_info ; Update GF informations ; and return
43 dcfsnz WREG,F 44 dcfsnz WREG,F
44 return ; Compass updated seperately (Faster) in divemode; 45 return ; Compass updated separately (faster) in divemode;
45 dcfsnz WREG,F 46 dcfsnz WREG,F
46 goto TFT_dyn_gaslist ; Update the gaslist ; and return 47 nop ; ex goto TFT_dyn_gaslist
47 dcfsnz WREG,F 48 dcfsnz WREG,F
48 goto TFT_hud_voltages ; Show HUD details ; and return 49 goto TFT_CNS ; Show CNS values for end-of-dive, ex goto TFT_hud_voltages
49 dcfsnz WREG,F 50 dcfsnz WREG,F
50 bra customview_1sec_view9 ; Make sure to change value in "check_ppo2_display:" when moving around custom views 51 bra customview_1sec_view9 ; Make sure to change value in "check_ppo2_display:" when moving around custom views
51 dcfsnz WREG,F 52 dcfsnz WREG,F
52 goto TFT_sensor_check ; Show ppO2 of O2 and Diluent ; and return 53 goto TFT_sensor_check ; Show ppO2 of O2 and Diluent ; and return
53 dcfsnz WREG,F 54 dcfsnz WREG,F
54 goto TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS; and return 55 goto TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS; and return
55 dcfsnz WREG,F 56 dcfsnz WREG,F
56 goto TFT_pscr_info ; Show ppO2, drop and lung ratio; and return 57 goto TFT_pscr_info ; Show ppO2, drop and lung ratio; and return
58 dcfsnz WREG,F
59 goto TFT_gas_needs ; Show gas needs
57 60
58 ; Menupos3=0, do nothing 61 ; Menupos3=0, do nothing
59 return 62 return
60 63
61 customview_1sec_view9: ; Ceiling 64 customview_1sec_view9: ; Ceiling
62 call TFT_ceiling ; Show Ceiling 65 call TFT_ceiling ; Show Ceiling
63 ; ppO2 value 66 call TFT_display_pure_ppo2 ; ppO2 value
64 call TFT_display_ppo2_val 67 extern char_I_deco_model ; current GF value
65 ; current GF value 68 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF
66 extern char_I_deco_model 69 return ; No GF info for non-GF modes
67 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF 70 goto TFT_gf_info ; Update GF informations ; and return
68 return ; No GF info for non-GF modes 71
69 goto TFT_gf_info ; Update GF informations ; and return 72 global customview_alternative_second
70 73 customview_alternative_second:
71 74 movff menupos3,WREG ; copy current view (1-...)
75 dcfsnz WREG,F
76 bra customview_alt_second_view1 ; View 1
77 dcfsnz WREG,F
78 nop ; View 2
79
80 ; Menupos3=0, do nothing
81 return
82
83 customview_alt_second_view1:
84 bsf FLAG_TFT_max_depth_alt
85 bsf FLAG_TFT_big_deco_alt
86 return
72 87
73 ;============================================================================= 88 ;=============================================================================
74 ; Do every-minute tasks for the custom view area 89 ; Do every-minute tasks for the custom view area
75 90
76 global customview_minute 91 global customview_minute
77 customview_minute: 92 customview_minute:
78 return 93 return
79 ; movff menupos3,WREG ; copy 94 ; movff menupos3,WREG ; copy
80 ; dcfsnz WREG,F 95 ; dcfsnz WREG,F
81 ; bra customview_1min_view1 96 ; bra customview_1min_view1
82 ; dcfsnz WREG,F 97 ; dcfsnz WREG,F
83 ; bra customview_1min_view2 98 ; bra customview_1min_view2
84 ; dcfsnz WREG,F 99 ; dcfsnz WREG,F
117 132
118 global surf_customview_toggle 133 global surf_customview_toggle
119 surf_customview_toggle: 134 surf_customview_toggle:
120 bcf switch_right 135 bcf switch_right
121 incf menupos3,F ; Number of customview to show 136 incf menupos3,F ; Number of customview to show
122 movlw d'9' ; Max number of customsviews in surface mode 137 movlw d'9' ; Max number of customsviews in surface mode
123 cpfsgt menupos3 ; Max reached? 138 cpfsgt menupos3 ; Max reached?
124 bra surf_customview_mask ; No, show 139 bra surf_customview_mask ; No, show
125 movlw .1 140 movlw .1
126 movwf menupos3 ; Reset to one (Always one custom view visible) 141 movwf menupos3 ; Reset to one (Always one custom view visible)
127 142
202 STRCPY_TEXT_PRINT tFixedSetpoints ; Title of customview 217 STRCPY_TEXT_PRINT tFixedSetpoints ; Title of customview
203 call TFT_standard_color 218 call TFT_standard_color
204 call TFT_splist_surfmode ; Show Setpoint list 219 call TFT_splist_surfmode ; Show Setpoint list
205 bra customview_toggle_exit ; Done. 220 bra customview_toggle_exit ; Done.
206 221
207 surf_customview_init_view9: ; View 9: Sensor mV on the surface 222 surf_customview_init_view9: ; View 9: Sensor mV on the surface
208 btfsc FLAG_ccr_mode 223 btfsc FLAG_ccr_mode
209 bra surf_customview_init_view9a ; we are in CCR mode 224 bra surf_customview_init_view9a ; we are in CCR mode
210 btfsc FLAG_pscr_mode 225 btfsc FLAG_pscr_mode
211 bra surf_customview_init_view9a ; we are in PSCR mode 226 bra surf_customview_init_view9a ; we are in PSCR mode
212 bra surf_customview_toggle ; we are not in any rebreather mode, so skip 227 bra surf_customview_toggle ; we are not in any rebreather mode, so skip
213 surf_customview_init_view9a: 228 surf_customview_init_view9a:
214 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP 229 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP
215 sublw .1 ; opt_ccr_mode = 1 (Sensor)? 230 sublw .1 ; opt_ccr_mode = 1 (Sensor)?
216 bnz surf_customview_toggle ; sorry, no sensors, skip again 231 bnz surf_customview_toggle ; sorry, no sensors, skip again
217 STRCPY_TEXT_PRINT tSensorMilliVolt ; Title of customview 232 STRCPY_TEXT_PRINT tSensorMilliVolt ; Title of customview
218 call TFT_standard_color 233 call TFT_standard_color
219 extern TFT_sensor_mV 234 extern TFT_sensor_mV
220 call TFT_sensor_mV ; write sensor mV readings to screen 235 call TFT_sensor_mV ; write sensor mV readings to screen
221 bra customview_toggle_exit ; Done. 236 bra customview_toggle_exit ; Done.
222 237
223 surf_customview_init_view4: ; View4: Custom text 238 surf_customview_init_view4: ; View4: Custom text
224 call TFT_standard_color 239 call TFT_standard_color
225 call TFT_custom_text ; Show the custom text 240 call TFT_custom_text ; Show the custom text
226 bra customview_toggle_exit ; Done. 241 bra customview_toggle_exit ; Done.
240 extern TFT_surface_compass_mask 255 extern TFT_surface_compass_mask
241 call TFT_surface_compass_mask ; Show compass 256 call TFT_surface_compass_mask ; Show compass
242 bra customview_toggle_exit ; Done. 257 bra customview_toggle_exit ; Done.
243 258
244 surf_customview_init_view7: 259 surf_customview_init_view7:
245 btfsc FLAG_gauge_mode ; View7: Deco settings 260 btfsc FLAG_gauge_mode ; View7: Deco settings
246 bra surf_customview_toggle 261 bra surf_customview_toggle
247 btfsc FLAG_apnoe_mode 262 btfsc FLAG_apnoe_mode
248 bra surf_customview_toggle 263 bra surf_customview_toggle
249 extern deco_setup_dive 264
250 call deco_setup_dive
251 call TFT_surface_decosettings ; Show all deco settings 265 call TFT_surface_decosettings ; Show all deco settings
252 bra customview_toggle_exit ; Done. 266 bra customview_toggle_exit ; Done.
253 267
254 surf_customview_init_view8: ; View8: Last dive info 268 surf_customview_init_view8: ; View8: Last dive info
255 call TFT_surface_lastdive ; Show last dive interval 269 call TFT_surface_lastdive ; Show last dive interval
256 bra customview_toggle_exit ; Done. 270 bra customview_toggle_exit ; Done.
257 271
258 272
259 global menuview_toggle 273 global menuview_toggle
260 menuview_toggle: ; Show Menu or the simulator tasks 274 menuview_toggle: ; Show Menu or the simulator tasks
275 btfss alternative_divelayout ; In alternative layout mode?
276 bra menuview_toggle2 ; No
277 ; Switch back to normal mode for any menu tasks
278 bcf alternative_divelayout ; clear flag
279 bsf FLAG_TFT_divemode_mask ; Set flag for mask
280 bsf FLAG_TFT_max_depth ; set flag
281 btfss decostop_active ; deco?
282 bsf FLAG_TFT_display_ndl_mask ; NDL
283 btfsc decostop_active ; deco?
284 bsf FLAG_TFT_display_deko_mask ; Deco
285 call TFT_ClearScreen ; Clear screen
286 rcall customview_mask ; Re-Draw customview
287
288 menuview_toggle2:
261 movlw divemode_menuview_timeout 289 movlw divemode_menuview_timeout
262 movwf timeout_counter3 290 movwf timeout_counter3
263 bsf menuview 291 bsf menuview
264 bcf switch_left 292 bcf switch_left
265 incf menupos2,F ; Number of options to show 293 incf menupos2,F ; Number of options to show
266 movlw d'9' ; Max number of options in divemode 294 movlw d'10' ; Max number of options in divemode
267 cpfsgt menupos2 ; Max reached? 295 cpfsgt menupos2 ; Max reached?
268 bra menuview_mask ; No, show 296 bra menuview_mask ; No, show
269 global menuview_toggle_reset 297 global menuview_toggle_reset
270 menuview_toggle_reset: ; Timeout occured 298 menuview_toggle_reset: ; Timeout occurred
271 clrf menupos2 299 clrf menupos2
272 bcf menuview 300 bcf menuview
273 menuview_mask: 301 menuview_mask:
274 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.49 ; top, bottom, left, right 302 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.45 ; top, bottom, left, right - old value was .49
275 btfss FLAG_gauge_mode 303 btfss FLAG_gauge_mode
276 bra menuview_mask2 304 bra menuview_mask2
277 ; Clear some more in gauge mode -- "Reset Avg." text is longer than normal simtext 305 ; Clear some more in gauge mode -- "Reset Avg." text is longer than normal simtext
278 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.50, dm_simtext_column+.70 ; top, bottom, left, right 306 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.50, dm_simtext_column+.70 ; top, bottom, left, right
279 menuview_mask2: 307 menuview_mask2:
280 call TFT_draw_gassep_line 308 call TFT_draw_gassep_line
281 movlw color_yellow 309 movlw color_yellow
282 call TFT_set_color 310 call TFT_set_color
283 bsf win_invert ; Set invert flag 311 bsf win_invert ; Set invert flag
284 WIN_SMALL dm_simtext_column,dm_simtext_row 312 WIN_SMALL dm_simtext_column,dm_simtext_row
285 movff menupos2,WREG ; Menupos2 holds number of menu option to show 313 movff menupos2,WREG ; Menupos2 holds number of menu option to show
286 dcfsnz WREG,F 314 dcfsnz WREG,F
287 bra menuview_view_gaschange ; If a better gas is indicated 315 bra menuview_view_gaschange ; If a better gas is indicated
288 dcfsnz WREG,F 316 dcfsnz WREG,F
299 bra menuview_view6 ; "Reset Avr." (Gauge only) 327 bra menuview_view6 ; "Reset Avr." (Gauge only)
300 dcfsnz WREG,F 328 dcfsnz WREG,F
301 bra menuview_view7 ; "Sim:+5mins" (Sim only) 329 bra menuview_view7 ; "Sim:+5mins" (Sim only)
302 dcfsnz WREG,F 330 dcfsnz WREG,F
303 bra menuview_view8 ; "Heading" (When compass is shown) 331 bra menuview_view8 ; "Heading" (When compass is shown)
332 dcfsnz WREG,F
333 bra menuview_view9 ; "Layout" (Alternative Layout, aka Blind mode)
334
304 menuview_exit: 335 menuview_exit:
305 call TFT_standard_color 336 call TFT_standard_color
306 bcf win_invert ; Reset invert flag 337 bcf win_invert ; Reset invert flag
307 return ; Menupos2 = 0, Show nothing 338 return ; Menupos2 = 0, Show nothing
308 339
309 340
310 menuview_view_gaschange: 341 menuview_view_gaschange:
311 extern gaslist_strcat_gas_mod 342 extern gaslist_strcat_gas_mod
334 STRCPY_TEXT_PRINT tQuitSim ; "Quit Simulation?" 365 STRCPY_TEXT_PRINT tQuitSim ; "Quit Simulation?"
335 bra menuview_exit ; Done. 366 bra menuview_exit ; Done.
336 menuview_view3: 367 menuview_view3:
337 btfss simulatormode_active ; View only for simulator mode 368 btfss simulatormode_active ; View only for simulator mode
338 bra menuview_toggle ; Call next option 369 bra menuview_toggle ; Call next option
339 STRCPY_PRINT "Sim:-1m" 370 STRCPY_PRINT "Sim-1m" ; CHANGED, now "-" for going down
340 bra menuview_exit ; Done. 371 bra menuview_exit ; Done.
341 menuview_view4: 372 menuview_view4:
342 btfss simulatormode_active ; View only for simulator mode 373 btfss simulatormode_active ; View only for simulator mode
343 bra menuview_toggle ; Call next option 374 bra menuview_toggle ; Call next option
344 STRCPY_PRINT "Sim:+1m" 375 STRCPY_PRINT "Sim+1m" ; CHANGED, now "+" for going up
345 bra menuview_exit ; Done. 376 bra menuview_exit ; Done.
346 menuview_view5: 377 menuview_view5:
347 btfss FLAG_apnoe_mode ; In Apnoe mode? 378 btfss FLAG_apnoe_mode ; In Apnoe mode?
348 bra menuview_toggle ; No, call next option 379 bra menuview_toggle ; No, call next option
349 btfss FLAG_active_descent ; Are we descending? 380 btfss FLAG_active_descent ; Are we descending?
361 bra menuview_toggle ; Call next option 392 bra menuview_toggle ; Call next option
362 btfsc FLAG_gauge_mode ; In Gauge mode? 393 btfsc FLAG_gauge_mode ; In Gauge mode?
363 bra menuview_toggle ; Yes, call next option 394 bra menuview_toggle ; Yes, call next option
364 btfsc FLAG_apnoe_mode ; In Apnoe mode? 395 btfsc FLAG_apnoe_mode ; In Apnoe mode?
365 bra menuview_toggle ; Yes, call next option 396 bra menuview_toggle ; Yes, call next option
366 STRCPY_PRINT "Sim:+5'" 397 STRCPY_PRINT "Sim+5'"
367 bra menuview_exit ; Done. 398 bra menuview_exit ; Done.
368 menuview_view8: 399 menuview_view8:
369 movlw .6 400 movlw .6
370 cpfseq menupos3 ; in compass view? 401 cpfseq menupos3 ; in compass view?
371 bra menuview_toggle ; No, call next option 402 bra menuview_toggle ; No, call next option
372 STRCPY_TEXT_PRINT tSetHeading ; "Heading" 403 STRCPY_TEXT_PRINT tSetHeading ; "Heading"
373 bra menuview_exit ; Done. 404 bra menuview_exit ; Done.
374 405 menuview_view9:
375 406 STRCPY_PRINT "Layout"
407 bra menuview_exit ; Done.
408
409
410
411
376 ;============================================================================= 412 ;=============================================================================
413
414 customview_toggle_alternative:
415 movlw d'1' ; Max number of customviews in divemode, alternative layout
416 cpfsgt menupos3 ; Max reached?
417 bra customview_mask_alternative ; No, show
418 movlw .1
419 movwf menupos3 ; Reset to one, always one customview visible in alternative layout
420 customview_mask_alternative:
421 ; Clear custom view area in divemode
422 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right
423 call TFT_standard_color
424 movff menupos3,WREG ; Menupos3 holds number of customview function
425 dcfsnz WREG,F
426 bra customview_alt_init_view1 ; View 1: Big deco/ndl and max. depth
427 dcfsnz WREG,F
428 bra customview_alt_init_view2 ; View 2:
429
430 ;bra customview_alternative_toggle_exit ; No view (menupos3=0)
431
432 customview_alt_toggle_exit:
433 call TFT_standard_color
434 bcf toggle_customview ; Clear flag
435 return
436
437 customview_alt_init_view1: ; View 1: Big deco/ndl and max. depth
438 call TFT_max_depth_alternative
439 call TFT_big_deco_alt
440 bra customview_alt_toggle_exit
441
442 customview_alt_init_view2:
443 ; /* Just for test...
444 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch
445 call TFT_update_avr_stopwatch ; Update average depth and stopwatch
446 ; ...Just for test */
447
448 bra customview_alt_toggle_exit
449
450
377 ; Show next customview (and delete this flag) 451 ; Show next customview (and delete this flag)
378 customview_toggle_reset: ; Timeout occured 452 global customview_toggle
379 clrf menupos3 ; Reset to zero (Zero=no custom view) 453 customview_toggle:
454 bcf switch_right
455 incf menupos3,F ; Number of customview to show
456
457 btfsc alternative_divelayout ; In alternative layout mode?
458 bra customview_toggle_alternative ; Yes, use the big ones instead
459
460 movlw d'13' ; Max number of customviews in divemode
461 cpfsgt menupos3 ; Max reached?
462 bra customview_mask ; No, show
463 clrf menupos3 ; Reset to zero (Zero=no custom view)
464
380 global customview_mask 465 global customview_mask
381 customview_mask: 466 customview_mask:
382 ; Clear custom view area in divemode 467 ; Clear custom view area in divemode
383 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right 468 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right
384 WIN_SMALL dm_customview_column,dm_customview_row 469 WIN_SMALL dm_customview_column,dm_customview_row
385 call TFT_standard_color 470 call TFT_standard_color
386 movff menupos3,WREG ; Menupos3 holds number of customview function 471 movff menupos3,WREG ; Menupos3 holds number of customview function
387 dcfsnz WREG,F 472 dcfsnz WREG,F
388 bra customview_init_view1 ; Update Sensor data 473 bra customview_init_view1 ; Update Sensor data
389 dcfsnz WREG,F 474 dcfsnz WREG,F
390 bra customview_init_view2 ; average depth and stopwatch 475 bra customview_init_view2 ; average depth and stopwatch
391 dcfsnz WREG,F 476 dcfsnz WREG,F
392 bra customview_init_view3 ; Decoplan 477 bra customview_init_view3 ; Decoplan
393 dcfsnz WREG,F 478 dcfsnz WREG,F
394 bra customview_init_view4 ; Battery info, Tissues and clock 479 bra customview_init_view4 ; Battery info, Tissues and clock
395 dcfsnz WREG,F 480 dcfsnz WREG,F
396 bra customview_init_view5 ; GF informations 481 bra customview_init_view5 ; GF informations
397 dcfsnz WREG,F 482 dcfsnz WREG,F
398 bra customview_init_view6 ; Compass 483 bra customview_init_view6 ; Compass
399 dcfsnz WREG,F 484 dcfsnz WREG,F
400 bra customview_init_view7 ; Dynamic gaslist 485 bra customview_init_view7 ; Dynamic gaslist
401 dcfsnz WREG,F 486 dcfsnz WREG,F
402 bra customview_init_view8 ; HUD voltages 487 bra customview_init_view8 ; HIJACKED for CNS (ex HUD voltages)
403 dcfsnz WREG,F 488 dcfsnz WREG,F
404 bra customview_init_view9 ; ppO2, Ceiling and current GF 489 bra customview_init_view9 ; ppO2, Ceiling and current GF
405 dcfsnz WREG,F 490 dcfsnz WREG,F
406 bra customview_init_view10 ; Sensor check 491 bra customview_init_view10 ; Sensor check
407 dcfsnz WREG,F 492 dcfsnz WREG,F
408 bra customview_init_view11 ; ppO2, END/EAD and CNS 493 bra customview_init_view11 ; ppO2, END/EAD and CNS
409 dcfsnz WREG,F 494 dcfsnz WREG,F
410 bra customview_init_view12 ; PSCR Info 495 bra customview_init_view12 ; PSCR Info
411 496 ; NEW ## bailout gas needs
497 dcfsnz WREG,F
498 bra customview_init_view13 ; Gas needs
499
412 customview_init_nocustomview: 500 customview_init_nocustomview:
413 call I2C_sleep_accelerometer ; Stop accelerometer 501 call I2C_sleep_accelerometer ; Stop accelerometer
414 call I2C_sleep_compass ; Stop compass 502 call I2C_sleep_compass ; Stop compass
415 bra customview_toggle_exit 503 bra customview_toggle_exit
416 504
417 customview_init_view1: 505 customview_init_view1:
418 btfsc FLAG_apnoe_mode ; In Apnoe mode? 506 btfsc FLAG_apnoe_mode ; In Apnoe mode?
419 bra customview_toggle ; yes, Call next view... 507 bra customview_toggle ; yes, Call next view...
420 btfsc FLAG_pscr_mode ; In PSCR mode? 508 btfsc FLAG_pscr_mode ; In PSCR mode?
421 bra customview_init_view1a ; Yes 509 bra customview_init_view1a ; Yes
422 btfss FLAG_ccr_mode ; In CC mode? 510 btfss FLAG_ccr_mode ; In CC mode?
423 bra customview_toggle ; no, Call next view... 511 bra customview_toggle ; no, Call next view...
424 512
425 customview_init_view1a: 513 customview_init_view1a:
426 movf hardware_flag,W 514 movf hardware_flag,W
430 movf hardware_flag,W 518 movf hardware_flag,W
431 sublw 0x13 ; + 519 sublw 0x13 ; +
432 btfsc STATUS,Z 520 btfsc STATUS,Z
433 bra customview_toggle ; no, Call next view... 521 bra customview_toggle ; no, Call next view...
434 522
435 bsf dive_hud1_displayed ; Set display flag 523 call TFT_hud_mask ; Setup HUD mask
436 bsf dive_hud2_displayed ; Set display flag 524 call TFT_update_ppo2_sensors ; Update Sensor data
437 bsf dive_hud3_displayed ; Set display flag
438 call TFT_hud_mask ; Setup HUD mask
439 call TFT_update_ppo2_sensors ; Update Sensor data
440 bra customview_toggle_exit 525 bra customview_toggle_exit
441 526
442 customview_init_view2: 527 customview_init_view2:
443 btfsc FLAG_apnoe_mode ; In Apnoe mode? 528 btfsc FLAG_apnoe_mode ; In Apnoe mode?
444 bra customview_toggle ; Yes, Call next view... 529 bra customview_toggle ; Yes, Call next view...
445 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch 530 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch
446 call TFT_update_avr_stopwatch ; Update average depth and stopwatch 531 call TFT_update_avr_stopwatch ; Update average depth and stopwatch
447 bra customview_toggle_exit 532 bra customview_toggle_exit
448 533
449 customview_init_view3: 534 customview_init_view3:
450 btfsc FLAG_apnoe_mode ; In Apnoe mode? 535 btfsc FLAG_apnoe_mode ; In Apnoe mode?
451 bra customview_toggle ; Yes, Call next view... 536 bra customview_toggle ; Yes, Call next view...
453 bra customview_toggle ; Yes, Call next view... 538 bra customview_toggle ; Yes, Call next view...
454 call TFT_decoplan ; Show decoplan 539 call TFT_decoplan ; Show decoplan
455 bra customview_toggle_exit 540 bra customview_toggle_exit
456 541
457 customview_init_view4: 542 customview_init_view4:
458 call TFT_battinfo_tissues_clock_mask ; Setup Mask 543 call TFT_battinfo_tissues_clock_mask ; Setup Mask
459 call TFT_battinfo_tissues_clock ; Show Battery info, Tissues and clock 544 call TFT_battinfo_tissues_clock ; Show Battery info, Tissues and clock
460 bra customview_toggle_exit 545 bra customview_toggle_exit
461 546
462 customview_init_view5: 547 customview_init_view5:
463 btfsc FLAG_apnoe_mode ; In Apnoe mode? 548 btfsc FLAG_apnoe_mode ; In Apnoe mode?
464 bra customview_toggle ; Yes, Call next view... 549 bra customview_toggle ; Yes, Call next view...
478 call I2C_init_compass ; Start compass 563 call I2C_init_compass ; Start compass
479 extern TFT_dive_compass_mask 564 extern TFT_dive_compass_mask
480 call TFT_dive_compass_mask ; Show compass 565 call TFT_dive_compass_mask ; Show compass
481 bra customview_toggle_exit 566 bra customview_toggle_exit
482 567
568 ; MODIFIED - view disabled ## memory
483 customview_init_view7: ; Dynamic gaslist (View 7) 569 customview_init_view7: ; Dynamic gaslist (View 7)
484 btfsc FLAG_apnoe_mode ; In Apnoe mode? 570 ; btfsc FLAG_apnoe_mode ; In Apnoe mode?
485 bra customview_toggle ; Yes, Call next view... 571 bra customview_toggle ; Yes, Call next view...
486 btfsc FLAG_ccr_mode ; In CC mode? 572 ; btfsc FLAG_ccr_mode ; In CC mode?
487 bra customview_toggle ; Yes, Call next view... 573 ; bra customview_toggle ; Yes, Call next view...
488 call TFT_dyn_gaslist ; Show the dyn gaslist 574 ; call TFT_dyn_gaslist ; Show the dyn gaslist
489 bra customview_toggle_exit 575 ; bra customview_toggle_exit
490 576
491 customview_init_view8: ; Sensor millivolts 577 customview_init_view8: ; HIJACKED for CNS outputs (ex Sensor millivolts)
492 btfsc FLAG_gauge_mode ; In Gauge mode? 578 btfsc FLAG_gauge_mode ; In Gauge mode?
493 bra customview_toggle ; Yes, Call next view... 579 bra customview_toggle ; Yes, Call next view...
494 btfsc FLAG_apnoe_mode ; In Apnoe mode? 580 btfsc FLAG_apnoe_mode ; In Apnoe mode?
495 bra customview_toggle ; yes, Call next view... 581 bra customview_toggle ; yes, Call next view...
496 btfsc FLAG_pscr_mode ; In PSCR mode? 582 ; REPLACE ## CNS at end-of-dive
497 bra customview_init_view8a ; Yes 583 ; btfsc FLAG_pscr_mode ; In PSCR mode?
498 btfss FLAG_ccr_mode ; In CC mode? 584 ; bra customview_init_view8a ; Yes
499 bra customview_toggle ; no, Call next view... 585 ; btfss FLAG_ccr_mode ; In CC mode?
500 customview_init_view8a: 586 ; bra customview_toggle ; no, Call next view...
501 movf hardware_flag,W 587 ; customview_init_view8a:
502 sublw 0x13 ; + 588 ; movf hardware_flag,W
503 btfsc STATUS,Z 589 ; sublw 0x13 ; +
504 bra customview_toggle ; no, Call next view... 590 ; btfsc STATUS,Z
505 591 ; bra customview_toggle ; no, Call next view...
506 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP 592 ; movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP
507 sublw .1 ; opt_ccr_mode = 1 (Sensor)? 593 ; sublw .1 ; opt_ccr_mode = 1 (Sensor)?
508 bnz customview_toggle ; no, Call next view... 594 ; bnz customview_toggle ; no, Call next view...
509 call TFT_hud_mask ; Setup HUD mask 595 ; call TFT_hud_mask ; Setup HUD mask
510 call TFT_hud_voltages ; Show HUD details 596 ; call TFT_hud_voltages ; Show HUD details
511 goto customview_toggle_exit 597 ; BY
598 call TFT_CNS_mask
599 call TFT_CNS
600
601 goto customview_toggle_exit
512 602
513 customview_init_view9: ; ppO2, Ceiling and current GF 603 customview_init_view9: ; ppO2, Ceiling and current GF
514 btfsc FLAG_apnoe_mode ; In Apnoe mode? 604 btfsc FLAG_apnoe_mode ; In Apnoe mode?
515 bra customview_toggle ; yes, Call next view... 605 bra customview_toggle ; yes, Call next view...
516 btfsc FLAG_gauge_mode ; In Gauge mode? 606 btfsc FLAG_gauge_mode ; In Gauge mode?
517 bra customview_toggle ; Yes, Call next view... 607 bra customview_toggle ; Yes, Call next view...
518 call TFT_ceiling_mask ; Setup mask 608 call TFT_ceiling_mask ; Setup mask
519 call TFT_ceiling ; Show Ceiling 609 call TFT_ceiling ; Show Ceiling
520 610
521 ; ppO2 value 611 ; ppO2 value
522 call TFT_mask_ppo2 612 call TFT_mask_ppo2
523 call TFT_display_ppo2_val 613 call TFT_display_pure_ppo2
524 614
525 ; current GF value 615 ; current GF value
526 extern char_I_deco_model 616 extern char_I_deco_model
527 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF 617 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF
528 bra customview_toggle_exit ; No GF info for non-GF modes 618 bra customview_toggle_exit ; No GF info for non-GF modes
529 ; current GF value 619 ; current GF value
530 call TFT_gf_mask_cGF ; Setup Mask - current GF only 620 call TFT_gf_mask_cGF ; Setup Mask - current GF only
531 call TFT_gf_info ; Show GF informations 621 call TFT_gf_info ; Show GF informations
532 bra customview_toggle_exit 622 bra customview_toggle_exit
533 623
534
535 ;=============================================================================
536 ; Show next customview (and delete this flag)
537 global customview_toggle
538 customview_toggle:
539 bcf switch_right
540 incf menupos3,F ; Number of customview to show
541 movlw d'12' ; Max number of customsviews in divemode
542 cpfsgt menupos3 ; Max reached?
543 goto customview_mask ; No, show
544 goto customview_toggle_reset
545
546
547 customview_init_view10: ; Sensor check 624 customview_init_view10: ; Sensor check
548 btfsc FLAG_apnoe_mode ; In Apnoe mode? 625 btfsc FLAG_apnoe_mode ; In Apnoe mode?
549 bra customview_toggle ; yes, Call next view... 626 bra customview_toggle ; yes, Call next view...
550 btfsc FLAG_gauge_mode ; In Gauge mode? 627 btfsc FLAG_gauge_mode ; In Gauge mode?
551 bra customview_toggle ; Yes, Call next view... 628 bra customview_toggle ; Yes, Call next view...
552 btfss FLAG_ccr_mode ; In CC mode? 629 btfss FLAG_ccr_mode ; In CC mode?
553 bra customview_toggle ; no, Call next view... 630 bra customview_toggle ; no, Call next view...
554 631
555 call TFT_sensor_check_mask ; Show ppO2 of O2 and Diluent mask 632 call TFT_sensor_check_mask ; Show ppO2 of O2 and Diluent mask
556 call TFT_sensor_check ; Show ppO2 of O2 and Diluent 633 call TFT_sensor_check ; Show ppO2 of O2 and Diluent
557 bra customview_toggle_exit 634 bra customview_toggle_exit
558 635
559 customview_init_view11: ; ppO2, END/EAD and CNS 636 customview_init_view11: ; ppO2, END/EAD and CNS
560 btfsc FLAG_apnoe_mode ; In Apnoe mode? 637 btfsc FLAG_apnoe_mode ; In Apnoe mode?
561 bra customview_toggle ; yes, Call next view... 638 bra customview_toggle ; yes, Call next view...
562 btfsc FLAG_gauge_mode ; In Gauge mode? 639 btfsc FLAG_gauge_mode ; In Gauge mode?
563 bra customview_toggle ; Yes, Call next view... 640 bra customview_toggle ; Yes, Call next view...
564 641
565 call TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask 642 call TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask
566 call TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS 643 call TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS
567 goto customview_toggle_exit 644 goto customview_toggle_exit
568 645
569 customview_init_view12: ; PSCR Info 646 customview_init_view12: ; PSCR Info
570 btfss FLAG_pscr_mode ; In PSCR mode? 647 btfss FLAG_pscr_mode ; In PSCR mode?
571 bra customview_toggle ; No, Call next view... 648 bra customview_toggle ; No, Call next view...
572 649
573 call TFT_pscr_info_mask ; Show ppO2, drop and lung ratio 650 call TFT_pscr_info_mask ; Show ppO2, drop and lung ratio
574 call TFT_pscr_info ; Show ppO2, drop and lung ratio 651 call TFT_pscr_info ; Show ppO2, drop and lung ratio
575 bra customview_toggle_exit 652 bra customview_toggle_exit
576 653
654 ; NEW ## bailout gas needs
655 customview_init_view13: ; Gas Needs
656 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculations is switched on
657 bra customview_toggle ; NO - Call next view...
658 call TFT_gas_needs_mask ; YES - Show the mask for gas needs
659 call TFT_gas_needs ; Show the gas needs
660 bra customview_toggle_exit
661
577 customview_toggle_exit: 662 customview_toggle_exit:
578 btfsc divemode ; In Dive Mode? 663 btfsc divemode ; In Dive Mode?
579 call TFT_temp_divemode ; Yes, redraw temperature 664 bsf FLAG_TFT_temp_divemode ; Set flag to redraw temp
580 call TFT_standard_color 665 call TFT_standard_color
581 bcf toggle_customview ; Clear flag 666 bcf toggle_customview ; Clear flag
582 return 667 return
583 668
584 global customview_show_change_depth 669 global customview_show_change_depth
585 customview_show_change_depth: ; Put " lom" or " loft" into Postinc2 670 customview_show_change_depth: ; Put " lom" or " loft" into Postinc2
586 PUTC " " 671 PUTC " "
587 TSTOSS opt_units ; 0=m, 1=ft 672 TSTOSS opt_units ; 0=m, 1=ft
588 bra customview_show_mix_metric 673 bra customview_show_mix_metric
589 movf lo,W 674 movf lo,W
590 mullw .100 ; convert meters to mbar 675 mullw .100 ; convert meters to mbar
591 movff PRODL,lo 676 movff PRODL,lo
592 movff PRODH,hi 677 movff PRODH,hi
593 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 678 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
594 bsf leftbind 679 bsf leftbind
595 output_16 ; Change depth in lo:hi 680 output_16 ; Change depth in lo:hi
596 bcf leftbind 681 bcf leftbind
597 STRCAT_TEXT tFeets 682 STRCAT_TEXT tFeets
598 return 683 return
599 customview_show_mix_metric: 684 customview_show_mix_metric:
600 output_99 ; Change depth in lo 685 output_99 ; Change depth in lo
601 STRCAT_TEXT tMeters 686 STRCAT_TEXT tMeters
602 return 687 return
603 688
604 689
605 global customview_show_mix 690 global customview_show_mix
606 customview_show_mix: ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 691 customview_show_mix: ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
607 tstfsz hi ; He=0? 692 tstfsz hi ; He=0?
608 bra customview_show_mix5 ; No, Show a TX 693 bra customview_show_mix5 ; No, Show a TX
609 movlw .21 694 movlw .21
610 cpfseq lo ; Air? 695 cpfseq lo ; Air?
611 bra customview_show_mix2 ; No 696 bra customview_show_mix2 ; No
612 STRCAT_TEXT tSelectAir ; Yes, show "Air" 697 STRCAT_TEXT tSelectAir ; Yes, show "Air"
613 bra customview_show_mix4b 698 bra customview_show_mix4b
614 customview_show_mix2: 699 customview_show_mix2:
615 movlw .100 700 movlw .100
616 cpfseq lo ; O2? 701 cpfseq lo ; O2?
617 bra customview_show_mix3 ; No 702 bra customview_show_mix3 ; No
618 STRCAT_TEXT tSelectO2 ; Yes, show "O2" 703 STRCAT_TEXT tSelectO2 ; Yes, show "O2"
619 bra customview_show_mix4b 704 bra customview_show_mix4b
620 705
621 customview_show_mix3: 706 customview_show_mix3:
622 movlw .21 707 movlw .21
623 cpfslt lo ; < Nx21? 708 cpfslt lo ; < Nx21?
624 bra customview_show_mix4 ; No 709 bra customview_show_mix4 ; No
625 STRCAT_TEXT tGasErr ; Yes, show "Err" 710 STRCAT_TEXT tGasErr ; Yes, show "Err"
626 output_99 ; O2 ratio is still in "lo" 711 output_99 ; O2 ratio is still in "lo"
627 bra customview_show_mix4c 712 bra customview_show_mix4c
628 713
629 customview_show_mix4: 714 customview_show_mix4:
630 STRCAT_TEXT tSelectNx ; Show "Nx" 715 STRCAT_TEXT tSelectNx ; Show "Nx"
631 output_99 ; O2 ratio is still in "lo" 716 output_99 ; O2 ratio is still in "lo"
632 customview_show_mix4b: 717 customview_show_mix4b:
633 STRCAT " " 718 STRCAT " "
634 customview_show_mix4c: 719 customview_show_mix4c:
635 btfsc divemode ; In divemode 720 btfsc divemode ; In divemode
636 return ; Yes 721 return ; Yes
637 STRCAT " " 722 STRCAT " "
638 return 723 return
639 724
640 customview_show_mix5: 725 customview_show_mix5:
641 btfsc divemode 726 btfsc divemode
642 bra customview_show_mix6 727 bra customview_show_mix6
643 STRCAT_TEXT tSelectTx ; Show "Tx" 728 STRCAT_TEXT tSelectTx ; Show "Tx"
644 customview_show_mix6: 729 customview_show_mix6:
645 output_99 ; O2 ratio is still in "lo" 730 output_99 ; O2 ratio is still in "lo"
646 PUTC "/" 731 PUTC "/"
647 movff hi,lo 732 movff hi,lo
648 output_99 ; He ratio 733 output_99 ; He ratio
649 return 734 return
650 735
651 END 736 END