comparison src/divemode.asm @ 485:18e047102e49

3.14 BETA release
author heinrichsweikamp
date Mon, 20 Feb 2017 15:49:38 +0100
parents c0ee33f1f399
children b9f06f1a1f74
comparison
equal deleted inserted replaced
484:ff2994528e02 485:18e047102e49
226 return 226 return
227 227
228 ; Calculate CNS 228 ; Calculate CNS
229 btfss FLAG_pscr_mode ; in PSCR mode? 229 btfss FLAG_pscr_mode ; in PSCR mode?
230 rcall set_actual_ppo2 ; No, set char_I_actual_ppO2 230 rcall set_actual_ppo2 ; No, set char_I_actual_ppO2
231 btfsc is_bailout ; Always in bailout...
232 rcall set_actual_ppo2 ; ...set char_I_actual_ppO2
233
231 clrf WREG 234 clrf WREG
232 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. 235 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode.
233 call deco_calc_CNS_fraction ; calculate CNS 236 call deco_calc_CNS_fraction ; calculate CNS
234 movlb b'00000001' ; rambank 1 selected 237 movlb b'00000001' ; rambank 1 selected
235 ; Check for a gas change 238 ; Check for a gas change
310 bcf setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure 313 bcf setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure
311 314
312 btfsc FLAG_ccr_mode ; In CCR mode? 315 btfsc FLAG_ccr_mode ; In CCR mode?
313 rcall calc_deko_divemode_sensor ; External sensor stuff 316 rcall calc_deko_divemode_sensor ; External sensor stuff
314 317
318 ; btfsc FLAG_pscr_mode ; In PSCR mode?
319 ; rcall calc_deko_divemode_sensor ; External sensor stuff
320
321
315 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; C-code needs the ambient pressure 322 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; C-code needs the ambient pressure
316 clrf WREG 323 clrf WREG
317 movff WREG,char_I_step_is_1min ; Force 2 second deco mode 324 movff WREG,char_I_step_is_1min ; Force 2 second deco mode
318 325
319 movff char_I_O2_ratio,lo_temp ; Backup original value for everything 326 movff char_I_O2_ratio,lo_temp ; Backup original value for everything
320 movff char_I_N2_ratio,hi_temp ; Backup original value for everything 327 movff char_I_N2_ratio,hi_temp ; Backup original value for everything
321 328
322 btfss FLAG_pscr_mode 329 btfss FLAG_pscr_mode
323 bra calc_deko_divemode2a ; Non-PSCR modes... 330 bra calc_deko_divemode2a ; Non-PSCR modes...
331
332 btfsc is_bailout
333 bra calc_deko_divemode2a ; Skip in bailout
324 334
325 ; in PSCR mode, compute fO2 into char_I_O2_ratio 335 ; in PSCR mode, compute fO2 into char_I_O2_ratio
326 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 336 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
327 movff sub_c+0,xA+0 337 movff sub_c+0,xA+0
328 movff sub_c+1,xA+1 338 movff sub_c+1,xA+1
947 return ; Yes, do not switch gas (There is no Gas #0 !) 957 return ; Yes, do not switch gas (There is no Gas #0 !)
948 958
949 decf menupos,W ; 1-5 -> 0-4 959 decf menupos,W ; 1-5 -> 0-4
950 btfss FLAG_ccr_mode ; Choose OC Gases 960 btfss FLAG_ccr_mode ; Choose OC Gases
951 rcall setup_gas_registers ; With WREG=Gas 0-4 961 rcall setup_gas_registers ; With WREG=Gas 0-4
962 decf menupos,W ; 1-5 -> 0-4
952 btfsc FLAG_ccr_mode ; Choose CC Diluents 963 btfsc FLAG_ccr_mode ; Choose CC Diluents
964 rcall setup_dil_registers ; With WREG=Gas 0-4
965 decf menupos,W ; 1-5 -> 0-4
966 btfsc FLAG_pscr_mode ; Choose CC Diluents
953 rcall setup_dil_registers ; With WREG=Gas 0-4 967 rcall setup_dil_registers ; With WREG=Gas 0-4
954 968
955 decf menupos,W ; 1-5 -> 0-4 969 decf menupos,W ; 1-5 -> 0-4
956 btfsc is_bailout ; Choose OC Bailouts (OC Gases) 970 btfsc is_bailout ; Choose OC Bailouts (OC Gases)
957 rcall setup_gas_registers ; With WREG=Gas 0-4 971 rcall setup_gas_registers ; With WREG=Gas 0-4
1181 movlw d'100' 1195 movlw d'100'
1182 movwf xB+0 1196 movwf xB+0
1183 clrf xB+1 1197 clrf xB+1
1184 call div16x16 ; compute depth in full m -> result in xC+0 1198 call div16x16 ; compute depth in full m -> result in xC+0
1185 1199
1200 btfsc FLAG_ccr_mode ; In PSCR mode...
1201 bra check_gas_change2 ; Yes, check for diluents
1186 btfss FLAG_ccr_mode ; In CCR mode... 1202 btfss FLAG_ccr_mode ; In CCR mode...
1187 bra check_gas_change_OC_bail; No, check for OC or bailout 1203 bra check_gas_change_OC_bail; No, check for OC or bailout
1204 check_gas_change2:
1188 btfsc is_bailout ; Bailout? 1205 btfsc is_bailout ; Bailout?
1189 bra check_gas_change_OC_bail; Yes, check for OC or bailout 1206 bra check_gas_change_OC_bail; Yes, check for OC or bailout
1190 1207
1191 ; Check Diluents 1208 ; Check Diluents
1192 bsf ccr_diluent_setup ; in CCR menus 1209 bsf ccr_diluent_setup ; in CCR menus
1510 1527
1511 btfss FLAG_ccr_mode 1528 btfss FLAG_ccr_mode
1512 rcall dive_boot_oc 1529 rcall dive_boot_oc
1513 btfsc FLAG_ccr_mode 1530 btfsc FLAG_ccr_mode
1514 rcall dive_boot_cc 1531 rcall dive_boot_cc
1515 1532 btfsc FLAG_pscr_mode
1533 rcall dive_boot_cc
1534
1516 ; Copy opt_dil_types into backup (For "lost gas" feature) 1535 ; Copy opt_dil_types into backup (For "lost gas" feature)
1517 movff opt_dil_type+0,opt_dil_type_backup+0 ; 0=Disabled, 1=First, 2=Normal 1536 movff opt_dil_type+0,opt_dil_type_backup+0 ; 0=Disabled, 1=First, 2=Normal
1518 movff opt_dil_type+1,opt_dil_type_backup+1 ; 0=Disabled, 1=First, 2=Normal 1537 movff opt_dil_type+1,opt_dil_type_backup+1 ; 0=Disabled, 1=First, 2=Normal
1519 movff opt_dil_type+2,opt_dil_type_backup+2 ; 0=Disabled, 1=First, 2=Normal 1538 movff opt_dil_type+2,opt_dil_type_backup+2 ; 0=Disabled, 1=First, 2=Normal
1520 movff opt_dil_type+3,opt_dil_type_backup+3 ; 0=Disabled, 1=First, 2=Normal 1539 movff opt_dil_type+3,opt_dil_type_backup+3 ; 0=Disabled, 1=First, 2=Normal
1594 movlw samplingrate_apnoe 1613 movlw samplingrate_apnoe
1595 movwf samplesecs_value ; to avoid EEPROM access in the ISR 1614 movwf samplesecs_value ; to avoid EEPROM access in the ISR
1596 divemode_boot1: 1615 divemode_boot1:
1597 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active 1616 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
1598 bra divemode_boot2 1617 bra divemode_boot2
1618 btfsc FLAG_pscr_mode
1619 bra divemode_boot2
1620
1599 ; in OC Mode, disable ppO2 logging 1621 ; in OC Mode, disable ppO2 logging
1600 movlw .0 1622 movlw .0
1601 movwf divisor_ppo2_sensors 1623 movwf divisor_ppo2_sensors
1602 divemode_boot2: 1624 divemode_boot2:
1603 1625
1649 bra divemode_check_for_warnings2 1671 bra divemode_check_for_warnings2
1650 1672
1651 ; Warnings only in deco modes 1673 ; Warnings only in deco modes
1652 btfss FLAG_ccr_mode ; Don't check in CCR mode 1674 btfss FLAG_ccr_mode ; Don't check in CCR mode
1653 rcall check_ppO2 ; check ppO2 and displays warning, if required 1675 rcall check_ppO2 ; check ppO2 and displays warning, if required
1676 ; mH: PSCR handling missing here (Not critical but should be done...)
1677
1654 btfsc is_bailout ; But check in Bailout case... 1678 btfsc is_bailout ; But check in Bailout case...
1655 rcall check_ppO2 ; check ppO2 and displays warning, if required 1679 rcall check_ppO2 ; check ppO2 and displays warning, if required
1656 rcall check_cns_violation ; Check CNS value and display it, if required 1680 rcall check_cns_violation ; Check CNS value and display it, if required
1657 btfsc decostop_active ; In deco mode? 1681 btfsc decostop_active ; In deco mode?
1658 rcall check_and_store_gf_violation ; Yes, Sets warnings, if required 1682 rcall check_and_store_gf_violation ; Yes, Sets warnings, if required
1710 goto TFT_divetimeout ; Show timeout counter (and return) 1734 goto TFT_divetimeout ; Show timeout counter (and return)
1711 1735
1712 1736
1713 check_ppO2: ; check current ppO2 and display warning if required 1737 check_ppO2: ; check current ppO2 and display warning if required
1714 btfss FLAG_pscr_mode 1738 btfss FLAG_pscr_mode
1715 bra check_ppO2_non_pscr ; Non-PSCR modes... 1739 bra check_ppO2_non_pscr ; Non-PSCR modes...
1716 ; in PSCR mode 1740 ; in PSCR mode
1741 btfsc is_bailout
1742 bra check_ppO2_non_pscr ; Non-PSCR modes...
1743
1717 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 1744 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
1718 movff sub_c+0,xA+0 1745 movff sub_c+0,xA+0
1719 movff sub_c+1,xA+1 1746 movff sub_c+1,xA+1
1720 movlw d'100' 1747 movlw d'100'
1721 movwf xB+0 1748 movwf xB+0