comparison src/compass_ops.asm @ 646:5b7fe7777425

3.16 release
author heinrichs weikamp
date Thu, 14 Oct 2021 12:03:24 +0200
parents 4050675965ea
children 357341239438
comparison
equal deleted inserted replaced
642:a9a0188091e4 646:5b7fe7777425
233 WAITMS d'255' 233 WAITMS d'255'
234 WAITMS d'255' 234 WAITMS d'255'
235 235
236 call request_speed_fastest ; request CPU speed change to fastest speed 236 call request_speed_fastest ; request CPU speed change to fastest speed
237 237
238 movlw .7 ; initialize gain 238 movlw .5 ; initialize gain
239 movff WREG,opt_compass_gain ; ... 239 movff WREG,opt_compass_gain ; ...
240 240
241 movlw .60 ; initialize timeout to 60 seconds 241 movlw .60 ; initialize timeout to 60 seconds
242 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload 242 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload
243 bsf restart_timeout ; request ISR to restart the timeout 243 bsf restart_timeout ; request ISR to restart the timeout
311 call compass_filter ; filter compass raw data 311 call compass_filter ; filter compass raw data
312 312
313 ; btfsc compass_type1 ; compass1? 313 ; btfsc compass_type1 ; compass1?
314 ; bra compass_calibration_loop3 ; YES - skip gain stuff 314 ; bra compass_calibration_loop3 ; YES - skip gain stuff
315 315
316 banksel opt_compass_gain ; select bank options table
317 tstfsz opt_compass_gain ; =0?
318 bra $+4 ; No
319 bra compass_calibration_loop3 ; YES - skip gain stuff
316 ; Test all axes for +4096 (Hi byte=16) 320 ; Test all axes for +4096 (Hi byte=16)
317 banksel compass_DX ; select bank common2 321 banksel compass_DX ; select bank common2
318 movlw .16 322 movlw .16
319 cpfseq compass_DX+1 323 cpfseq compass_DX+1
320 bra $+4 324 bra $+4
335 bra $+4 339 bra $+4
336 bra compass_calibration_gainset 340 bra compass_calibration_gainset
337 cpfseq compass_DZ+1 341 cpfseq compass_DZ+1
338 bra $+4 342 bra $+4
339 bra compass_calibration_gainset 343 bra compass_calibration_gainset
344
345 compass_calibration_loop3:
340 banksel common ; back to bank common 346 banksel common ; back to bank common
341
342 ; ; Three
343 ; call I2C_RX_compass ; read compass
344 ; call I2C_RX_accelerometer ; test accelerometer
345 ; call compass_filter ; filter compass raw data
346 ;
347 ; ; Four times to get cleaner values
348 ; call I2C_RX_compass ; read compass
349 ; call I2C_RX_accelerometer ; test accelerometer
350 ; call compass_filter ; filter compass raw data
351
352 compass_calibration_loop3:
353 ; and register only one value out of four: 347 ; and register only one value out of four:
354 call compass_add_calibration ; check and store new max/min values (C-code) 348 call compass_add_calibration ; check and store new max/min values (C-code)
355 banksel common ; back to bank common 349 banksel common ; back to bank common
356 350
357 rcall TFT_compass_fast ; show values 351 rcall TFT_compass_fast ; show values