Mercurial > public > hwos_code
comparison src/divemode.asm @ 526:0d1cda9f2d43
BUGFIX: Skip MOD Test for CCR in Sensor modes (OSTC cR and OSTC3 only)
CHANGE: Swap positions of ppO2(O2) and ppO2(Dil) in customview 10 on screen. "left = lean" and "right = rich"
BUGFIX: A wrong configured gas was suggested as "Better gas" on the configured depth even if this resulted in a ppO2 high or low condition
author | heinrichsweikamp |
---|---|
date | Sat, 05 Aug 2017 16:50:28 +0200 |
parents | 06e9370c6d75 |
children | 015b7fdd90a7 |
comparison
equal
deleted
inserted
replaced
525:00df86a5ac01 | 526:0d1cda9f2d43 |
---|---|
1270 incf hi,W ; 1-5 | 1270 incf hi,W ; 1-5 |
1271 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | 1271 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available |
1272 movlw better_gas_window_neg | 1272 movlw better_gas_window_neg |
1273 subwf lo,W ; Change depth-better_gas_window_neg | 1273 subwf lo,W ; Change depth-better_gas_window_neg |
1274 cpfslt xC+0 ; current depth<Change depth-better_gas_window_neg? | 1274 cpfslt xC+0 ; current depth<Change depth-better_gas_window_neg? |
1275 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1275 bra check_gas_common4 ; Ok, now check the better gas ppO2<opt_ppO2_max |
1276 return | 1276 return |
1277 | 1277 |
1278 check_gas_common3: | 1278 check_gas_common3: |
1279 incf hi,W ; 1-5 | 1279 incf hi,W ; 1-5 |
1280 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | 1280 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available |
1312 return ; Done. | 1312 return ; Done. |
1313 ; Check if ppO2>3,30bar | 1313 ; Check if ppO2>3,30bar |
1314 btfsc xC+1,7 | 1314 btfsc xC+1,7 |
1315 return ; Done. | 1315 return ; Done. |
1316 | 1316 |
1317 ; ; Check for low ppo2 | 1317 ; Check for low ppo2 |
1318 ; movff xC+0,sub_b+0 | |
1319 ; movff xC+1,sub_b+1 | |
1320 ; movff opt_ppO2_min,WREG | |
1321 ; mullw d'100' ; opt_ppO2_min*100 | |
1322 ; movff PRODL,sub_a+0 | |
1323 ; movff PRODH,sub_a+1 | |
1324 ; call subU16 | |
1325 ; btfss neg_flag | |
1326 ; return ; Done (Too low). | |
1327 | |
1328 ;check if we are within our warning thresholds! | |
1329 movff xC+0,sub_b+0 | 1318 movff xC+0,sub_b+0 |
1330 movff xC+1,sub_b+1 | 1319 movff xC+1,sub_b+1 |
1331 movff opt_ppO2_max_deco,WREG ; PPO2 Max for MOD calculation and color coding in divemode | 1320 movff opt_ppO2_min,WREG |
1332 addlw .1 ; e.g. >1.60 | 1321 mullw d'100' ; opt_ppO2_min*100 |
1333 mullw d'100' ; opt_ppO2_max*100 | |
1334 movff PRODL,sub_a+0 | 1322 movff PRODL,sub_a+0 |
1335 movff PRODH,sub_a+1 | 1323 movff PRODH,sub_a+1 |
1336 call subU16 | 1324 call subU16 ; sub_c = sub_a - sub_b |
1337 btfss neg_flag | 1325 btfss neg_flag |
1326 return ; Done (Too low). | |
1327 | |
1328 ;check if we are within our warning thresholds! | |
1329 movff xC+0,sub_a+0 | |
1330 movff xC+1,sub_a+1 | |
1331 movff opt_ppO2_max_deco,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
1332 addlw .1 ; e.g. >1.60 | |
1333 mullw d'100' ; opt_ppO2_max*100 | |
1334 movff PRODL,sub_b+0 | |
1335 movff PRODH,sub_b+1 | |
1336 call subU16 ; sub_c = sub_a - sub_b | |
1337 btfsc neg_flag | |
1338 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1338 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1339 return ; Done. | 1339 return ; Done. |
1340 | 1340 |
1341 check_dil_common: ; With Dil 0-4 in WREG | 1341 check_dil_common: ; With Dil 0-4 in WREG |
1342 btfsc better_gas_available ; Better Diluent already found? | 1342 btfsc better_gas_available ; Better Diluent already found? |
1343 return ; Yes, return | 1343 return ; Yes, return |
1344 lfsr FSR1,opt_dil_type ; 0=Disabled, 1=First, 2=Normal | 1344 lfsr FSR1,opt_dil_type ; 0=Disabled, 1=First, 2=Normal |
1683 bra divemode_check_for_warnings2 | 1683 bra divemode_check_for_warnings2 |
1684 | 1684 |
1685 ; Warnings only in deco modes | 1685 ; Warnings only in deco modes |
1686 btfss FLAG_ccr_mode ; Don't check in CCR mode | 1686 btfss FLAG_ccr_mode ; Don't check in CCR mode |
1687 rcall check_ppO2 ; check ppO2 and displays warning, if required | 1687 rcall check_ppO2 ; check ppO2 and displays warning, if required |
1688 ; mH: PSCR handling missing here (Not critical but should be done...) | |
1689 | 1688 |
1690 btfsc is_bailout ; But check in Bailout case... | 1689 btfsc is_bailout ; But check in Bailout case... |
1691 rcall check_ppO2 ; check ppO2 and displays warning, if required | 1690 rcall check_ppO2 ; check ppO2 and displays warning, if required |
1692 rcall check_cns_violation ; Check CNS value and display it, if required | 1691 rcall check_cns_violation ; Check CNS value and display it, if required |
1693 btfsc decostop_active ; In deco mode? | 1692 btfsc decostop_active ; In deco mode? |