comparison src/gaslist.asm @ 507:4e6f5c36f4cc

NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
author heinrichsweikamp
date Tue, 27 Jun 2017 13:50:42 +0200
parents bef07a837a60
children 72f6cb65ca4a
comparison
equal deleted inserted replaced
506:b9f06f1a1f74 507:4e6f5c36f4cc
534 movf gaslist_gas,W 534 movf gaslist_gas,W
535 movff gaslist_O2,PLUSW1 ; And write back to opt_gas_O2_ratio[WREG] 535 movff gaslist_O2,PLUSW1 ; And write back to opt_gas_O2_ratio[WREG]
536 return 536 return
537 537
538 ;---------------------------------------------------------------------------- 538 ;----------------------------------------------------------------------------
539 ; Compute MOD from ppO2 Max and current O2 Ratio. 539 ; Compute MOD from opt_ppO2_max/opt_ppO2_max_deco and current O2 Ratio.
540 ; 540 ;
541 ; Input: gaslist_gas = current gas index. 541 ; Input: gaslist_gas = current gas index.
542 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio 542 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
543 ; Output: WREG = MOD [m] 543 ; Output: WREG = MOD [m]
544 ; 544 ;
545 gaslist_calc_mod: 545 gaslist_calc_mod:
546 movff gaslist_gas,gaslist_gas_global ; copy for color coding
546 movf gaslist_gas,W ; Read current gas O2 ratio 547 movf gaslist_gas,W ; Read current gas O2 ratio
547 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] 548 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG]
548 movf PLUSW1,W 549 movf PLUSW1,W
549 550
550 btfsc divemode ; In divemode? 551 btfsc divemode ; In divemode?
551 bra gaslist_calc_mod_divemode ; Yes. 552 bra gaslist_calc_mod_divemode ; Yes.
552 553
553 ; Pamb max = ppO2 Max / O2 ratio 554 ; Pamb max = ppO2 Max / O2 ratio
554 movwf xB+0 555 movwf xB+0
555 clrf xB+1 556
556 557 movf gaslist_gas,W ; Read current gas O2 ratio
557 movff opt_ppO2_max,WREG 558 lfsr FSR1,opt_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
559 movff PLUSW1,xA+0 ; xA+0 used as temp here -> holds type
560
561 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here
562 movlw .3
563 cpfseq xA+0 ; Deco?
564 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max
565 movf xB+1,W ; Result in WREG
566
567 clrf xB+1 ; Clear for div16x16
558 mullw .10 568 mullw .10
559 movff PRODL,xA+0 569 movff PRODL,xA+0
560 movff PRODH,xA+1 570 movff PRODH,xA+1
561 call div16x16 571 call div16x16
562 572
567 577
568 gaslist_calc_mod_divemode: 578 gaslist_calc_mod_divemode:
569 extern TFT_color_code1 579 extern TFT_color_code1
570 movwf hi ; Copy O2% 580 movwf hi ; Copy O2%
571 movlw warn_gas_in_gaslist 581 movlw warn_gas_in_gaslist
572 call TFT_color_code1 ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold 582 call TFT_color_code1 ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max/opt_ppO2_max_deco as threshold
573 return 583 return
574 ;---------------------------------------------------------------------------- 584 ;----------------------------------------------------------------------------
575 585
576 global gaslist_ppo2 586 global gaslist_ppo2
577 gaslist_ppo2: 587 gaslist_ppo2: