changeset 229:85ea09d3b9d8

Nofly should not be reset after dive simulation (bug BB18).
author JeanDo
date Tue, 15 Mar 2011 18:13:51 +0100
parents 6d4e29d80ff3
children 9406a5b0ba5e
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/interface.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_asm_part1/start.asm code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 8 files changed, 38 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Mar 15 18:13:51 2011 +0100
@@ -1,10 +1,10 @@
 New in 1.84 beta:
 BETA Version - Do NOT use for diving!
+BUGFIX: NoFly time should not be reseted after dive simulation.
 
 New in 1.83 beta:
 BETA Version - Do NOT use for diving!
 BUGFIX: gas switch
-BUGFIX: NoFly time
 NEW: De/Activate gases underwater (Gaslist -> More -> Actve?)
 NEW: Gas Consumption caluculation in offline simulator (After Decoplan)
 NEW: CF56 Bottom gas usage (l/min or bar/min) (For Simulator)
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -984,9 +984,10 @@
 	bra		calculate_noflytime2
 	tstfsz	xA+1			; Desat=0?
 	bra		calculate_noflytime2
+
+calculate_noflytime_3:	
 	; Desaturation time = zero
-	movlw	d'1'
-	movwf	nofly_time+0			; Clear nofly time
+	clrf	nofly_time+0			; Clear nofly time
 	clrf	nofly_time+1			; Clear nofly time
 	bcf		nofly_active			; Clear flag
 	return
@@ -1006,12 +1007,8 @@
 	bra		calculate_noflytime_2_final
 	tstfsz	xA+1			; Desat=0?
 	bra		calculate_noflytime_2_final
-	; noflytime = zero
-	movlw	d'1'
-	movwf	nofly_time+0			; Clear nofly time
-	clrf	nofly_time+1			; Clear nofly time
-	bcf		nofly_active			; Clear flag
-	return
+	bra     calculate_noflytime_3
+
 calculate_noflytime_2_final:
 	movff	xA+0,nofly_time+0
 	movff	xA+1,nofly_time+1
@@ -1035,21 +1032,20 @@
 	movff	last_surfpressure_30min+1,int_I_pres_respiration+1		; 30min old values 
 
 	GETCUSTOM8	d'12'				; Desaturation multiplier %
-	movwf	wait_temp
-	movff	wait_temp,char_I_desaturation_multiplier
+	movff	WREG,char_I_desaturation_multiplier
 
 	ostc_debug	'G'		; Sends debug-information to screen if debugmode active
 	call	deco_calc_desaturation_time	; calculate desaturation time
-	movlb	b'00000001'						; select ram bank 1
-	rcall	calculate_noflytime				; Calc NoFly time
-	ostc_debug	'H'		; Sends debug-information to screen if debugmode active
+	movlb	b'00000001'                 ; select ram bank 1
+	rcall	calculate_noflytime         ; Calc NoFly time
+	ostc_debug	'H'                     ; Sends debug-information to screen if debugmode active
 										; store header and ...
 	movlw	0xFD						; .... End-of-Profile Bytes
 	call	write_external_eeprom
 	movlw	0xFD
 	call	write_external_eeprom
 	movlw	0xFE						; This positon will be overwritten for the next profile
-	call	write_external_eeprom			; and is required to find the newest dive after a firmware reset
+	call	write_external_eeprom       ; and is required to find the newest dive after a firmware reset
 
 	movff	eeprom_header_address+0, eeprom_address+0	; set header adress
 	movff	eeprom_header_address+1, eeprom_address+1	; write header
@@ -1058,9 +1054,9 @@
 	call	write_external_eeprom
 	movlw	0xFA
 	call	write_external_eeprom
-	movlw	logbook_profile_version			; Defined in definitions_vxyy.asm
+	movlw	logbook_profile_version     ; Defined in definitions_vxyy.asm
 	call	write_external_eeprom
-	movf	month,W					; Date
+	movf	month,W                     ; Date
 	call	write_external_eeprom
 	movf	day,W
 	call	write_external_eeprom
--- a/code_part1/OSTC_code_asm_part1/interface.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/interface.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -48,8 +48,7 @@
 	call		deco_clear_CNS_fraction			; clear CNS
 	movlb		b'00000001'						; select ram bank 1
 
-	movlw		d'1'
-	movwf		nofly_time+0				; Clear nofly time
+	clrf		nofly_time+0				; Clear nofly time
 	clrf		nofly_time+1				; Clear nofly time
 
 	movlw		'h'							; send echo
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -370,8 +370,7 @@
 	write_int_eeprom	d'37'		; reset mix2 to ppO2=1.00Bar
 	write_int_eeprom	d'38'		; reset mix3 to ppO2=1.00Bar
 
-	movlw	d'1'
-	movwf	nofly_time+0			; Clear nofly time
+	clrf	nofly_time+0			; Clear nofly time
 	clrf	nofly_time+1			; Clear nofly time
 
 reset_all_cf_bank0:
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -1708,8 +1708,7 @@
 PLED_nofly_time:	
 	movff		nofly_time+0,lo			
 	movff		nofly_time+1,hi					; Copy
-	movlw		d'1'	
-	cpfseq		lo								; =1?
+	tstfsz		lo								; =0?
 	bra			PLED_nofly_time2				; No!
 	tstfsz		hi								; =0?
 	bra			PLED_nofly_time2				; No!
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -437,19 +437,22 @@
 	return
 
 simulator_restore_tissue_data:
-	bcf		restore_deco_data		; clear restore flag
-	ostc_debug	'S'							; Sends debug-information to screen if debugmode active
+	bcf		restore_deco_data           ; clear restore flag
+	ostc_debug	'S'                     ; Sends debug-information to screen if debugmode active
 	call	deco_pull_tissues_from_vault
 	movlb	0x01						; Back to RAM Bank1
-	ostc_debug	'T'							; Sends debug-information to screen if debugmode active
+	ostc_debug	'T'                     ; Sends debug-information to screen if debugmode active
 
 	ostc_debug	'G'		; Sends debug-information to screen if debugmode active
 	call	deco_calc_desaturation_time	; calculate desaturation time
-	movlb	b'00000001'						; select ram bank 1
-	call	calculate_noflytime				; Calc NoFly time
+	movlb	b'00000001'                 ; select ram bank 1
+	
+	; Note: should not reset nofly-time here: the true value have continued to be decremented
+	;       during simulation, which is the right thing to do...
 	ostc_debug	'H'		; Sends debug-information to screen if debugmode active
 
 	; Calculate CNS	
-	call	deco_calc_CNS_fraction		; calculate CNS
-	movlb	b'00000001'					; rambank 1 selected
+	call	deco_calc_CNS_fraction      ; calculate CNS
+	movlb	b'00000001'                 ; rambank 1 selected
+
 	return
--- a/code_part1/OSTC_code_asm_part1/start.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -41,11 +41,10 @@
 	call	disable_rs232			; disable UART module
 	call	RTCinit					; reset RTC
 
-; Extra power-up reset jDG jDG jDG jDG
+; Extra power-up reset (JeanDo)
 	ifdef	TESTING
 		call 	do_menu_reset_all2
 	endif
-; DONE jDG jDG jDG jDG
 
 ; Air pressure compensation	after reset
 	call	get_calibration_data	; Get calibration data from pressure sensor
@@ -72,7 +71,6 @@
 	movff	amb_pressure+1,last_surfpressure_30min+1	; Rests all airpressure registers
 
 ; reset deco data
-	incf	nofly_time+0,F					; =1
 	clrf	WREG                            ; Use as buffer
 	movff	WREG,char_I_He_ratio            ; No He at the Surface
 	movlw	d'79'							; 79% N2
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Sat Mar 05 10:09:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Tue Mar 15 18:13:51 2011 +0100
@@ -227,18 +227,20 @@
 	return
 
 nofly_timeout60:
-	bsf		nofly_active					; Set flag
+    movf    nofly_time+0,W              ; Is nofly null ?
+    iorwf   nofly_time+1,W
+    bnz     nofly_timeout60_1           ; No...
+    
+	bcf		nofly_active                ; Clear flag
+	bcf		LED_blue                    ; Clear led.
+	return
+
+nofly_timeout60_1:
+	bsf		nofly_active                ; Set flag
 	movlw	d'1'
 	subwf	nofly_time+0,F
 	movlw	d'0'
-	subwfb	nofly_time+1,F					; reduce by one
-	tstfsz	nofly_time+0					; =0?
-	return			
-	tstfsz	nofly_time+1					; =0?
-	return
-	bcf		nofly_active					; Clear flag
-	bcf		LED_blue
-	incf	nofly_time+0,F					; =1
+	subwfb	nofly_time+1,F              ; reduce by one
 	return
 
 calc_surface_interval: