# HG changeset patch # User heinrichsweikamp # Date 1340255771 -7200 # Node ID 16f4eafc197ebb5f2d5e0b2936ebbc0d1c28b504 # Parent 6520bcda1a005a7a84f9247915c69bf1103a8093 CNS for pSCR-GF fixed. diff -r 6520bcda1a00 -r 16f4eafc197e code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Thu May 31 09:09:47 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Thu Jun 21 07:16:11 2012 +0200 @@ -1,3 +1,7 @@ +New in 2.24: +BETA Version - Do NOT use for diving! +BUGFIX: CNS for pSCR-GF + New in 2.23: BETA Version - Do NOT use for diving! NEW: CF64: Configures color for inactive gases diff -r 6520bcda1a00 -r 16f4eafc197e code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Thu May 31 09:09:47 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Thu Jun 21 07:16:11 2012 +0200 @@ -275,19 +275,13 @@ call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) ; Calculate CNS - rcall set_actual_ppo2 ; Set char_I_actual_ppO2 clrf WREG movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. read_int_eeprom d'34' ; Read deco data - movlw .6 - cpfseq EEDATA - bra calc_deko_divemode1a - ; in PSCR mode - call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 -; tstfsz sub_c+1 ; Is ppO2 > 2.55bar ? mH -; setf sub_c+0 ; yes: bound to 2.55... better than wrap around. - movff sub_c+0,char_I_actual_ppO2 ; copy last ppO2 to buffer register + movlw .6 + cpfseq EEDATA ; in pscr-mode? + rcall set_actual_ppo2 ; No, set char_I_actual_ppO2 calc_deko_divemode1a: call deco_calc_CNS_fraction ; calculate CNS @@ -877,10 +871,19 @@ bra check_ppO2_non_pscr ; in PSCR mode call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 + movff sub_c+0,xA+0 + movff sub_c+1,xA+1 + movlw d'100' + movwf xB+0 + clrf xB+1 + call div16x16 ; /100 + tstfsz xC+1 ; Is ppO2 > 2.55bar ? + setf xC+0 ; yes: bound to 2.55... better than wrap around. + movff xC+0,char_I_actual_ppO2 ; copy last ppO2 to buffer register (for pSCR CNS) + clrf xC+2 + clrf xC+3 movff sub_c+0,xC+0 movff sub_c+1,xC+1 ; copy for comptibility - clrf xC+2 - clrf xC+3 bra check_ppO2_check check_ppO2_non_pscr: diff -r 6520bcda1a00 -r 16f4eafc197e code_part1/OSTC_code_asm_part1/i2c_eeprom.asm --- a/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm Thu May 31 09:09:47 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm Thu Jun 21 07:16:11 2012 +0200 @@ -322,9 +322,10 @@ bra I2CFail ; timeout occured WaitMSSP2: btfss PIR1,SSPIF - bra WaitMSSP + bra WaitMSSP clrf i2c_temp bcf PIR1,SSPIF + nop return I2CReset: ; Something went wrong (Slave holds SDA low?) diff -r 6520bcda1a00 -r 16f4eafc197e code_part1/OSTC_code_asm_part1/start.asm --- a/code_part1/OSTC_code_asm_part1/start.asm Thu May 31 09:09:47 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/start.asm Thu Jun 21 07:16:11 2012 +0200 @@ -352,7 +352,6 @@ GETCUSTOM8 d'33' ; GF high movff EEDATA,char_I_GF_High_percentage return ; start in Surfacemode - restart_5_test_pSCR_mode: movlw d'6' ; pSCR-GF cpfseq EEDATA