comparison code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 681:6e456a6398e0

Hardware4 support
author heinrichsweikamp
date Fri, 25 Jan 2013 18:00:49 +0100
parents 3927bc5019c9
children aebb6d039249
comparison
equal deleted inserted replaced
680:c6220d340684 681:6e456a6398e0
93 movlw d'1' 93 movlw d'1'
94 movwf menupos ; reset cursor in divemode menu 94 movwf menupos ; reset cursor in divemode menu
95 test_switches_divemode2b: 95 test_switches_divemode2b:
96 bsf menubit ; Enter Divemode-Menu! 96 bsf menubit ; Enter Divemode-Menu!
97 bcf premenu ; clear premenu flag 97 bcf premenu ; clear premenu flag
98 call PLED_clear_divemode_menu ; Clear dive mode menu area 98 call DISP_clear_divemode_menu ; Clear dive mode menu area
99 call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask 99 call DISP_divemode_menu_mask_first ; Write Divemode menu1 mask
100 bcf display_set_simulator ; Clear Simulator-Menu flag 100 bcf display_set_simulator ; Clear Simulator-Menu flag
101 call PLED_divemenu_cursor ; show cursor 101 call DISP_divemenu_cursor ; show cursor
102 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 102 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
103 return 103 return
104 104
105 test_switches_divemode_menu: 105 test_switches_divemode_menu:
106 btfsc uart_dump_screen ; Asked to dump screen contains ? 106 btfsc uart_dump_screen ; Asked to dump screen contains ?
154 bra test_switches_divemode_menu1a ; No 154 bra test_switches_divemode_menu1a ; No
155 btfss menu3_active ; Menu position 3 has functionality? 155 btfss menu3_active ; Menu position 3 has functionality?
156 incf menupos,F ; No, +1, skip to menuos=4 156 incf menupos,F ; No, +1, skip to menuos=4
157 157
158 test_switches_divemode_menu1a: 158 test_switches_divemode_menu1a:
159 call PLED_divemenu_cursor ; update cursor 159 call DISP_divemenu_cursor ; update cursor
160 btfsc display_set_gas ; In Gaslist or Setpoint list menu? 160 btfsc display_set_gas ; In Gaslist or Setpoint list menu?
161 call PLED_show_change_depth ; Yes, show change depth for gas #menupos 161 call DISP_show_change_depth ; Yes, show change depth for gas #menupos
162 return 162 return
163 163
164 test_switches_divemode_menu3: 164 test_switches_divemode_menu3:
165 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 165 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
166 bsf menubit ; Enter Divemode-Menu! 166 bsf menubit ; Enter Divemode-Menu!
191 dcfsnz menupos,F 191 dcfsnz menupos,F
192 bra divemenu_see_decoplan ; display the full decoplan 192 bra divemenu_see_decoplan ; display the full decoplan
193 dcfsnz menupos,F 193 dcfsnz menupos,F
194 bra divemode_menu3 ; Customview-function 194 bra divemode_menu3 ; Customview-function
195 dcfsnz menupos,F 195 dcfsnz menupos,F
196 bra divemode_toggle_brightness ; Toggle OLED-Brightness 196 bra divemode_toggle_brightness ; Toggle DISPLAY-Brightness
197 dcfsnz menupos,F 197 dcfsnz menupos,F
198 bra timeout_divemenu2 ; Quit divemode menu 198 bra timeout_divemenu2 ; Quit divemode menu
199 bra timeout_divemenu2 ; Quit divemode menu 199 bra timeout_divemenu2 ; Quit divemode menu
200 200
201 divemode_menu3: 201 divemode_menu3:
266 divemode_toggle_brightness: 266 divemode_toggle_brightness:
267 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) 267 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0)
268 tstfsz EEDATA ; Was dimmed? 268 tstfsz EEDATA ; Was dimmed?
269 bra divemode_toggle_brightness1 ; Yes... 269 bra divemode_toggle_brightness1 ; Yes...
270 270
271 call PLED_brightness_low 271 call DISP_brightness_low
272 movlw d'1' 272 movlw d'1'
273 movwf EEDATA ; Copy to EEDATA 273 movwf EEDATA ; Copy to EEDATA
274 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) 274 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0)
275 bra divemode_toggle_brightness3 275 bra divemode_toggle_brightness3
276 276
277 divemode_toggle_brightness1: 277 divemode_toggle_brightness1:
278 call PLED_brightness_full 278 call DISP_brightness_full
279 movlw d'0' 279 movlw d'0'
280 movwf EEDATA ; Copy to EEDATA 280 movwf EEDATA ; Copy to EEDATA
281 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) 281 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0)
282 282
283 divemode_toggle_brightness3: 283 divemode_toggle_brightness3:
284 ; Now, redraw all outputs (All modes) 284 ; Now, redraw all outputs (All modes)
285 call PLED_active_gas_divemode ; Display gas, if required 285 call DISP_active_gas_divemode ; Display gas, if required
286 call PLED_temp_divemode ; Displays temperature 286 call DISP_temp_divemode ; Displays temperature
287 call PLED_depth ; Displays new depth... 287 call DISP_depth ; Displays new depth...
288 call PLED_max_pressure ; ...and max. depth 288 call DISP_max_pressure ; ...and max. depth
289 289
290 bra timeout_divemenu2 ; quit menu! 290 bra timeout_divemenu2 ; quit menu!
291 291
292 divemenu_de_activate: 292 divemenu_de_activate:
293 bsf display_set_active ; Set display flag 293 bsf display_set_active ; Set display flag
294 bcf display_set_xgas ; Clear Flag 294 bcf display_set_xgas ; Clear Flag
295 call PLED_clear_divemode_menu ; Clear Menu 295 call DISP_clear_divemode_menu ; Clear Menu
296 296
297 call PLED_de_activelist ; show (de)active gaslist 297 call DISP_de_activelist ; show (de)active gaslist
298 298
299 movlw d'1' 299 movlw d'1'
300 movwf menupos ; reset cursor 300 movwf menupos ; reset cursor
301 call PLED_divemenu_cursor ; update cursor 301 call DISP_divemenu_cursor ; update cursor
302 return 302 return
303 303
304 divemenu_de_activate2: ; Toggle active flag 304 divemenu_de_activate2: ; Toggle active flag
305 dcfsnz menupos,F 305 dcfsnz menupos,F
306 bra divemenu_de_activate2_exit ; Exit, Quit, Abort 306 bra divemenu_de_activate2_exit ; Exit, Quit, Abort
321 321
322 divemenu_de_activate2_g1: 322 divemenu_de_activate2_g1:
323 btg gaslist_active,0 ; Toggle flag 323 btg gaslist_active,0 ; Toggle flag
324 movlw d'2' 324 movlw d'2'
325 movwf menupos ; reset cursor 325 movwf menupos ; reset cursor
326 call PLED_de_activelist ; show (de)active gaslist 326 call DISP_de_activelist ; show (de)active gaslist
327 return 327 return
328 328
329 divemenu_de_activate2_g2: 329 divemenu_de_activate2_g2:
330 btg gaslist_active,1 ; Toggle flag 330 btg gaslist_active,1 ; Toggle flag
331 movlw d'3' 331 movlw d'3'
332 movwf menupos ; reset cursor 332 movwf menupos ; reset cursor
333 call PLED_de_activelist ; show (de)active gaslist 333 call DISP_de_activelist ; show (de)active gaslist
334 return 334 return
335 335
336 divemenu_de_activate2_g3: 336 divemenu_de_activate2_g3:
337 btg gaslist_active,2 ; Toggle flag 337 btg gaslist_active,2 ; Toggle flag
338 movlw d'4' 338 movlw d'4'
339 movwf menupos ; reset cursor 339 movwf menupos ; reset cursor
340 call PLED_de_activelist ; show (de)active gaslist 340 call DISP_de_activelist ; show (de)active gaslist
341 return 341 return
342 342
343 divemenu_de_activate2_g4: 343 divemenu_de_activate2_g4:
344 btg gaslist_active,3 ; Toggle flag 344 btg gaslist_active,3 ; Toggle flag
345 movlw d'5' 345 movlw d'5'
346 movwf menupos ; reset cursor 346 movwf menupos ; reset cursor
347 call PLED_de_activelist ; show (de)active gaslist 347 call DISP_de_activelist ; show (de)active gaslist
348 return 348 return
349 349
350 divemenu_de_activate2_g5: 350 divemenu_de_activate2_g5:
351 btg gaslist_active,4 ; Toggle flag 351 btg gaslist_active,4 ; Toggle flag
352 movlw d'6' 352 movlw d'6'
353 movwf menupos ; reset cursor 353 movwf menupos ; reset cursor
354 call PLED_de_activelist ; show (de)active gaslist 354 call DISP_de_activelist ; show (de)active gaslist
355 return 355 return
356 356
357 divemode_set_xgas: ; Set the extra gas... 357 divemode_set_xgas: ; Set the extra gas...
358 bsf display_set_xgas ; Set Flag 358 bsf display_set_xgas ; Set Flag
359 bcf display_set_gas ; Clear Flag 359 bcf display_set_gas ; Clear Flag
360 call PLED_clear_divemode_menu ; Clear Menu 360 call DISP_clear_divemode_menu ; Clear Menu
361 361
362 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas 362 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas
363 write_int_eeprom d'24' 363 write_int_eeprom d'24'
364 movff char_I_He_ratio, EEDATA 364 movff char_I_He_ratio, EEDATA
365 write_int_eeprom d'25' 365 write_int_eeprom d'25'
366 366
367 call PLED_divemode_set_xgas ; Show mask 367 call DISP_divemode_set_xgas ; Show mask
368 368
369 movlw d'1' 369 movlw d'1'
370 movwf menupos ; reset cursor 370 movwf menupos ; reset cursor
371 call PLED_divemenu_cursor ; update cursor 371 call DISP_divemenu_cursor ; update cursor
372 return 372 return
373 373
374 divemode_menu_simulator: 374 divemode_menu_simulator:
375 bsf menubit ; Enter Divemode-Menu! 375 bsf menubit ; Enter Divemode-Menu!
376 bcf premenu ; clear premenu flag 376 bcf premenu ; clear premenu flag
377 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 377 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
378 bsf display_set_simulator ; Set Flag 378 bsf display_set_simulator ; Set Flag
379 bsf menu3_active ; So "+1" is accessible at all times 379 bsf menu3_active ; So "+1" is accessible at all times
380 call PLED_clear_divemode_menu ; Clear Menu 380 call DISP_clear_divemode_menu ; Clear Menu
381 call PLED_divemode_simulator_mask; Show mask 381 call DISP_divemode_simulator_mask; Show mask
382 movlw d'1' 382 movlw d'1'
383 movwf menupos ; reset cursor 383 movwf menupos ; reset cursor
384 call PLED_divemenu_cursor ; update cursor 384 call DISP_divemenu_cursor ; update cursor
385 return 385 return
386 386
387 divemode_menu_simulator2: 387 divemode_menu_simulator2:
388 dcfsnz menupos,F 388 dcfsnz menupos,F
389 bra timeout_divemenu2 ; close underwater menu! 389 bra timeout_divemenu2 ; close underwater menu!
398 dcfsnz menupos,F 398 dcfsnz menupos,F
399 bra divemode_menu_simulator_quit; Adjust to zero m 399 bra divemode_menu_simulator_quit; Adjust to zero m
400 bra timeout_divemenu2 ; quit underwater menu! 400 bra timeout_divemenu2 ; quit underwater menu!
401 401
402 divemode_menu_simulator_common: 402 divemode_menu_simulator_common:
403 call PLED_divemode_simulator_mask ; Redraw Simualtor mask 403 call DISP_divemode_simulator_mask ; Redraw Simualtor mask
404 404
405 ; Check limits (130m and 0m) 405 ; Check limits (130m and 0m)
406 movlw LOW d'14000' ; Compare to 14bar=14000mbar (130m). 406 movlw LOW d'14000' ; Compare to 14bar=14000mbar (130m).
407 subwf sim_pressure+0,W 407 subwf sim_pressure+0,W
408 movlw HIGH d'14000' 408 movlw HIGH d'14000'
474 movwf menupos ; reset cursor 474 movwf menupos ; reset cursor
475 bra divemode_menu_simulator_common 475 bra divemode_menu_simulator_common
476 476
477 divemenu_see_decoplan: 477 divemenu_see_decoplan:
478 bsf display_see_deco ; set flag 478 bsf display_see_deco ; set flag
479 call PLED_clear_divemode_menu ; Clear Menu 479 call DISP_clear_divemode_menu ; Clear Menu
480 480
481 bcf last_ceiling_gf_shown ; Clear flag 481 bcf last_ceiling_gf_shown ; Clear flag
482 clrf decoplan_page ; Starts on page 0 482 clrf decoplan_page ; Starts on page 0
483 bra divemenu_see_decoplan2_1 483 bra divemenu_see_decoplan2_1
484 484
487 btfsc last_ceiling_gf_shown ; last ceiling shown? 487 btfsc last_ceiling_gf_shown ; last ceiling shown?
488 bra divemenu_see_decoplan2_0 ; All done, clear and return 488 bra divemenu_see_decoplan2_0 ; All done, clear and return
489 489
490 divemenu_see_decoplan2_1: 490 divemenu_see_decoplan2_1:
491 clrf timeout_counter3 ; Clear timeout Divemode menu 491 clrf timeout_counter3 ; Clear timeout Divemode menu
492 call PLED_decoplan ; Display the new screen 492 call DISP_decoplan ; Display the new screen
493 return 493 return
494 494
495 divemenu_see_decoplan2_0: 495 divemenu_see_decoplan2_0:
496 bcf display_see_deco ; clear flag 496 bcf display_see_deco ; clear flag
497 bra timeout_divemenu2 ; quit menu! 497 bra timeout_divemenu2 ; quit menu!
521 incf lo,F ; limit to min=0 521 incf lo,F ; limit to min=0
522 divemenu_set_xgas2_heminus2: 522 divemenu_set_xgas2_heminus2:
523 movff lo, EEDATA 523 movff lo, EEDATA
524 write_int_eeprom d'25' ; He Value 524 write_int_eeprom d'25' ; He Value
525 525
526 call PLED_divemode_set_xgas ; Redraw menu 526 call DISP_divemode_set_xgas ; Redraw menu
527 movlw d'5' 527 movlw d'5'
528 movwf menupos ; reset cursor 528 movwf menupos ; reset cursor
529 return 529 return
530 530
531 divemenu_set_xgas2_heplus: 531 divemenu_set_xgas2_heplus:
548 decf lo,F ; reduce He again = unchanged after operation 548 decf lo,F ; reduce He again = unchanged after operation
549 divemenu_set_xgas2_heplus3: ; save current value 549 divemenu_set_xgas2_heplus3: ; save current value
550 movff lo, EEDATA 550 movff lo, EEDATA
551 write_int_eeprom d'25' ; He Value 551 write_int_eeprom d'25' ; He Value
552 552
553 call PLED_divemode_set_xgas ; Redraw menu 553 call DISP_divemode_set_xgas ; Redraw menu
554 movlw d'4' 554 movlw d'4'
555 movwf menupos ; reset cursor 555 movwf menupos ; reset cursor
556 return 556 return
557 557
558 divemenu_set_xgas2_o2minus: 558 divemenu_set_xgas2_o2minus:
568 movwf lo ; Set to Max. value 568 movwf lo ; Set to Max. value
569 divemenu_set_xgas2_o2minus2: 569 divemenu_set_xgas2_o2minus2:
570 movff lo, EEDATA 570 movff lo, EEDATA
571 write_int_eeprom d'24' ; O2 Value 571 write_int_eeprom d'24' ; O2 Value
572 572
573 call PLED_divemode_set_xgas ; Redraw menu 573 call DISP_divemode_set_xgas ; Redraw menu
574 movlw d'3' 574 movlw d'3'
575 movwf menupos ; reset cursor 575 movwf menupos ; reset cursor
576 return 576 return
577 577
578 divemenu_set_xgas2_o2plus: 578 divemenu_set_xgas2_o2plus:
595 decf lo,F ; reduce O2 again = unchanged after operation 595 decf lo,F ; reduce O2 again = unchanged after operation
596 divemenu_set_xgas2_o2plus3: ; save current value 596 divemenu_set_xgas2_o2plus3: ; save current value
597 movff lo, EEDATA 597 movff lo, EEDATA
598 write_int_eeprom d'24' ; O2 Value 598 write_int_eeprom d'24' ; O2 Value
599 599
600 call PLED_divemode_set_xgas ; Redraw menu 600 call DISP_divemode_set_xgas ; Redraw menu
601 movlw d'2' 601 movlw d'2'
602 movwf menupos ; reset cursor 602 movwf menupos ; reset cursor
603 return 603 return
604 604
605 divemenu_set_xgas2_exit: 605 divemenu_set_xgas2_exit:
618 bsf event_occured ; set global event flag 618 bsf event_occured ; set global event flag
619 bsf decoplan_invalid ; The decoplan needs to updated 619 bsf decoplan_invalid ; The decoplan needs to updated
620 clrf WREG 620 clrf WREG
621 movff WREG,char_O_deco_status ; Restart decoplan computation mH 621 movff WREG,char_O_deco_status ; Restart decoplan computation mH
622 bsf is_bailout ;=1: CC mode, but bailout active! 622 bsf is_bailout ;=1: CC mode, but bailout active!
623 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" 623 clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail"
624 movff lo,char_I_const_ppO2 624 movff lo,char_I_const_ppO2
625 movlw 6 625 movlw 6
626 movff WREG,char_I_current_gas ; Current gas is Gas6 (manual setting). 626 movff WREG,char_I_current_gas ; Current gas is Gas6 (manual setting).
627 bra timeout_divemenu2 ; quit underwater menu! 627 bra timeout_divemenu2 ; quit underwater menu!
628 628
630 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? 630 btfsc FLAG_const_ppO2_mode ; in ppO2 mode?
631 bra divemenu_set_setpoint ; Yes, display SetPoint list 631 bra divemenu_set_setpoint ; Yes, display SetPoint list
632 632
633 divemenu_set_gas_2: 633 divemenu_set_gas_2:
634 bsf display_set_gas ; set flag 634 bsf display_set_gas ; set flag
635 call PLED_clear_divemode_menu ; Clear Menu 635 call DISP_clear_divemode_menu ; Clear Menu
636 call PLED_gas_list ; Display all 5 gases 636 call DISP_gas_list ; Display all 5 gases
637 637
638 movlw d'1' ; Reset cursor 638 movlw d'1' ; Reset cursor
639 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 639 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
640 movf better_gas_number,W ; better gas 1-5 640 movf better_gas_number,W ; better gas 1-5
641 movwf menupos ; reset cursor 641 movwf menupos ; reset cursor
642 call PLED_divemenu_cursor ; update cursor 642 call DISP_divemenu_cursor ; update cursor
643 call PLED_show_change_depth ; And show the first change depth 643 call DISP_show_change_depth ; And show the first change depth
644 return 644 return
645 645
646 divemenu_set_setpoint: 646 divemenu_set_setpoint:
647 bsf display_set_setpoint ; set flag 647 bsf display_set_setpoint ; set flag
648 bsf display_set_gas ; set flag 648 bsf display_set_gas ; set flag
649 649
650 call PLED_clear_divemode_menu ; Clear Menu 650 call DISP_clear_divemode_menu ; Clear Menu
651 call PLED_splist_start ; Display SetPoints 651 call DISP_splist_start ; Display SetPoints
652 DISPLAYTEXT d'137' ; Bailout (as a sub-menu) 652 DISPLAYTEXT d'137' ; Bailout (as a sub-menu)
653 DISPLAYTEXT d'232' ; Diluent (as a sub-menu) 653 DISPLAYTEXT d'232' ; Diluent (as a sub-menu)
654 movlw d'1' 654 movlw d'1'
655 movwf menupos ; reset cursor 655 movwf menupos ; reset cursor
656 call PLED_divemenu_cursor ; update cursor 656 call DISP_divemenu_cursor ; update cursor
657 return 657 return
658 658
659 659
660 divemenu_set_gas2: 660 divemenu_set_gas2:
661 btfsc select_bailoutgas ; Are we in the Bailout list? 661 btfsc select_bailoutgas ; Are we in the Bailout list?
663 663
664 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? 664 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode?
665 bra divemenu_set_gas2a ; no, choose gas 665 bra divemenu_set_gas2a ; no, choose gas
666 ; Yes, so select SP 1-3 666 ; Yes, so select SP 1-3
667 bcf is_bailout ;=1: CC mode, but bailout active! 667 bcf is_bailout ;=1: CC mode, but bailout active!
668 call PLED_show_ppO2_clear ; Clear ppO2 value 668 call DISP_show_ppO2_clear ; Clear ppO2 value
669 669
670 divemenu_set_gas1: 670 divemenu_set_gas1:
671 movlw d'1' 671 movlw d'1'
672 cpfseq menupos ; At the "Bailout" position? 672 cpfseq menupos ; At the "Bailout" position?
673 bra divemenu_set_gas1b ; No, select SetPoint 1-3 or Diluent 673 bra divemenu_set_gas1b ; No, select SetPoint 1-3 or Diluent
681 bra divemenu_set_gas1c ; No, select SetPoint 1-3 681 bra divemenu_set_gas1c ; No, select SetPoint 1-3
682 ; Choose Diluent from list 682 ; Choose Diluent from list
683 bcf display_set_setpoint ; Clear Flag 683 bcf display_set_setpoint ; Clear Flag
684 bcf display_set_gas ; Clear Flag 684 bcf display_set_gas ; Clear Flag
685 bsf display_set_diluent ; Set Flag 685 bsf display_set_diluent ; Set Flag
686 call PLED_clear_divemode_menu ; Clear Menu 686 call DISP_clear_divemode_menu ; Clear Menu
687 call PLED_diluent_list ; Display all 5 diluents 687 call DISP_diluent_list ; Display all 5 diluents
688 movlw d'1' ; Reset cursor 688 movlw d'1' ; Reset cursor
689 movwf menupos ; reset cursor 689 movwf menupos ; reset cursor
690 call PLED_divemenu_cursor ; update cursor 690 call DISP_divemenu_cursor ; update cursor
691 return 691 return
692 692
693 divemode_set_diluent2: ; Choose diluent #menupos 693 divemode_set_diluent2: ; Choose diluent #menupos
694 movff menupos,active_diluent ; 1-5 694 movff menupos,active_diluent ; 1-5
695 bra divemenu_set_gas1d ; Continue here... 695 bra divemenu_set_gas1d ; Continue here...
744 bra divemenu_set_gas2b ; No, select Gas1-5 (Stored in Menupos) 744 bra divemenu_set_gas2b ; No, select Gas1-5 (Stored in Menupos)
745 bra divemode_set_xgas ; Configure the extra gas 745 bra divemode_set_xgas ; Configure the extra gas
746 746
747 divemenu_set_gas2b: 747 divemenu_set_gas2b:
748 bsf is_bailout ;=1: CC mode, but bailout active! 748 bsf is_bailout ;=1: CC mode, but bailout active!
749 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" 749 clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail"
750 movff lo,char_I_const_ppO2 750 movff lo,char_I_const_ppO2
751 751
752 bcf display_set_gas ; clear flag 752 bcf display_set_gas ; clear flag
753 movff menupos,active_gas ; copy into active gas register 753 movff menupos,active_gas ; copy into active gas register
754 decf menupos,W ; # of selected gas (0-4) 754 decf menupos,W ; # of selected gas (0-4)
799 return ; No! 799 return ; No!
800 800
801 timeout_divemenu2: ; quit divemode menu 801 timeout_divemenu2: ; quit divemode menu
802 ; Restore some outputs 802 ; Restore some outputs
803 clrf decoplan_page ; Page 0-1 of deco list 803 clrf decoplan_page ; Page 0-1 of deco list
804 call PLED_clear_divemode_menu; Clear dive mode menu 804 call DISP_clear_divemode_menu; Clear dive mode menu
805 805
806 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode 806 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
807 bra timeout_divemenu2b ; skip! 807 bra timeout_divemenu2b ; skip!
808 btfsc gauge_mode ; Ignore in Gauge mode 808 btfsc gauge_mode ; Ignore in Gauge mode
809 bra timeout_divemenu2b ; skip! 809 bra timeout_divemenu2b ; skip!
810 810
811 bcf menubit 811 bcf menubit
812 btfsc dekostop_active 812 btfsc dekostop_active
813 call PLED_display_deko_mask ; clear nostop time, display decodata 813 call DISP_display_deko_mask ; clear nostop time, display decodata
814 btfss dekostop_active 814 btfss dekostop_active
815 call PLED_display_ndl_mask ; Clear deco data, display nostop time 815 call DISP_display_ndl_mask ; Clear deco data, display nostop time
816 816
817 btfsc decoplan_invalid ; The decoplan needs to updated 817 btfsc decoplan_invalid ; The decoplan needs to updated
818 bra timeout_divemenu2a ; Yes, skip update 818 bra timeout_divemenu2a ; Yes, skip update
819 819
820 btfsc dekostop_active 820 btfsc dekostop_active
821 call PLED_display_deko ; Update deco display at once 821 call DISP_display_deko ; Update deco display at once
822 btfss dekostop_active 822 btfss dekostop_active
823 call PLED_display_ndl ; Update NDL display at once 823 call DISP_display_ndl ; Update NDL display at once
824 824
825 timeout_divemenu2a: 825 timeout_divemenu2a:
826 btfsc safety_stop_active 826 btfsc safety_stop_active
827 bcf safety_stop_active ; Clear flag to rebuild the safety stop 827 bcf safety_stop_active ; Clear flag to rebuild the safety stop
828 828
829 timeout_divemenu2b: 829 timeout_divemenu2b:
830 bcf menubit 830 bcf menubit
831 bcf premenu ; Yes, clear flags and menu, display dive time and mask again 831 bcf premenu ; Yes, clear flags and menu, display dive time and mask again
832 call PLED_active_gas_divemode; Display gas, if required 832 call DISP_active_gas_divemode; Display gas, if required
833 call PLED_divemode_mask ; Display mask 833 call DISP_divemode_mask ; Display mask
834 call PLED_divemins ; Display (new) divetime! 834 call DISP_divemins ; Display (new) divetime!
835 call customview_mask ; Redraw current customview mask 835 call customview_mask ; Redraw current customview mask
836 clrf timeout_counter3 ; Also clear timeout 836 clrf timeout_counter3 ; Also clear timeout
837 bcf display_see_deco ; clear all display flags 837 bcf display_see_deco ; clear all display flags
838 bcf display_set_gas 838 bcf display_set_gas
839 bcf display_set_xgas 839 bcf display_set_xgas
848 ; Re-Draw current page of decoplan (may have more stops) 848 ; Re-Draw current page of decoplan (may have more stops)
849 timeout_divemenu3: 849 timeout_divemenu3:
850 movff char_O_deco_status,WREG ; Get last computation state (BANK safe) 850 movff char_O_deco_status,WREG ; Get last computation state (BANK safe)
851 iorwf WREG ; Is it zero ? 851 iorwf WREG ; Is it zero ?
852 btfsc STATUS,Z 852 btfsc STATUS,Z
853 call PLED_decoplan ; Yes: new data available. 853 call DISP_decoplan ; Yes: new data available.
854 bra timeout_divemenu1 ; Check timeout 854 bra timeout_divemenu1 ; Check timeout
855 855
856 timeout_divemenu6: 856 timeout_divemenu6:
857 ; Update Simulator Mask 857 ; Update Simulator Mask
858 bsf menu3_active ; So "+1" is accessible at all times 858 bsf menu3_active ; So "+1" is accessible at all times
859 call PLED_divemode_simulator_mask; Show mask 859 call DISP_divemode_simulator_mask; Show mask
860 call PLED_divemenu_cursor ; update cursor 860 call DISP_divemenu_cursor ; update cursor
861 bra timeout_divemenu1 ; Check timeout 861 bra timeout_divemenu1 ; Check timeout