comparison code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 287:5f2fe81fde9f

Don't force gas with depth>0 to be active.
author JeanDo
date Thu, 21 Apr 2011 04:16:00 +0200
parents 5351d47ee28a
children 4dbff2aa31ee
comparison
equal deleted inserted replaced
286:5351d47ee28a 287:5f2fe81fde9f
657 657
658 WIN_TOP .65 658 WIN_TOP .65
659 WIN_LEFT .20 659 WIN_LEFT .20
660 lfsr FSR2,letter 660 lfsr FSR2,letter
661 OUTPUTTEXT .105 ; "Active Gas? " 661 OUTPUTTEXT .105 ; "Active Gas? "
662 read_int_eeprom d'27' ; read flag register 662
663 663 ; Active gas flags in BIT0:4 ....
664 ; hi contains active gas flags in BIT0:4 ....
665
666 movff decodata+0,lo ; Gas 0-4 664 movff decodata+0,lo ; Gas 0-4
667 incf lo,F ; Gas 1-5 665 incf lo,F ; Gas 1-5
668 666
667 read_int_eeprom d'27' ; read flag register
669 active_gas_display: 668 active_gas_display:
670 rrcf EEDATA ; roll flags into carry 669 rrcf EEDATA ; roll flags into carry
671 decfsz lo,F ; max. 5 times... 670 decfsz lo,F ; max. 5 times...
672 bra active_gas_display 671 bra active_gas_display
673 672
1010 OUTPUTTEXT d'150' ; Bar: 1009 OUTPUTTEXT d'150' ; Bar:
1011 call word_processor 1010 call word_processor
1012 return 1011 return
1013 1012
1014 ;============================================================================= 1013 ;=============================================================================
1015 gassetup_sort_gaslist: ; Sorts Gaslist according to change depth 1014 ; Make sure first gas is marked active.
1016 clrf sorted_gaslist_active ; Clear all flags 1015 ; Note: - Gas are not soted anymore.
1017 1016 ; - Gas with a depth>0 should not be forced active, or it is impossible
1018 read_int_eeprom d'33' ; Get First gas (1-5) 1017 ; to de-activate them.
1019 movff EEDATA,lo 1018 gassetup_sort_gaslist:
1020 bsf STATUS,C 1019
1021 gassetup_sort_gaslist2: 1020 clrf EEADRH ; Select EEPROM lower page.
1022 rlcf sorted_gaslist_active,F ; Shift flag for first gas 1021 read_int_eeprom d'33' ; Get First gas (1-5)
1023 decfsz lo,F 1022 movff EEDATA,lo ; into register lo
1024 bra gassetup_sort_gaslist2 1023
1025 1024 read_int_eeprom d'27' ; Read selected gases
1026 read_int_eeprom d'28' ; Change Depth Gas1 1025
1027 tstfsz EEDATA ; =0? 1026 dcfsnz lo,F ; If lo==1
1028 bsf sorted_gaslist_active,0 ; No, set active 1027 bsf EEDATA,0 ; Select Gas1
1029 1028 dcfsnz lo,F ; If lo==2
1030 read_int_eeprom d'29' ; Change Depth Gas2 1029 bsf EEDATA,1 ; Select Gas2
1031 tstfsz EEDATA ; =0? 1030 dcfsnz lo,F
1032 bsf sorted_gaslist_active,1; No, set active 1031 bsf EEDATA,2
1033 1032 dcfsnz lo,F
1034 read_int_eeprom d'30' ; Change Depth Gas3 1033 bsf EEDATA,3
1035 tstfsz EEDATA ; =0? 1034 dcfsnz lo,F
1036 bsf sorted_gaslist_active,2 ; No, set active 1035 bsf EEDATA,4
1037 1036
1038 read_int_eeprom d'31' ; Change Depth Gas4 1037 ; Copy result to register:
1039 tstfsz EEDATA ; =0? 1038 movff EEDATA,sorted_gaslist_active
1040 bsf sorted_gaslist_active,3 ; No, set active 1039
1041 1040 ; And write to EEPROM too, to survive next reboot:
1042 read_int_eeprom d'32' ; Change Depth Gas5 1041 write_int_eeprom d'27'
1043 tstfsz EEDATA ; =0? 1042
1044 bsf sorted_gaslist_active,4 ; No, set active
1045
1046 movff sorted_gaslist_active,EEDATA
1047 clrf EEADRH
1048 write_int_eeprom d'27' ; Store results
1049 return 1043 return
1050 1044
1051 1045 ;=============================================================================
1052 ; EEPROM Locations of Gaslist 1046 ; EEPROM Locations of Gaslist
1053 ; Gas1: 1047 ; Gas1:
1054 ; O2 Default:4 1048 ; O2 Default:4
1055 ; He Default:5 1049 ; He Default:5
1056 ; O2 Current:6 1050 ; O2 Current:6