comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 312:b7e4e74c0e17 @5 variant

New @5 variant: compute TTS if staying some extra time (CF58) at current depth. * Added extra deco_status, and sim_extra_time() in p2_deco.c * Launched by setting char_O_deco_state to 6, result in int_O_extra_ascenttime * Added 8th divemode customview * Auto stole every other cycles * CF58 menu updated (EN,FR,DE,SP)
author JeanDo
date Tue, 03 May 2011 00:52:42 +0200
parents 91371c7553f5
children 11be2470b9eb
comparison
equal deleted inserted replaced
311:91371c7553f5 312:b7e4e74c0e17
495 STRCPY "ms:" 495 STRCPY "ms:"
496 output_16 496 output_16
497 call word_processor 497 call word_processor
498 498
499 calc_deko_divemode4: 499 calc_deko_divemode4:
500 500 movff char_O_deco_status,WREG ; Is a compute cycle finished ?
501 iorwf WREG,F
502 btfss STATUS,Z
503 return ; Return is status <> 0
504
505 ; Check if deco stops are necessary ?
501 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register 506 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register
502 tstfsz wait_temp ; Ceiling<0m? 507 tstfsz wait_temp ; Ceiling<0m?
503 bra calc_deko_divemode3 ; Yes! 508 bra calc_deko_divemode3 ; Yes!
504 509
505 btfsc dekostop_active 510 btfsc dekostop_active ; Already in nodeco mode ?
506 call PLED_display_ndl_mask ; Clear deco data, display nostop time 511 call PLED_display_ndl_mask ; Clear deco data, display nostop time
507 bcf dekostop_active ; clear flag 512 bcf dekostop_active ; clear flag
508 513
509 clrf decodata+0 ; for profile memory 514 clrf decodata+0 ; for profile memory
510 movff char_O_nullzeit,decodata+1 ; nostop time 515 movff char_O_nullzeit,decodata+1 ; nostop time
511 516
512 call PLED_display_ndl ; display no deco limit 517 call PLED_display_ndl ; display no deco limit
513 return 518 return
514 519
520 calc_deko_divemode3:
521 btfss dekostop_active ; Already in deco mode ?
522 call PLED_display_deko_mask ; clear nostop time, display decodata
523 bsf dekostop_active ; Set flag
524
525 movff char_O_first_deco_depth,decodata+0 ; ceiling
526 movff char_O_first_deco_time,decodata+1 ; length of first stop in minues
527
528 call PLED_display_deko ; display decodata
529
530 ; Check if extra cycles are needed to compute @5 variant:
531 btfss tts_extra_time ; Is @5 displayed ?
532 return ; No: don't compute it.
533
534 dcfsnz apnoe_mins ; Reached count-down ?
535 return ; No: don't compute yet.
536
537 movlw .6
538 movff WREG,char_O_deco_status ; Stole next cycles for @5 variant.
539
540 movlw .2 ; Restart countdown.
541 movwf apnoe_mins
542 return
515 ;----------------------------------------------------------------------------- 543 ;-----------------------------------------------------------------------------
516 544
517 divemode_prepare_flags_for_deco: 545 divemode_prepare_flags_for_deco:
518 movff amb_pressure+0,int_I_pres_respiration+0 ; lo and copy result to deco routine 546 movff amb_pressure+0,int_I_pres_respiration+0 ; lo and copy result to deco routine
519 movff amb_pressure+1,int_I_pres_respiration+1 ; hi 547 movff amb_pressure+1,int_I_pres_respiration+1 ; hi
527 movff WREG,char_I_depth_last_deco 555 movff WREG,char_I_depth_last_deco
528 movff divemins+0,int_I_divemins+0 ; Current dive time. 556 movff divemins+0,int_I_divemins+0 ; Current dive time.
529 movff divemins+1,int_I_divemins+1 557 movff divemins+1,int_I_divemins+1
530 goto restart_set_modes_and_flags ; Sets decomode (char_I_deco_model) and flags (again) 558 goto restart_set_modes_and_flags ; Sets decomode (char_I_deco_model) and flags (again)
531 559
532 calc_deko_divemode3: 560 ;-----------------------------------------------------------------------------
533 btfss dekostop_active
534 call PLED_display_deko_mask ; clear nostop time, display decodata
535 bsf dekostop_active ; Set flag
536
537 movff char_O_first_deco_depth,decodata+0 ; ceiling
538 movff char_O_first_deco_time,decodata+1 ; length of first stop in minues
539
540 call PLED_display_deko ; display decodata
541 return
542 561
543 store_dive_data: ; CF20 seconds gone 562 store_dive_data: ; CF20 seconds gone
544 bcf store_sample ; update only any CF20 seconds 563 bcf store_sample ; update only any CF20 seconds
545 bsf update_divetime ; update divemins every CF20 seconds 564 bsf update_divetime ; update divemins every CF20 seconds
546 565
1683 clrf average_depth_hold_total+3 ; Clear Non-Resettable Average 1702 clrf average_depth_hold_total+3 ; Clear Non-Resettable Average
1684 bcf depth_greater_100m ; clear flag 1703 bcf depth_greater_100m ; clear flag
1685 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) 1704 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%])
1686 bcf dekostop_active 1705 bcf dekostop_active
1687 bcf is_bailout ;=1: CC mode, but bailout active! 1706 bcf is_bailout ;=1: CC mode, but bailout active!
1688 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 1707 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1689 1708 bcf tts_extra_time ;=1: Compute TTS if extra time spent at current depth
1709
1690 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! 1710 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs!
1691 1711
1692 btfss simulatormode_active 1712 btfss simulatormode_active
1693 bra diveloop_boot_1 1713 bra diveloop_boot_1
1694 ; Normal mode = Surface pressure is the pressure 30mn before dive. 1714 ; Normal mode = Surface pressure is the pressure 30mn before dive.