Mercurial > public > mk2
changeset 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 | 9feb224f6871 |
files | code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/menu_gassetup.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_c_part2/p2_deco.o |
diffstat | 4 files changed, 35 insertions(+), 152 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Wed Apr 20 07:51:11 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Thu Apr 21 04:16:00 2011 +0200 @@ -410,83 +410,6 @@ clrf EEDATA ; No, clear! movff EEDATA,char_I_deco_gas_change+0 ; Yes! - -; read_int_eeprom d'97' ; Read He ratio -; movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register -; read_int_eeprom d'96' ; Read O2 ratio -; movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register -; bsf STATUS,C ; -; movlw d'100' ; 100% -; subfwb wait_temp,W ; minus He -; subfwb EEDATA,F ; minus O2 -; movff EEDATA, char_I_deco_N2_ratio+4; = N2! -; -; read_int_eeprom d'101' ; Read He ratio -; movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register -; read_int_eeprom d'100' ; Read O2 ratio -; movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register -; bsf STATUS,C ; -; movlw d'100' ; 100% -; subfwb wait_temp,W ; minus He -; subfwb EEDATA,F ; minus O2 -; movff EEDATA, char_I_deco_N2_ratio+3; = N2! -; -; read_int_eeprom d'105' ; Read He ratio -; movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register -; read_int_eeprom d'104' ; Read O2 ratio -; movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register -; bsf STATUS,C ; -; movlw d'100' ; 100% -; subfwb wait_temp,W ; minus He -; subfwb EEDATA,F ; minus O2 -; movff EEDATA, char_I_deco_N2_ratio+2; = N2! -; -; read_int_eeprom d'109' ; Read He ratio -; movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register -; read_int_eeprom d'108' ; Read O2 ratio -; movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register -; bsf STATUS,C ; -; movlw d'100' ; 100% -; subfwb wait_temp,W ; minus He -; subfwb EEDATA,F ; minus O2 -; movff EEDATA, char_I_deco_N2_ratio+1; = N2! -; -; read_int_eeprom d'113' ; Read He ratio -; movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register -; read_int_eeprom d'112' ; Read O2 ratio -; movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register -; bsf STATUS,C ; -; movlw d'100' ; 100% -; subfwb wait_temp,W ; minus He -; subfwb EEDATA,F ; minus O2 -; movff EEDATA, char_I_deco_N2_ratio+0; = N2! -; -; Now, set change depth. Inactive gases have depth=0! -; read_int_eeprom d'118' ; read gas_change_depth Gas1 -; btfss sorted_gaslist_active,0 ; Apply depth? -; clrf EEDATA ; No, clear! -; movff EEDATA,char_I_deco_gas_change+4 ; Yes! -; -; read_int_eeprom d'119' ; read gas_change_depth Gas2 -; btfss sorted_gaslist_active,1 ; Apply depth? -; clrf EEDATA ; No, clear! -; movff EEDATA,char_I_deco_gas_change+3 ; Yes! -; -; read_int_eeprom d'120' ; read gas_change_depth Gas3 -; btfss sorted_gaslist_active,2 ; Apply depth? -; clrf EEDATA ; No, clear! -; movff EEDATA,char_I_deco_gas_change+2 ; Yes! -; -; read_int_eeprom d'121' ; read gas_change_depth Gas4 -; btfss sorted_gaslist_active,3 ; Apply depth? -; clrf EEDATA ; No, clear! -; movff EEDATA,char_I_deco_gas_change+1 ; Yes! -; -; read_int_eeprom d'122' ; read gas_change_depth Gas5 -; btfss sorted_gaslist_active,4 ; Apply depth? -; clrf EEDATA ; No, clear! -; movff EEDATA,char_I_deco_gas_change+0 ; Yes! - ; Debugger ; call enable_rs232 ; movff char_I_deco_He_ratio+4,TXREG @@ -1022,9 +945,7 @@ call div16x16 ; compute depth in full m -> result in xC+0 check_gas_change1: ; check gas1 -; read_int_eeprom d'27' ; read flag register - movff sorted_gaslist_active,EEDATA ; Get flag register - btfss EEDATA,0 ; check active flag + btfss sorted_gaslist_active,0 ; check active flag bra check_gas_change2 ; skip inactive gases! movlw d'1' cpfseq active_gas ; is this gas currently selected? @@ -1044,9 +965,7 @@ bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode check_gas_change2: ; check gas2 -; read_int_eeprom d'27' ; read flag register - movff sorted_gaslist_active,EEDATA ; Get flag register - btfss EEDATA,1 ; check active flag + btfss sorted_gaslist_active,1 ; check active flag bra check_gas_change3 ; skip inactive gases! movlw d'2' cpfseq active_gas ; is this gas currently selected? @@ -1066,9 +985,7 @@ bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode check_gas_change3: ; check gas3 -; read_int_eeprom d'27' ; read flag register - movff sorted_gaslist_active,EEDATA ; Get flag register - btfss EEDATA,2 ; check active flag + btfss sorted_gaslist_active,2 ; check active flag bra check_gas_change4 ; skip inactive gases! movlw d'3' cpfseq active_gas ; is this gas currently selected? @@ -1088,9 +1005,7 @@ bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode check_gas_change4: ; check gas4 -; read_int_eeprom d'27' ; read flag register - movff sorted_gaslist_active,EEDATA ; Get flag register - btfss EEDATA,3 ; check active flag + btfss sorted_gaslist_active,3 ; check active flag bra check_gas_change5 ; skip inactive gases! movlw d'4' cpfseq active_gas ; is this gas currently selected? @@ -1110,9 +1025,7 @@ bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode check_gas_change5: ; check gas5 -; read_int_eeprom d'27' ; read flag register - movff sorted_gaslist_active,EEDATA ; Get flag register - btfss EEDATA,4 ; check active flag + btfss sorted_gaslist_active,4 ; check active flag bra check_gas_change6 ; skip inactive gases! movlw d'5' cpfseq active_gas ; is this gas currently selected? @@ -1859,28 +1772,3 @@ read_int_eeprom d'27' movff EEDATA, sorted_gaslist_active return - - -; -; clrf sorted_gaslist_active ; Clear all flags -; read_int_eeprom d'118' ; read gas_change_depth Gas1 -; tstfsz EEDATA ; =0m? -; bsf sorted_gaslist_active,0 ; No, Set Flag for Gas1 -; -; read_int_eeprom d'119' ; read gas_change_depth Gas2 -; tstfsz EEDATA ; =0m? -; bsf sorted_gaslist_active,1 ; No, Set Flag for Gas2 -; -; read_int_eeprom d'120' ; read gas_change_depth Gas3 -; tstfsz EEDATA ; =0m? -; bsf sorted_gaslist_active,2 ; No, Set Flag for Gas3 -; -; read_int_eeprom d'121' ; read gas_change_depth Gas4 -; tstfsz EEDATA ; =0m? -; bsf sorted_gaslist_active,3 ; No, Set Flag for Gas4 -; -; read_int_eeprom d'122' ; read gas_change_depth Gas5 -; tstfsz EEDATA ; =0m? -; bsf sorted_gaslist_active,4 ; No, Set Flag for Gas5 -; return -; \ No newline at end of file
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Wed Apr 20 07:51:11 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Thu Apr 21 04:16:00 2011 +0200 @@ -659,13 +659,12 @@ WIN_LEFT .20 lfsr FSR2,letter OUTPUTTEXT .105 ; "Active Gas? " - read_int_eeprom d'27' ; read flag register - ; hi contains active gas flags in BIT0:4 .... - + ; Active gas flags in BIT0:4 .... movff decodata+0,lo ; Gas 0-4 incf lo,F ; Gas 1-5 + read_int_eeprom d'27' ; read flag register active_gas_display: rrcf EEDATA ; roll flags into carry decfsz lo,F ; max. 5 times... @@ -1012,43 +1011,38 @@ return ;============================================================================= -gassetup_sort_gaslist: ; Sorts Gaslist according to change depth - clrf sorted_gaslist_active ; Clear all flags +; Make sure first gas is marked active. +; Note: - Gas are not soted anymore. +; - Gas with a depth>0 should not be forced active, or it is impossible +; to de-activate them. +gassetup_sort_gaslist: - read_int_eeprom d'33' ; Get First gas (1-5) - movff EEDATA,lo - bsf STATUS,C -gassetup_sort_gaslist2: - rlcf sorted_gaslist_active,F ; Shift flag for first gas - decfsz lo,F - bra gassetup_sort_gaslist2 + clrf EEADRH ; Select EEPROM lower page. + read_int_eeprom d'33' ; Get First gas (1-5) + movff EEDATA,lo ; into register lo - read_int_eeprom d'28' ; Change Depth Gas1 - tstfsz EEDATA ; =0? - bsf sorted_gaslist_active,0 ; No, set active + read_int_eeprom d'27' ; Read selected gases - read_int_eeprom d'29' ; Change Depth Gas2 - tstfsz EEDATA ; =0? - bsf sorted_gaslist_active,1; No, set active - - read_int_eeprom d'30' ; Change Depth Gas3 - tstfsz EEDATA ; =0? - bsf sorted_gaslist_active,2 ; No, set active + dcfsnz lo,F ; If lo==1 + bsf EEDATA,0 ; Select Gas1 + dcfsnz lo,F ; If lo==2 + bsf EEDATA,1 ; Select Gas2 + dcfsnz lo,F + bsf EEDATA,2 + dcfsnz lo,F + bsf EEDATA,3 + dcfsnz lo,F + bsf EEDATA,4 + + ; Copy result to register: + movff EEDATA,sorted_gaslist_active + + ; And write to EEPROM too, to survive next reboot: + write_int_eeprom d'27' - read_int_eeprom d'31' ; Change Depth Gas4 - tstfsz EEDATA ; =0? - bsf sorted_gaslist_active,3 ; No, set active - - read_int_eeprom d'32' ; Change Depth Gas5 - tstfsz EEDATA ; =0? - bsf sorted_gaslist_active,4 ; No, set active - - movff sorted_gaslist_active,EEDATA - clrf EEADRH - write_int_eeprom d'27' ; Store results return - +;============================================================================= ; EEPROM Locations of Gaslist ; Gas1: ; O2 Default:4
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Wed Apr 20 07:51:11 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Apr 21 04:16:00 2011 +0200 @@ -1229,7 +1229,8 @@ cpfsgt EEDATA ; is depth > 0 ? bra PLED_grey_gas - read_int_eeprom d'27' ; read flag register + clrf EEADRH ; Lower page of EEPROM. + read_int_eeprom d'27' ; read flag register PLED_grey_inactive_gas1: rrcf EEDATA ; roll flags into carry decfsz lo,F ; max. 5 times...