Mercurial > public > mk2
changeset 132:49bb155ddfbf
Fix altimeter after simulator (zero divide -> 32767m)
author | JeanDo |
---|---|
date | Wed, 05 Jan 2011 00:14:44 +0100 |
parents | 03df42de03e1 |
children | 35567a646fe5 |
files | code_part1/OSTC_code_asm_part1/altimeter.asm |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/altimeter.asm Wed Jan 05 07:46:20 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/altimeter.asm Wed Jan 05 00:14:44 2011 +0100 @@ -24,6 +24,8 @@ ; 2010-12-28 : [jDG] Use MPLAB Math and C libraries for FP32 computations. ; 2011-01-02 : [jDG] Edit reference pressure by 0.25 mbar. ; +; Known bug: Simulator reset altitude and reference... + altimeter_calc: movlb HIGH(pressureAvg) @@ -44,9 +46,6 @@ clrf pressureSum+1 clrf pressureCount - clrf altitude+0 ; Mark as not computed yet. - clrf altitude+1 - movff amb_pressure+0,pressureAvg+0 ; And init first average. movff amb_pressure+1,pressureAvg+1 @@ -57,6 +56,8 @@ rlcf pressureAvg+1 decfsz WREG bra altimeter_reset_1 + + rcall compute_altitude movlb 1 ; Back to normal bank1. return @@ -210,6 +211,13 @@ ; altitude. ; altimeter_menu: + movff pressureRef+0,WREG ; Make sure it is initialized... + movff pressureRef+1,fA + iorwf fA + bnz altimeter_menu_1 ; Yes: skip reset... + rcall altimeter_reset + +altimeter_menu_1: call PLED_ClearScreen ; Menu header. call PLED_standard_color call PLED_topline_box