comparison src/divemode.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 b9f06f1a1f74
children 3f6d5cf91f64
comparison
equal deleted inserted replaced
506:b9f06f1a1f74 507:4e6f5c36f4cc
991 setup_gas_registers: ; With WREG=Gas 0-4 991 setup_gas_registers: ; With WREG=Gas 0-4
992 lfsr FSR1,opt_gas_O2_ratio+0 992 lfsr FSR1,opt_gas_O2_ratio+0
993 movff PLUSW1,char_I_O2_ratio ; O2 (For ppO2 calculations) 993 movff PLUSW1,char_I_O2_ratio ; O2 (For ppO2 calculations)
994 lfsr FSR1,opt_gas_He_ratio+0 994 lfsr FSR1,opt_gas_He_ratio+0
995 movff PLUSW1,char_I_He_ratio ; He 995 movff PLUSW1,char_I_He_ratio ; He
996 lfsr FSR1,opt_gas_type
997 movff PLUSW1,active_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
996 incf WREG,W ; Gas# 1-5 998 incf WREG,W ; Gas# 1-5
997 movff WREG,char_I_current_gas ; Set gas 999 movff WREG,char_I_current_gas ; Set gas
998 movff WREG,active_gas ; Set for logbook and display 1000 movff WREG,active_gas ; Set for logbook and display
999 banksel char_I_O2_ratio 1001 banksel char_I_O2_ratio
1000 movf char_I_O2_ratio,W ; Add O2... 1002 movf char_I_O2_ratio,W ; Add O2...
1010 return ; Ignore in bailout 1012 return ; Ignore in bailout
1011 lfsr FSR1,opt_dil_O2_ratio+0 1013 lfsr FSR1,opt_dil_O2_ratio+0
1012 movff PLUSW1,char_I_O2_ratio ; O2 (For ppO2 calculations) 1014 movff PLUSW1,char_I_O2_ratio ; O2 (For ppO2 calculations)
1013 lfsr FSR1,opt_dil_He_ratio+0 1015 lfsr FSR1,opt_dil_He_ratio+0
1014 movff PLUSW1,char_I_He_ratio ; He 1016 movff PLUSW1,char_I_He_ratio ; He
1017 lfsr FSR1,opt_dil_type
1018 movff PLUSW1,active_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
1015 incf WREG,W ; Gas# 1-5 1019 incf WREG,W ; Gas# 1-5
1016 movff WREG,char_I_current_gas ; Set gas 1020 movff WREG,char_I_current_gas ; Set gas
1017 movff WREG,active_gas ; Set for logbook and display 1021 movff WREG,active_gas ; Set for logbook and display
1018 movff WREG,active_diluent ; As a backup when switching back from Bailout to CCR 1022 movff WREG,active_diluent ; As a backup when switching back from Bailout to CCR
1019 banksel char_I_O2_ratio 1023 banksel char_I_O2_ratio
1326 ; return ; Done (Too low). 1330 ; return ; Done (Too low).
1327 1331
1328 ;check if we are within our warning thresholds! 1332 ;check if we are within our warning thresholds!
1329 movff xC+0,sub_b+0 1333 movff xC+0,sub_b+0
1330 movff xC+1,sub_b+1 1334 movff xC+1,sub_b+1
1331 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode 1335 movff opt_ppO2_max_deco,WREG ; PPO2 Max for MOD calculation and color coding in divemode
1332 addlw .1 ; e.g. >1.60 1336 addlw .1 ; e.g. >1.60
1333 mullw d'100' ; opt_ppO2_max*100 1337 mullw d'100' ; opt_ppO2_max*100
1334 movff PRODL,sub_a+0 1338 movff PRODL,sub_a+0
1335 movff PRODH,sub_a+1 1339 movff PRODH,sub_a+1
1336 call subU16 1340 call subU16
1816 rcall check_ppo2_display ; display if not already shown in custom view 1820 rcall check_ppo2_display ; display if not already shown in custom view
1817 1821
1818 ;check if we are within our warning thresholds! 1822 ;check if we are within our warning thresholds!
1819 movff xC+0,sub_b+0 1823 movff xC+0,sub_b+0
1820 movff xC+1,sub_b+1 1824 movff xC+1,sub_b+1
1821 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode 1825 ;active_gas_type -> 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
1822 addlw .1 ; e.g. >1.60 1826 movff active_gas_type,xA+0 ; xA+0 used as temp here -> holds type
1827 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here
1828 movlw .3
1829 cpfseq xA+0 ; Deco?
1830 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max
1831 movf xB+1,W ; Result in WREG
1832 addlw .1 ; e.g. >1.60
1823 mullw d'100' ; opt_ppO2_max*100 1833 mullw d'100' ; opt_ppO2_max*100
1824 movff PRODL,sub_a+0 1834 movff PRODL,sub_a+0
1825 movff PRODH,sub_a+1 1835 movff PRODH,sub_a+1
1826 call subU16 1836 call subU16
1827 btfss neg_flag 1837 btfss neg_flag