Is there any reason why MAGBUFFSIZEX is 14 instead of 12 as description?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Is there any reason why MAGBUFFSIZEX is 14 instead of 12 as description?

跳至解决方案
906 次查看
garyto
Contributor I

I was going through the fusion code and notice this in the magnetic.h file, line32-33

// magnetic calibration constants
#define MAGBUFFSIZEX 14                    // x dimension in magnetometer buffer (12x24 equals 288 elements)
#define MAGBUFFSIZEY (2 * MAGBUFFSIZEX)    // y dimension in magnetometer buffer (12x24 equals 288 elements)

The MAGBUFFSIZEX is set to 14 instead of 12 as described in the annotation. This affects the tanarray calculation in magnetic.c, line 61-68,

// initialize the array of (MAGBUFFSIZEX - 1) elements of 100 * tangents used for buffer indexing
    // entries cover the range 100 * tan(-PI/2 + PI/MAGBUFFSIZEX), 100 * tan(-PI/2 + 2*PI/MAGBUFFSIZEX) to
    // 100 * tan(-PI/2 + (MAGBUFFSIZEX - 1) * PI/MAGBUFFSIZEX).
    // for MAGBUFFSIZEX=12, the entries range in value from -373 to +373
    for (j = 0; j < (MAGBUFFSIZEX - 1); j++)
    {
        pthisMagBuffer->tanarray[j] = (int16) (100.0F * tanf(PI * (-0.5F + (float) (j + 1) / MAGBUFFSIZEX)));
    }

the tanarray will go from -438 to 438 instead of -373 to 373.

标签 (1)
0 项奖励
回复
1 解答
614 次查看
michaelestanley
NXP Employee
NXP Employee

No reason.  The comments are just out of date.

在原帖中查看解决方案

0 项奖励
回复
1 回复
615 次查看
michaelestanley
NXP Employee
NXP Employee

No reason.  The comments are just out of date.

0 项奖励
回复