comparison 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
comparison
equal deleted inserted replaced
15:8185edeeedb2 16:7b06f20881be
1135 1135
1136 1136
1137 global TFT_surface_compass_heading 1137 global TFT_surface_compass_heading
1138 TFT_surface_compass_heading: 1138 TFT_surface_compass_heading:
1139 rcall compass_heading_common 1139 rcall compass_heading_common
1140 btfsc compass_fast_mode ; In fast mode?
1141 bra TFT_surface_compass_heading2 ; Yes
1142 ; No, update 1/second max.
1143 movff sensor_state_counter,lo
1144 movlw .6
1145 cpfsgt lo
1146 return
1147 TFT_surface_compass_heading2:
1140 WIN_STD surf_compass_head_column,surf_compass_head_row 1148 WIN_STD surf_compass_head_column,surf_compass_head_row
1141 call TFT_standard_color 1149 call TFT_standard_color
1142 lfsr FSR2,buffer 1150 lfsr FSR2,buffer
1151 ; movff sub_c+0,lo ; Show difference to old value
1152 ; output_8
1153 ; movlw "f" ; "Fast"
1154 ; btfss compass_fast_mode ; In fast mode?
1155 ; movlw "s" ; "Slow"
1156 ; movwf POSTINC2
1143 movff compass_heading+0,lo 1157 movff compass_heading+0,lo
1144 movff compass_heading+1,hi 1158 movff compass_heading+1,hi
1145 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1159 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1146 bsf leftbind 1160 bsf leftbind
1147 output_16 1161 output_16
1150 return 1164 return
1151 1165
1152 global TFT_dive_compass_heading 1166 global TFT_dive_compass_heading
1153 TFT_dive_compass_heading: 1167 TFT_dive_compass_heading:
1154 rcall compass_heading_common 1168 rcall compass_heading_common
1169 btfsc compass_fast_mode ; In fast mode?
1170 bra TFT_dive_compass_heading2 ; Yes
1171 ; No, update 1/second max.
1172 movff sensor_state_counter,lo
1173 movlw .6
1174 cpfsgt lo
1175 return
1176 TFT_dive_compass_heading2:
1155 WIN_STD dive_compass_head_column,dive_compass_head_row 1177 WIN_STD dive_compass_head_column,dive_compass_head_row
1156 call TFT_standard_color 1178 call TFT_standard_color
1157 lfsr FSR2,buffer 1179 lfsr FSR2,buffer
1158 movff compass_heading+0,lo 1180 movff compass_heading+0,lo
1159 movff compass_heading+1,hi 1181 movff compass_heading+1,hi
1174 rcall TFT_get_compass 1196 rcall TFT_get_compass
1175 rcall TFT_get_compass 1197 rcall TFT_get_compass
1176 rcall TFT_get_compass 1198 rcall TFT_get_compass
1177 call compass ; Do compass corrections. 1199 call compass ; Do compass corrections.
1178 banksel common 1200 banksel common
1201
1202 ; More then compass_fast_treshold?
1203 movff compass_heading_old+0,sub_a+0
1204 movff compass_heading_old+1,sub_a+1
1205 movff compass_heading+0,sub_b+0
1206 movff compass_heading+1,sub_b+1
1207 call sub16
1208 movff compass_heading+0,compass_heading_old+0 ; copy new "old"
1209 movff compass_heading+1,compass_heading_old+1
1210
1211 bcf compass_fast_mode
1212 movlw compass_fast_treshold
1213 cpfslt sub_c+0 ; > compass_fast_treshold?
1214 bsf compass_fast_mode ; Yes!
1179 return 1215 return
1180 1216
1181 TFT_get_compass: 1217 TFT_get_compass:
1182 call speed_normal 1218 call speed_normal
1183 call I2C_RX_compass ; Test Compass 1219 call I2C_RX_compass ; Test Compass