diff src/divemode.asm @ 274:9347893b74ce

BUGFIX: Fast Gas change near the ppO2 limit could cause switching to a non-available Gas #0
author heinrichsweikamp
date Tue, 05 May 2015 14:58:16 +0200
parents 5b4ef0b9090d
children 653a3ab08062
line wrap: on
line diff
--- a/src/divemode.asm	Mon May 04 12:56:07 2015 +0200
+++ b/src/divemode.asm	Tue May 05 14:58:16 2015 +0200
@@ -894,6 +894,10 @@
 gas_switched_common:
     bcf     divemode_gaschange      ; Clear flag
 
+    tstfsz  menupos                 ; menupos=0?
+    bra     $+4                     ; No
+    return                          ; Yes, do not switch gas (There is no Gas #0 !)
+
     decf    menupos,W               ; 1-5 -> 0-4
     btfss   FLAG_ccr_mode           ; Choose OC Gases
     rcall   setup_gas_registers     ; With WREG=Gas 0-4