changeset 132:ec0b1e829399

Bugfix: Start dive mode simulator in correct depth
author heinrichsweikamp
date Tue, 08 Jul 2014 11:39:00 +0200
parents 35b9da423de6
children 939f1e83c4c2
files src/changelog.txt src/ostc3.inc src/simulator.asm
diffstat 3 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/changelog.txt	Fri Jul 04 12:51:20 2014 +0200
+++ b/src/changelog.txt	Tue Jul 08 11:39:00 2014 +0200
@@ -2,6 +2,7 @@
 - Beta Version -
 NEW: Update warnings every second
 NEW: Show "Stop" in front of Safety Stop
+BUGFIX: Start dive mode simulator in correct depth
 
 New in 1.41:
 - Beta Version -
--- a/src/ostc3.inc	Fri Jul 04 12:51:20 2014 +0200
+++ b/src/ostc3.inc	Tue Jul 08 11:39:00 2014 +0200
@@ -121,7 +121,6 @@
 #DEFINE	depth_warn_mbar 		.13000	; [mbar]
 #DEFINE	wake_up_from_sleep		.1160	; [mbar]
 #DEFINE	gf_display_threshold	.20		; [%]
-#DEFINE	simulator_start_depth	.2500	; [mbar] + 1000mbar surface
 #DEFINE simulator_timeout       .15     ; [s]
 
 
--- a/src/simulator.asm	Fri Jul 04 12:51:20 2014 +0200
+++ b/src/simulator.asm	Tue Jul 08 11:39:00 2014 +0200
@@ -709,15 +709,18 @@
 		bra		$-2
 
 		bsf		simulatormode_active				; Set Flag
-		movlw	LOW			simulator_start_depth
-		movff	WREG,rel_pressure+0
-		movlw	HIGH		simulator_start_depth
-		movff	WREG,rel_pressure+1					; Set Depth
-
-		movlw	LOW			(simulator_start_depth+.1000)
-		movff	WREG,sim_pressure+0
-		movlw	HIGH		(simulator_start_depth+.1000)
-		movff	WREG,sim_pressure+1					; Set Depth
+        ; Compute dive ambient conditions
+        banksel char_I_bottom_depth
+        movf    char_I_bottom_depth,W
+        mullw   .100
+        movff   PRODL,rel_pressure+0
+        movff   PRODH,rel_pressure+1
+        movlw   LOW(.1000)
+        addwf   PRODL,W
+        movff   WREG,sim_pressure+0
+        movlw   HIGH(.1000)
+        addwfc  PRODH,W
+        movff   WREG,sim_pressure+1
 
 		bsf		divemode
 		goto	diveloop							; Switch into Divemode!