Mercurial > public > mk2
comparison 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 |
comparison
equal
deleted
inserted
replaced
311:91371c7553f5 | 316:48685a69735e |
---|---|
454 return | 454 return |
455 btfsc FLAG_apnoe_mode ; ignore decompression calculation in apnoe mode | 455 btfsc FLAG_apnoe_mode ; ignore decompression calculation in apnoe mode |
456 return | 456 return |
457 | 457 |
458 ostc_debug 'B' ; Sends debug-information to screen if debugmode active | 458 ostc_debug 'B' ; Sends debug-information to screen if debugmode active |
459 ; Send nes state to screen, if debugmode active | |
460 movff char_O_deco_status,WREG ; Status before call | |
461 addlw '0' ; Convert to ascii char | |
462 call ostc_debug1 ; and send. | |
463 | |
459 call divemode_prepare_flags_for_deco | 464 call divemode_prepare_flags_for_deco |
460 clrf WREG | 465 clrf WREG |
461 movff WREG,char_I_step_is_1min ; Force 2 second deco mode | 466 movff WREG,char_I_step_is_1min ; Force 2 second deco mode |
462 | 467 |
463 clrf TMR3L | 468 clrf TMR3L |
495 STRCPY "ms:" | 500 STRCPY "ms:" |
496 output_16 | 501 output_16 |
497 call word_processor | 502 call word_processor |
498 | 503 |
499 calc_deko_divemode4: | 504 calc_deko_divemode4: |
500 | 505 movff char_O_deco_status,WREG ; Is a compute cycle finished ? |
506 iorwf WREG,F | |
507 btfss STATUS,Z | |
508 return ; Return is status <> 0 | |
509 | |
510 ; Check if deco stops are necessary ? | |
501 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register | 511 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register |
502 tstfsz wait_temp ; Ceiling<0m? | 512 tstfsz wait_temp ; Ceiling<0m? |
503 bra calc_deko_divemode3 ; Yes! | 513 bra calc_deko_divemode3 ; Yes! |
504 | 514 |
505 btfsc dekostop_active | 515 btfsc dekostop_active ; Already in nodeco mode ? |
506 call PLED_display_ndl_mask ; Clear deco data, display nostop time | 516 call PLED_display_ndl_mask ; Clear deco data, display nostop time |
507 bcf dekostop_active ; clear flag | 517 bcf dekostop_active ; clear flag |
508 | 518 |
509 clrf decodata+0 ; for profile memory | 519 clrf decodata+0 ; for profile memory |
510 movff char_O_nullzeit,decodata+1 ; nostop time | 520 movff char_O_nullzeit,decodata+1 ; nostop time |
511 | 521 |
512 call PLED_display_ndl ; display no deco limit | 522 call PLED_display_ndl ; display no deco limit |
513 return | 523 return |
514 | 524 |
525 calc_deko_divemode3: | |
526 btfss dekostop_active ; Already in deco mode ? | |
527 call PLED_display_deko_mask ; clear nostop time, display decodata | |
528 bsf dekostop_active ; Set flag | |
529 | |
530 movff char_O_first_deco_depth,decodata+0 ; ceiling | |
531 movff char_O_first_deco_time,decodata+1 ; length of first stop in minues | |
532 | |
533 call PLED_display_deko ; display decodata | |
534 | |
535 ; Check if extra cycles are needed to compute @5 variant: | |
536 btfss tts_extra_time ; Is @5 displayed ? | |
537 return ; No: don't compute it. | |
538 | |
539 decfsz apnoe_mins ; Reached count-down ? | |
540 return ; No: don't compute yet. | |
541 | |
542 movlw .6 | |
543 movff WREG,char_O_deco_status ; Stole next cycles for @5 variant. | |
544 | |
545 movlw .2 ; Restart countdown. | |
546 movwf apnoe_mins | |
547 return | |
548 | |
515 ;----------------------------------------------------------------------------- | 549 ;----------------------------------------------------------------------------- |
516 | 550 |
517 divemode_prepare_flags_for_deco: | 551 divemode_prepare_flags_for_deco: |
518 movff amb_pressure+0,int_I_pres_respiration+0 ; lo and copy result to deco routine | 552 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 | 553 movff amb_pressure+1,int_I_pres_respiration+1 ; hi |
527 movff WREG,char_I_depth_last_deco | 561 movff WREG,char_I_depth_last_deco |
528 movff divemins+0,int_I_divemins+0 ; Current dive time. | 562 movff divemins+0,int_I_divemins+0 ; Current dive time. |
529 movff divemins+1,int_I_divemins+1 | 563 movff divemins+1,int_I_divemins+1 |
530 goto restart_set_modes_and_flags ; Sets decomode (char_I_deco_model) and flags (again) | 564 goto restart_set_modes_and_flags ; Sets decomode (char_I_deco_model) and flags (again) |
531 | 565 |
532 calc_deko_divemode3: | 566 ;----------------------------------------------------------------------------- |
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 | 567 |
543 store_dive_data: ; CF20 seconds gone | 568 store_dive_data: ; CF20 seconds gone |
544 bcf store_sample ; update only any CF20 seconds | 569 bcf store_sample ; update only any CF20 seconds |
545 bsf update_divetime ; update divemins every CF20 seconds | 570 bsf update_divetime ; update divemins every CF20 seconds |
546 | 571 |
1683 clrf average_depth_hold_total+3 ; Clear Non-Resettable Average | 1708 clrf average_depth_hold_total+3 ; Clear Non-Resettable Average |
1684 bcf depth_greater_100m ; clear flag | 1709 bcf depth_greater_100m ; clear flag |
1685 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) | 1710 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) |
1686 bcf dekostop_active | 1711 bcf dekostop_active |
1687 bcf is_bailout ;=1: CC mode, but bailout active! | 1712 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 | 1713 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1689 | 1714 bcf tts_extra_time ;=1: Compute TTS if extra time spent at current depth |
1715 | |
1690 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! | 1716 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! |
1691 | 1717 |
1692 btfss simulatormode_active | 1718 btfss simulatormode_active |
1693 bra diveloop_boot_1 | 1719 bra diveloop_boot_1 |
1694 ; Normal mode = Surface pressure is the pressure 30mn before dive. | 1720 ; Normal mode = Surface pressure is the pressure 30mn before dive. |