Mercurial > public > hwos_code
diff src/tft_outputs.asm @ 16:7b06f20881be
calm compass reading for minor heading changes
author | heinrichsweikamp |
---|---|
date | Sun, 16 Jun 2013 19:14:16 +0200 |
parents | 2af021c66b0d |
children | f51caad821b4 |
line wrap: on
line diff
--- a/src/tft_outputs.asm Wed Jun 12 18:15:38 2013 +0200 +++ b/src/tft_outputs.asm Sun Jun 16 19:14:16 2013 +0200 @@ -1137,9 +1137,23 @@ global TFT_surface_compass_heading TFT_surface_compass_heading: rcall compass_heading_common + btfsc compass_fast_mode ; In fast mode? + bra TFT_surface_compass_heading2 ; Yes + ; No, update 1/second max. + movff sensor_state_counter,lo + movlw .6 + cpfsgt lo + return +TFT_surface_compass_heading2: WIN_STD surf_compass_head_column,surf_compass_head_row call TFT_standard_color lfsr FSR2,buffer +; movff sub_c+0,lo ; Show difference to old value +; output_8 +; movlw "f" ; "Fast" +; btfss compass_fast_mode ; In fast mode? +; movlw "s" ; "Slow" +; movwf POSTINC2 movff compass_heading+0,lo movff compass_heading+1,hi call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required @@ -1152,6 +1166,14 @@ global TFT_dive_compass_heading TFT_dive_compass_heading: rcall compass_heading_common + btfsc compass_fast_mode ; In fast mode? + bra TFT_dive_compass_heading2 ; Yes + ; No, update 1/second max. + movff sensor_state_counter,lo + movlw .6 + cpfsgt lo + return +TFT_dive_compass_heading2: WIN_STD dive_compass_head_column,dive_compass_head_row call TFT_standard_color lfsr FSR2,buffer @@ -1176,6 +1198,20 @@ rcall TFT_get_compass call compass ; Do compass corrections. banksel common + + ; More then compass_fast_treshold? + movff compass_heading_old+0,sub_a+0 + movff compass_heading_old+1,sub_a+1 + movff compass_heading+0,sub_b+0 + movff compass_heading+1,sub_b+1 + call sub16 + movff compass_heading+0,compass_heading_old+0 ; copy new "old" + movff compass_heading+1,compass_heading_old+1 + + bcf compass_fast_mode + movlw compass_fast_treshold + cpfslt sub_c+0 ; > compass_fast_treshold? + bsf compass_fast_mode ; Yes! return TFT_get_compass: