Mercurial > public > ostc4
comparison Small_CPU/Src/compass.c @ 104:22a1094545f3 kittz
Tested and alive.
author | Dmitry Romanov <kitt@bk.ru> |
---|---|
date | Mon, 24 Dec 2018 16:15:02 +0300 |
parents | 6a6116d7b5bb |
children | 14e4c83a7559 |
comparison
equal
deleted
inserted
replaced
103:f5d2f02dc73f | 104:22a1094545f3 |
---|---|
1851 tickstart = HAL_GetTick(); | 1851 tickstart = HAL_GetTick(); |
1852 // Eine Minute kalibrieren | 1852 // Eine Minute kalibrieren |
1853 while((ticks) < 60 * 1000) | 1853 while((ticks) < 60 * 1000) |
1854 { | 1854 { |
1855 compass_read(); | 1855 compass_read(); |
1856 | |
1857 acceleration_read(); | 1856 acceleration_read(); |
1858 compass_calc_roll_pitch_only(); | 1857 compass_calc_roll_pitch_only(); |
1859 | 1858 |
1860 if((hardwareCompass == HMC5883L) | 1859 if((hardwareCompass == HMC5883L) |
1861 &&((compass_DX_f == -4096) || | 1860 &&((compass_DX_f == -4096) || |
1871 //tickstart = HAL_GetTick(); | 1870 //tickstart = HAL_GetTick(); |
1872 continue; | 1871 continue; |
1873 } | 1872 } |
1874 | 1873 |
1875 copyCompassDataDuringCalibration(compass_DX_f,compass_DY_f,compass_DZ_f); | 1874 copyCompassDataDuringCalibration(compass_DX_f,compass_DY_f,compass_DZ_f); |
1876 compass_add_calibration(&g); | 1875 compass_add_calibration(&g); |
1877 HAL_Delay(1); | 1876 HAL_Delay(1); |
1878 lasttick = HAL_GetTick(); | 1877 lasttick = HAL_GetTick(); |
1879 if(lasttick == 0) | 1878 if(lasttick == 0) |
1880 { | 1879 { |
1881 tickstart = -ticks; | 1880 tickstart = -ticks; |
1882 } | 1881 } |
1882 HAL_Delay(1); | |
1883 ticks = lasttick - tickstart; | 1883 ticks = lasttick - tickstart; |
1884 } | 1884 } |
1885 | 1885 |
1886 compass_solve_calibration(&g); | 1886 compass_solve_calibration(&g); |
1887 | 1887 |
1888 tfull32 dataBlock[4]; | 1888 tfull32 dataBlock[4]; |
1889 dataBlock[0].Word16.low16 = compass_CX_f; | 1889 dataBlock[0].Word16.low16 = compass_CX_f; |