diff code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 382:f2d5d93b4ca3 64kByte Logbook

negative temperature in logbook and battery info menu
author heinrichsweikamp
date Wed, 15 Jun 2011 20:08:30 +0200
parents 61742b3ef842
children deced1cacff7
line wrap: on
line diff
--- 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