comparison code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 647:e6ac142e82b0

New Diluent Submenu in Divemode
author heinrichsweikamp
date Sun, 07 Oct 2012 21:31:19 +0200
parents 3b50c9949b84
children 64194a3c8d5b
comparison
equal deleted inserted replaced
646:06ffc99a405f 647:e6ac142e82b0
121 ; Following routine configures the number of menu entries for the different modes 121 ; Following routine configures the number of menu entries for the different modes
122 movlw d'6' ; number of available gases+1, ; number of menu options+1 122 movlw d'6' ; number of available gases+1, ; number of menu options+1
123 btfsc display_set_gas ; Are we in the "Gaslist" menu? 123 btfsc display_set_gas ; Are we in the "Gaslist" menu?
124 movlw d'7' ; Yes, Number of entries for this menu+1 = 7 124 movlw d'7' ; Yes, Number of entries for this menu+1 = 7
125 btfsc display_set_setpoint ; In SetPoint Menu? 125 btfsc display_set_setpoint ; In SetPoint Menu?
126 movlw d'5' ; Number of entries for this menu+1 = 5 126 movlw d'6' ; Number of entries for this menu+1 = 6
127 btfsc display_set_active ; De/Activate gases underwater menu is visible? 127 btfsc display_set_active ; De/Activate gases underwater menu is visible?
128 movlw d'7' ; Number of entries for this menu+1 = 7 128 movlw d'7' ; Number of entries for this menu+1 = 7
129 btfsc display_set_xgas ; Are we in the Gas6 menu? 129 btfsc display_set_xgas ; Are we in the Gas6 menu?
130 movlw d'7' ; Number of entries for this menu+1 = 7 130 movlw d'7' ; Number of entries for this menu+1 = 7
131 btfsc display_set_simulator ; Are we in the simulator menu? 131 btfsc display_set_simulator ; Are we in the simulator menu?
132 movlw d'7' ; Number of entries for this menu+1 = 7 132 movlw d'7' ; Number of entries for this menu+1 = 7
133 btfsc display_set_diluent ; Are we in the "Diluent" list?
134 movlw d'6' ; Number of entries for this menu+1 = 6
133 cpfseq menupos ; =limit? 135 cpfseq menupos ; =limit?
134 bra test_switches_divemode_menu1; No! 136 bra test_switches_divemode_menu1; No!
135 movlw d'1' ; Yes, reset to position 1! 137 movlw d'1' ; Yes, reset to position 1!
136 movwf menupos 138 movwf menupos
137 139
142 bra test_switches_divemode_menu1a ; Skip test for sub menus 144 bra test_switches_divemode_menu1a ; Skip test for sub menus
143 btfsc display_set_xgas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? 145 btfsc display_set_xgas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
144 bra test_switches_divemode_menu1a ; Skip test for sub menus 146 bra test_switches_divemode_menu1a ; Skip test for sub menus
145 btfsc display_set_active ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? 147 btfsc display_set_active ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
146 bra test_switches_divemode_menu1a ; Skip test for sub menus 148 bra test_switches_divemode_menu1a ; Skip test for sub menus
149 btfsc display_set_diluent ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
150 bra test_switches_divemode_menu1a ; Skip test for sub menus
147 151
148 movlw d'3' 152 movlw d'3'
149 cpfseq menupos ; At position 3? 153 cpfseq menupos ; At position 3?
150 bra test_switches_divemode_menu1a ; No 154 bra test_switches_divemode_menu1a ; No
151 btfss menu3_active ; Menu position 3 has functionality? 155 btfss menu3_active ; Menu position 3 has functionality?
175 btfsc display_set_active ; Are we in the "De/Activate gases menu?" menu? 179 btfsc display_set_active ; Are we in the "De/Activate gases menu?" menu?
176 bra divemenu_de_activate2 ; Yes, so toggle active flag 180 bra divemenu_de_activate2 ; Yes, so toggle active flag
177 181
178 btfsc display_set_simulator ; Are we in the Divemode Simulator menu? 182 btfsc display_set_simulator ; Are we in the Divemode Simulator menu?
179 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit 183 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit
184
185 btfsc display_set_diluent ; Are we in the "Diluent" List?
186 goto divemode_set_diluent2 ; Yes, so choose diluent and exit
180 187
181 ; Options for Menu 1 188 ; Options for Menu 1
182 dcfsnz menupos,F 189 dcfsnz menupos,F
183 bra divemenu_set_gas ; Set gas sub-menu 190 bra divemenu_set_gas ; Set gas sub-menu
184 dcfsnz menupos,F 191 dcfsnz menupos,F
605 bsf display_set_setpoint ; set flag 612 bsf display_set_setpoint ; set flag
606 bsf display_set_gas ; set flag 613 bsf display_set_gas ; set flag
607 614
608 call PLED_clear_divemode_menu ; Clear Menu 615 call PLED_clear_divemode_menu ; Clear Menu
609 call PLED_splist_start ; Display SetPoints 616 call PLED_splist_start ; Display SetPoints
610 DISPLAYTEXT d'137' ; Bailout (as a sub-menu) 617 DISPLAYTEXT d'137' ; Bailout (as a sub-menu)
618 DISPLAYTEXT d'232' ; Diluent (as a sub-menu)
611 movlw d'1' 619 movlw d'1'
612 movwf menupos ; reset cursor 620 movwf menupos ; reset cursor
613 call PLED_divemenu_cursor ; update cursor 621 call PLED_divemenu_cursor ; update cursor
614 return 622 return
615 623
625 call PLED_show_ppO2_clear ; Clear ppO2 value 633 call PLED_show_ppO2_clear ; Clear ppO2 value
626 634
627 divemenu_set_gas1: 635 divemenu_set_gas1:
628 movlw d'1' 636 movlw d'1'
629 cpfseq menupos ; At the "Bailout" position? 637 cpfseq menupos ; At the "Bailout" position?
630 bra divemenu_set_gas1b ; No, select SetPoint 1-3 638 bra divemenu_set_gas1b ; No, select SetPoint 1-3 or Diluent
631 bsf select_bailoutgas ; Set Flag 639 bsf select_bailoutgas ; Set Flag
632 bcf display_set_setpoint ; Clear Flag 640 bcf display_set_setpoint ; Clear Flag
633 bra divemenu_set_gas_2 ; Configure the extra gas / Select Bailout 641 bra divemenu_set_gas_2 ; Configure the extra gas / Select Bailout
634 642
635 divemenu_set_gas1b: 643 divemenu_set_gas1b:
644 movlw d'5'
645 cpfseq menupos ; At the "Diluent" position?
646 bra divemenu_set_gas1c ; No, select SetPoint 1-3
647 ; Choose Diluent from list
648 bcf display_set_setpoint ; Clear Flag
649 bcf display_set_gas ; Clear Flag
650 bsf display_set_diluent ; Set Flag
651 call PLED_clear_divemode_menu ; Clear Menu
652 call PLED_diluent_list ; Display all 5 diluents
653 movlw d'1' ; Reset cursor
654 movwf menupos ; reset cursor
655 call PLED_divemenu_cursor ; update cursor
656 return
657
658 divemode_set_diluent2: ; Choose diluent #menupos
659 movff menupos,active_diluent ; 1-5
660 bra divemenu_set_gas1d ; Continue here...
661
662 divemenu_set_gas1c:
636 decf menupos,F ; Adjust 1-3 to 0-2... 663 decf menupos,F ; Adjust 1-3 to 0-2...
637 movlw d'35' ; offset in memory 664 movlw d'35' ; offset in memory
638 addwf menupos,W ; add SP number 0-2 665 addwf menupos,W ; add SP number 0-2
639 movwf EEADR 666 movwf EEADR
640 call read_eeprom ; Read SetPoint 667 call read_eeprom ; Read SetPoint
641 movff EEDATA, char_I_const_ppO2 ; Use SetPoint 668 movff EEDATA, char_I_const_ppO2 ; Use SetPoint
642 movff EEDATA, ppO2_setpoint_store ; Store also in this byte... 669 movff EEDATA, ppO2_setpoint_store ; Store also in this byte...
643 bsf setpoint_changed 670 bsf setpoint_changed
644 bsf event_occured ; set global event flag 671 bsf event_occured ; set global event flag
672
673 divemenu_set_gas1d: ; (Re-)Set Diluent
674 decf active_diluent,W ; 0-4 -> WREG mH
675 mullw .2
676 movf PRODL,W
677 addlw d'97'
678 movwf EEADR
679 call read_eeprom ; Read He
680 movff EEDATA,char_I_He_ratio ; And copy into hold register
681 decf active_diluent,W ; 0-4 -> WREG
682 mullw .2
683 movf PRODL,W
684 addlw d'96'
685 movwf EEADR
686 call read_eeprom ; Read O2
687 movff EEDATA, char_I_O2_ratio ; O2 ratio
688 movff char_I_He_ratio, wait_temp ; copy into bank1 register
689 bsf STATUS,C ; Borrow bit
690 movlw d'100' ; 100%
691 subfwb wait_temp,W ; minus He
692 bsf STATUS,C ; Borrow bit
693 subfwb EEDATA,W ; minus O2
694 movff WREG, char_I_N2_ratio ; = N2!
645 bra timeout_divemenu2 ; quit menu! 695 bra timeout_divemenu2 ; quit menu!
646 696
647 divemenu_set_gas1a: 697 divemenu_set_gas1a:
648 bcf display_set_setpoint ; Clear Display Flag 698 bcf display_set_setpoint ; Clear Display Flag
649 bsf stored_gas_changed ; set event flag 699 bsf stored_gas_changed ; set event flag
743 bcf display_set_gas 793 bcf display_set_gas
744 bcf display_set_xgas 794 bcf display_set_xgas
745 bcf display_set_setpoint 795 bcf display_set_setpoint
746 bcf display_set_simulator 796 bcf display_set_simulator
747 bcf display_set_active 797 bcf display_set_active
798 bcf display_set_diluent
748 bcf menu3_active 799 bcf menu3_active
749 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 800 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
750 return 801 return
751 802
752 ; Re-Draw current page of decoplan (may have more stops) 803 ; Re-Draw current page of decoplan (may have more stops)