Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/divemode.asm @ 316:48685a69735e
Merge with @5 escape TTS
author | JeanDo |
---|---|
date | Wed, 04 May 2011 10:46:16 +0200 |
parents | 11be2470b9eb |
children | 4159c31abe31 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Mon May 02 16:14:07 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Wed May 04 10:46:16 2011 +0200 @@ -456,6 +456,11 @@ return ostc_debug 'B' ; Sends debug-information to screen if debugmode active + ; Send nes state to screen, if debugmode active + movff char_O_deco_status,WREG ; Status before call + addlw '0' ; Convert to ascii char + call ostc_debug1 ; and send. + call divemode_prepare_flags_for_deco clrf WREG movff WREG,char_I_step_is_1min ; Force 2 second deco mode @@ -497,21 +502,50 @@ call word_processor calc_deko_divemode4: + movff char_O_deco_status,WREG ; Is a compute cycle finished ? + iorwf WREG,F + btfss STATUS,Z + return ; Return is status <> 0 + ; Check if deco stops are necessary ? movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register tstfsz wait_temp ; Ceiling<0m? bra calc_deko_divemode3 ; Yes! - btfsc dekostop_active - call PLED_display_ndl_mask ; Clear deco data, display nostop time - bcf dekostop_active ; clear flag + btfsc dekostop_active ; Already in nodeco mode ? + call PLED_display_ndl_mask ; Clear deco data, display nostop time + bcf dekostop_active ; clear flag - clrf decodata+0 ; for profile memory - movff char_O_nullzeit,decodata+1 ; nostop time + clrf decodata+0 ; for profile memory + movff char_O_nullzeit,decodata+1 ; nostop time - call PLED_display_ndl ; display no deco limit + call PLED_display_ndl ; display no deco limit return +calc_deko_divemode3: + btfss dekostop_active ; Already in deco mode ? + call PLED_display_deko_mask ; clear nostop time, display decodata + bsf dekostop_active ; Set flag + + movff char_O_first_deco_depth,decodata+0 ; ceiling + movff char_O_first_deco_time,decodata+1 ; length of first stop in minues + + call PLED_display_deko ; display decodata + + ; Check if extra cycles are needed to compute @5 variant: + btfss tts_extra_time ; Is @5 displayed ? + return ; No: don't compute it. + + decfsz apnoe_mins ; Reached count-down ? + return ; No: don't compute yet. + + movlw .6 + movff WREG,char_O_deco_status ; Stole next cycles for @5 variant. + + movlw .2 ; Restart countdown. + movwf apnoe_mins + return + ;----------------------------------------------------------------------------- divemode_prepare_flags_for_deco: @@ -529,16 +563,7 @@ movff divemins+1,int_I_divemins+1 goto restart_set_modes_and_flags ; Sets decomode (char_I_deco_model) and flags (again) -calc_deko_divemode3: - btfss dekostop_active - call PLED_display_deko_mask ; clear nostop time, display decodata - bsf dekostop_active ; Set flag - - movff char_O_first_deco_depth,decodata+0 ; ceiling - movff char_O_first_deco_time,decodata+1 ; length of first stop in minues - - call PLED_display_deko ; display decodata - return +;----------------------------------------------------------------------------- store_dive_data: ; CF20 seconds gone bcf store_sample ; update only any CF20 seconds @@ -1685,8 +1710,9 @@ setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) bcf dekostop_active bcf is_bailout ;=1: CC mode, but bailout active! - bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode - + bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode + bcf tts_extra_time ;=1: Compute TTS if extra time spent at current depth + call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! btfss simulatormode_active