comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 675:0211d9b9f0ca

NEW: CF70: Safety Stop Duration [s] NEW: CF71: Safety Stop Start Depth [m] NEW: CF72: Safety Stop End Depth [m] NEW: CF73: Safety Stop Reset Depth [m]
author heinrichsweikamp
date Mon, 10 Dec 2012 22:00:37 +0100
parents e2bb4f745f3a
children 6e456a6398e0
comparison
equal deleted inserted replaced
674:3927bc5019c9 675:0211d9b9f0ca
411 ; Below "safety_stop_reset"? Set flag and reset count-down timer 411 ; Below "safety_stop_reset"? Set flag and reset count-down timer
412 SAFE_2BYTE_COPY rel_pressure, lo 412 SAFE_2BYTE_COPY rel_pressure, lo
413 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 413 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
414 movff lo,sub_a+0 414 movff lo,sub_a+0
415 movff hi,sub_a+1 415 movff hi,sub_a+1
416 movlw LOW safety_stop_reset 416 GETCUSTOM8 .73 ; Safety Stop Reset Depth [dm]
417 movwf sub_b+0 417 mullw .10
418 movlw HIGH safety_stop_reset 418 movff PRODL,sub_b+0
419 movwf sub_b+1 419 movff PRODH,sub_b+1
420 call subU16 ; sub_c = sub_a - sub_b 420 call subU16 ; sub_c = sub_a - sub_b
421 btfss neg_flag 421 btfss neg_flag
422 bra reset_safety_stop ; Below 10m, reset safety stop 422 bra reset_safety_stop ; Below 10m, reset safety stop
423 423
424 ; Above "safety_stop_end"? Clear flag. 424 ; Above "safety_stop_end"? Clear flag.
425 SAFE_2BYTE_COPY rel_pressure, lo 425 SAFE_2BYTE_COPY rel_pressure, lo
426 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 426 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
427 movff lo,sub_a+0 427 movff lo,sub_a+0
428 movff hi,sub_a+1 428 movff hi,sub_a+1
429 movlw LOW safety_stop_end 429 GETCUSTOM8 .72 ; Safety Stop End Depth [dm]
430 movwf sub_b+0 430 mullw .10
431 movlw HIGH safety_stop_end 431 movff PRODL,sub_b+0
432 movwf sub_b+1 432 movff PRODH,sub_b+1
433 call subU16 ; sub_c = sub_a - sub_b 433 call subU16 ; sub_c = sub_a - sub_b
434 btfsc neg_flag 434 btfsc neg_flag
435 bra delete_safety_stop ; Above 3m, remove safety stop 435 bra delete_safety_stop ; Above 3m, remove safety stop
436 436
437 ; Above "safety_stop_start"? Activate safety stop 437 ; Above "safety_stop_start"? Activate safety stop
438 SAFE_2BYTE_COPY rel_pressure, lo 438 SAFE_2BYTE_COPY rel_pressure, lo
439 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 439 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
440 movff lo,sub_a+0 440 movff lo,sub_a+0
441 movff hi,sub_a+1 441 movff hi,sub_a+1
442 movlw LOW safety_stop_start 442 GETCUSTOM8 .71 ; Safety Stop Start Depth [dm]
443 movwf sub_b+0 443 mullw .10
444 movlw HIGH safety_stop_start 444 movff PRODL,sub_b+0
445 movwf sub_b+1 445 movff PRODH,sub_b+1
446 call subU16 ; sub_c = sub_a - sub_b 446 call subU16 ; sub_c = sub_a - sub_b
447 btfsc neg_flag 447 btfsc neg_flag
448 bra acivate_safety_stop ; Above 5m, activate safety stop 448 bra acivate_safety_stop ; Above 5m, activate safety stop
449 449
450 bra reset_safety_stop2 ; Pause safety stop 450 bra reset_safety_stop2 ; Pause safety stop
457 delete_safety_stop: 457 delete_safety_stop:
458 clrf safety_stop_countdown ; reset timer 458 clrf safety_stop_countdown ; reset timer
459 bra reset_safety_stop2 ; Remove saftestop from display 459 bra reset_safety_stop2 ; Remove saftestop from display
460 460
461 reset_safety_stop: 461 reset_safety_stop:
462 movlw safety_stop_length ;[s] 462 GETCUSTOM8 .70 ; Safety Stop Duration [s]
463 movwf safety_stop_countdown ; reset timer 463 movwf safety_stop_countdown ; reset timer
464 reset_safety_stop2: 464 reset_safety_stop2:
465 btfss safety_stop_active ; Safety stop shown 465 btfss safety_stop_active ; Safety stop shown
466 return ; No, don't delete it 466 return ; No, don't delete it
467 bcf show_safety_stop ; Clear flag 467 bcf show_safety_stop ; Clear flag