comparison src/compass_ops.asm @ 574:b8f45b57302d

language, compass and color update
author heinrichsweikamp
date Wed, 14 Feb 2018 16:27:54 +0100
parents b7eb98dbd800
children b455b31ce022
comparison
equal deleted inserted replaced
573:cf4395595d9b 574:b8f45b57302d
217 217
218 banksel common 218 banksel common
219 call I2C_init_accelerometer 219 call I2C_init_accelerometer
220 call I2C_init_compass 220 call I2C_init_compass
221 221
222 btfsc compass_type ; compass1? 222 ; btfsc compass_type ; compass1?
223 bra compass_calibration_loop1 ; Yes, skip gain stuff 223 ; bra compass_calibration_loop1 ; Yes, skip gain stuff
224 224
225 ; rcall TFT_compass_show_gain ; Show the current compass gain 225 rcall TFT_compass_show_gain ; Show the current compass gain
226 226
227 WAITMS d'100' 227 WAITMS d'250'
228 WAITMS d'250' ; Wait for first reading...
228 229
229 clrf timeout_counter2 230 clrf timeout_counter2
230 clrf timeout_counter3 231 clrf timeout_counter3
231 232
232 call speed_fastest 233 call speed_fastest
274 call I2C_RX_compass ; read compass 275 call I2C_RX_compass ; read compass
275 call I2C_RX_accelerometer ; Test Accelerometer 276 call I2C_RX_accelerometer ; Test Accelerometer
276 rcall compass_filter ; Filter compass raw data 277 rcall compass_filter ; Filter compass raw data
277 banksel common 278 banksel common
278 279
279 btfsc compass_type ; compass1? 280 ; btfsc compass_type ; compass1?
280 bra compass_calibration_loop3 ; Yes, skip gain stuff 281 ; bra compass_calibration_loop3 ; Yes, skip gain stuff
281 282
282 ; Test all axes for +4096 (Hi byte=16) 283 ; Test all axes for +4096 (Hi byte=16)
283 banksel compass_DX+1 284 banksel compass_DX+1
284 movlw .16 285 movlw .16
285 cpfseq compass_DX+1 286 cpfseq compass_DX+1
385 STRCAT_PRINT "s " 386 STRCAT_PRINT "s "
386 return 387 return
387 388
388 389
389 TFT_compass_show_gain: ; Show the current compass gain 390 TFT_compass_show_gain: ; Show the current compass gain
390 movff opt_compass_gain,lo ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) 391 ; movff opt_compass_gain,lo ; 0-7 (230LSB/Gauss to 1370LSB/Gaus)
391 tstfsz lo 392 ; tstfsz lo
392 return ; Do not show unless gain=0 393 ; return ; Do not show unless gain=0
393 WIN_TINY .20,.86 394 WIN_TINY .20,.86
394 STRCPY_TEXT tCompassGain 395 STRCPY_TEXT tCompassGain
395 movff opt_compass_gain,lo ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) 396 movff opt_compass_gain,lo ; 0-7 (230LSB/Gauss to 1370LSB/Gaus)
396 bsf leftbind 397 bsf leftbind
397 output_8 398 output_8
398 bcf leftbind 399 bcf leftbind
399 STRCAT_PRINT "!" 400 STRCAT_PRINT ""
400 return 401 return
401 402
402 TFT_surface_compass_bearing: 403 TFT_surface_compass_bearing:
403 WIN_SMALL surf_compass_bear_column,surf_compass_bear_row 404 WIN_SMALL surf_compass_bear_column,surf_compass_bear_row
404 movff compass_bearing+0,lo 405 movff compass_bearing+0,lo