Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/divemode.asm @ 239:3ed240d60341
High altitude (Plane/Fly) mode added
author | heinrichsweikamp |
---|---|
date | Mon, 21 Mar 2011 13:31:38 +0100 |
parents | 55178aa1f972 |
children | 4ef3bcbc7091 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Sun Mar 20 17:55:21 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Mon Mar 21 13:31:38 2011 +0100 @@ -1409,24 +1409,25 @@ return set_dive_modes: + btfsc high_altitude_mode ; In high altitude (Fly) mode? + bra set_dive_modes3 ; Yes + bcf divemode2 ; Stop time GETCUSTOM8 .0 ; loads dive_threshold in WREG movwf sub_a+0 ; dive_treshold is in cm clrf sub_a+1 - movff rel_pressure+0,sub_b+0 movff rel_pressure+1,sub_b+1 - - call sub16 ; sub_c = sub_a - sub_b + call sub16 ; sub_c = sub_a - sub_b btfss neg_flag - bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) + bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) - btfsc realdive ; Dive longer than one minute? - clrf timeout_counter + btfsc realdive ; Dive longer than one minute? + clrf timeout_counter ; Yes, reset timout counter - bsf divemode + bsf divemode ; (Re-)Set divemode flag bsf divemode2 ; displayed divetime is running return @@ -1435,6 +1436,22 @@ bcf divemode ; no -> this was no real dive return +set_dive_modes3: + movlw HIGH d'1075' ; hard-wired 1075mBar threshold + movwf sub_a+1 + movlw LOW d'1075' ; hard-wired 1075mBar threshold + movwf sub_a+0 + movff rel_pressure+0,sub_b+0 + movff rel_pressure+1,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + + btfss neg_flag + bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) + + bsf divemode ; (Re-)Set divemode flag + bsf divemode2 ; displayed divetime is running + return + set_powersafe: btfsc low_battery_state ; battery warning alread active? bra set_powersafe2 ; Yes, but is it still required?