changeset 218:f4b79292e31f

BUGFIX NoFly time Bug in char-to-float promotion ???
author JeanDo
date Sat, 26 Feb 2011 17:53:43 +0100
parents ce6f16711567
children b6dd54b3567c
files code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 3 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Thu Feb 24 23:22:32 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sat Feb 26 17:53:43 2011 +0100
@@ -978,13 +978,12 @@
 	clrf	nofly_time+1			; Clear nofly time
 	bcf		nofly_active			; Clear flag
 	return
-	
+
 calculate_noflytime2:	
 	movff	xA+0,int_I_temp+0
 	movff	xA+1,int_I_temp+1
 	GETCUSTOM8 	.13					; nofly_time_ratio
-	movwf	xB+0
-	movff	xB,char_I_temp
+	movff	WREG,char_I_temp
 	ostc_debug	'K'		; Sends debug-information to screen if debugmode active
 	call	deco_calc_percentage
 	movlb	b'00000001'				; select ram bank 1
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Thu Feb 24 23:22:32 2011 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sat Feb 26 17:53:43 2011 +0100
@@ -2169,7 +2169,7 @@
 void deco_calc_percentage(void)
 {
     RESET_C_STACK
-    int_I_temp = (short)(int_I_temp * (char_I_temp / 100.0));
+    int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) / 100.0);
 }
 
 //////////////////////////////////////////////////////////////////////////////
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed