Mercurial > public > hwos_code
comparison src/simulator.asm @ 295:7027d735ac62
NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
author | jDG |
---|---|
date | Sun, 31 May 2015 02:14:09 +0200 |
parents | f97e439d711c |
children | af13a18a233b |
comparison
equal
deleted
inserted
replaced
294:f97e439d711c | 295:7027d735ac62 |
---|---|
324 rcall deco_setup ; Setup all model parameters. | 324 rcall deco_setup ; Setup all model parameters. |
325 call deco_push_tissues_to_vault | 325 call deco_push_tissues_to_vault |
326 banksel common ; Bank1 | 326 banksel common ; Bank1 |
327 | 327 |
328 ;---- Specific settings ------------------------------------------------------ | 328 ;---- Specific settings ------------------------------------------------------ |
329 | 329 deco_planer_redo: |
330 banksel char_O_deco_status ; Bank 2 | 330 banksel char_O_deco_status ; Bank 2 |
331 movlw .3 ; Start in surface state. | 331 movlw .3 ; Start in surface state. |
332 movwf char_O_deco_status | 332 movwf char_O_deco_status |
333 | 333 |
334 banksel char_I_step_is_1min ; Bank 3 | 334 banksel char_I_step_is_1min ; Bank 3 |
378 clrf char_I_step_is_1min ; Back to 2sec loops | 378 clrf char_I_step_is_1min ; Back to 2sec loops |
379 | 379 |
380 ;---- Wait until status reach zero ------------------------------------------- | 380 ;---- Wait until status reach zero ------------------------------------------- |
381 deco_planer_finishing: | 381 deco_planer_finishing: |
382 btg LEDg | 382 btg LEDg |
383 clrf TMR5L | 383 ; clrf TMR5L |
384 clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H | 384 ; clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H |
385 call deco_calc_hauptroutine ; Simulate 2sec more | 385 call deco_calc_hauptroutine ; Simulate 2sec more |
386 | 386 |
387 banksel char_O_deco_status ; Bank 2 | 387 banksel char_O_deco_status ; Bank 2 |
388 movf char_O_deco_status,W | 388 movf char_O_deco_status,W |
389 bz deco_planer_finished | 389 bnz deco_planer_finishing |
390 | |
391 ;---- Optional extra cycle to recompute stops in bailout mode --------------- | |
392 banksel common | |
393 btfss is_bailout ; Doing a bailout decoplan ? | |
394 bra deco_planer_finished ; NO: so we are done. | |
390 | 395 |
391 bra deco_planer_finishing | 396 rcall deco_setup_oc_gases ; Switch to OC gas and no const_ppO2 |
397 | |
398 movlw .3 ; restart 2sec cycles. | |
399 movff WREG,char_O_deco_status | |
400 call deco_calc_hauptroutine ; Reset + simulate first 2secs. | |
401 | |
402 deco_planer_bail_loop: | |
403 btg LEDg | |
404 ; clrf TMR5L | |
405 ; clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H | |
406 call deco_calc_hauptroutine ; Simulate 2sec more | |
407 | |
408 banksel char_O_deco_status ; Bank 2 | |
409 movf char_O_deco_status,W | |
410 bnz deco_planer_bail_loop | |
392 | 411 |
393 deco_planer_finished: | 412 deco_planer_finished: |
394 call deco_calc_CNS_planning | 413 call deco_calc_CNS_planning |
395 movff int_O_CNS_fraction+0,decoplan_CNS+0 | 414 movff int_O_CNS_fraction+0,decoplan_CNS+0 |
396 movff int_O_CNS_fraction+1,decoplan_CNS+1 | 415 movff int_O_CNS_fraction+1,decoplan_CNS+1 |
710 deco_show_plan_3: | 729 deco_show_plan_3: |
711 btfss decoplan_last_ceiling_shown | 730 btfss decoplan_last_ceiling_shown |
712 bra deco_show_plan_1 | 731 bra deco_show_plan_1 |
713 ; All stops shown | 732 ; All stops shown |
714 | 733 |
715 ;---- In OC mode, show the gas Usage special page --------------------------- | 734 ;---- In CCR mode, compute a BAILOUT decoplan --------------------------------- |
735 banksel common | |
736 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | |
737 bra simulator_show_decoplan5_0 ; NO: normal OC mode: just display | |
738 | |
739 btfsc is_bailout ; ALREADY in bailout mode ? | |
740 bra simulator_show_decoplan5_0 ; YES: alreay BAIL plan: display gas | |
741 | |
742 ; Redo 2nd deco-plann, in bailout mode: | |
743 bsf is_bailout ; Set special bailout mode. | |
744 rcall deco_planer_redo ; Redo plan computation | |
745 | |
746 movff char_I_setpoint_cbar+0,char_I_const_ppO2 | |
747 bra deco_show_plan ; and display bailout stops | |
748 | |
749 ;---- In OC+BAIL modes, show the gas Usage special page ----------------------- | |
716 simulator_show_decoplan5_0: | 750 simulator_show_decoplan5_0: |
717 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | 751 bcf is_bailout ; Back to normal |
718 return ; YES: Return to simulator menu | |
719 | 752 |
720 ; Make sure to pass first gas | 753 ; Make sure to pass first gas |
721 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG | 754 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG |
722 incf WREG,f ; gas 1..5 | 755 incf WREG,f ; gas 1..5 |
723 movff WREG,char_I_first_gas ; Copy for compatibility | 756 movff WREG,char_I_first_gas ; Copy for compatibility |
724 | 757 |
725 ; Compute gas consumption for each tank. | 758 ; Compute gas consumption for each tank. |
726 extern deco_gas_volumes | 759 extern deco_gas_volumes |
727 call deco_gas_volumes | 760 call deco_gas_volumes |
728 movlb .1 | 761 movlb .1 |
778 cpfseq wait_temp ; All gases shown? | 811 cpfseq wait_temp ; All gases shown? |
779 bra simulator_show_decoplan5_loop ; No | 812 bra simulator_show_decoplan5_loop ; No |
780 | 813 |
781 WIN_COLOR color_greenish | 814 WIN_COLOR color_greenish |
782 WIN_SMALL .80,.25 | 815 WIN_SMALL .80,.25 |
783 STRCPY_TEXT tGasUsage | 816 |
817 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | |
818 bra simulator_show_decoplan5_4 ; YES: This is bailout mode | |
819 | |
820 STRCPY_TEXT tGasUsage ; OC: "Gas Usage" | |
821 bra simulator_show_decoplan5_5 | |
822 | |
823 simulator_show_decoplan5_4: | |
824 STRCPY_TEXT tDiveBailout ; CCR: "Bailout" | |
825 | |
826 simulator_show_decoplan5_5 | |
784 STRCAT_PRINT ":" | 827 STRCAT_PRINT ":" |
785 call TFT_standard_color | 828 call TFT_standard_color |
786 | 829 |
787 call logbook_preloop_tasks | 830 call logbook_preloop_tasks |
788 simulator_show_decoplan5_3: | 831 simulator_show_decoplan5_3: |