changeset 382:f2d5d93b4ca3 64kByte Logbook

negative temperature in logbook and battery info menu
author heinrichsweikamp
date Wed, 15 Jun 2011 20:08:30 +0200
parents c7142538050c
children d7a70654d968
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/menu_battery.asm code_part1/OSTC_code_asm_part1/menu_logbook.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 4 files changed, 20 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Wed Jun 15 11:30:51 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Wed Jun 15 20:08:30 2011 +0200
@@ -8,6 +8,7 @@
 NEW: Allow -2:00 to +2:00 adjustement per day (CF48).
 NEW: 1/10/100 steps in CF menu
 NEW: 64kByte Logbook (Doubled capacity compared to 1.90)
+BUGFIX: Negative temperatures in logbook and battery information menu
 
 New in 1.90 Stable:
 Stable release
--- a/code_part1/OSTC_code_asm_part1/menu_battery.asm	Wed Jun 15 11:30:51 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm	Wed Jun 15 20:08:30 2011 +0200
@@ -96,6 +96,7 @@
 	movff	EEDATA,lo
 	read_int_eeprom	d'55'	; TEMP_min HIGH
 	movff	EEDATA,hi
+	call	PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	movlw	d'3'
 	movwf	ignore_digits
 	bsf		leftbind			; left orientated output
@@ -118,6 +119,7 @@
 	movff	EEDATA,lo
 	read_int_eeprom	d'60'	; TEMP_max HIGH
 	movff	EEDATA,hi
+	call	PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	movlw	d'3'
 	movwf	ignore_digits
 	bsf		leftbind			; left orientated output
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Wed Jun 15 11:30:51 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Wed Jun 15 20:08:30 2011 +0200
@@ -459,11 +459,12 @@
 	call		I2CREAD2	
 	movff		SSPBUF,lo
 	call		I2CREAD2	
-	movff		SSPBUF,hi
+	movff		SSPBUF,hi				; Read min. Temperature
+	call		PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	movlw		d'3'
 	movwf		ignore_digits
 	bsf			leftbind
-	output_16dp	d'2'						; temperature
+	output_16dp	d'2'					; temperature
 	STRCAT_PRINT "°C"                   ; Display 2nd row of details
 
 	WIN_TOP		.50
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Wed Jun 15 11:30:51 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Wed Jun 15 20:08:30 2011 +0200
@@ -865,6 +865,7 @@
 	WIN_TOP		.177
 	STRCPY  "temp:"
     SAFE_2BYTE_COPY temperature, lo
+	call	PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	output_16
 	call	word_processor
 
@@ -975,18 +976,7 @@
 	movff	last_temperature+1,hi
 	movff	last_temperature+0,lo
 	lfsr	FSR2,letter
-
-    btfss   hi,7                        ; Negative temperature ?
-    bra     PLED_temp_surfmode_1        ; No: continue
-
-	PUTC	'-'                         ; Display "-"
-
-    comf    hi                          ; Then, 16bit sign changes.
-    negf    lo
-    btfsc   STATUS,C
-    incf    hi
-
-PLED_temp_surfmode_1:
+	call	PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	movlw	d'3'
 	movwf	ignore_digits
 	bsf		leftbind			; left orientated output
@@ -1011,18 +1001,7 @@
 	movff	last_temperature+0,lo
 
 	lfsr	FSR2,letter
-
-    btfss   hi,7                        ; Negative temperature ?
-    bra     PLED_temp_divemode_1        ; No: continue
-
-	PUTC	'-'                         ; Display "-"
-
-    comf    hi                          ; Then, 16bit sign changes.
-    negf    lo
-    btfsc   STATUS,C
-    incf    hi
-
-PLED_temp_divemode_1:
+	call	PLED_convert_signed_temperature	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
 	movlw	d'3'
 	movwf	ignore_digits
 	bsf		leftbind			; left orientated output
@@ -1907,6 +1886,17 @@
 	movwf	wait_temp
 	bra		update_batt_voltage2a
 
+PLED_convert_signed_temperature:
+   	btfss   	hi,7                    ; Negative temperature ?
+    return								; No, return
+; Yes, negative temperature!
+	PUTC		'-'                     ; Display "-"
+    comf    	hi                      ; Then, 16bit sign changes.
+    negf    	lo
+    btfsc   	STATUS,C
+    incf    	hi
+	return								; and return
+
 PLED_convert_date:	; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
 	read_int_eeprom d'91'			; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
 	tstfsz	EEDATA