mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Fix for shipping MPU6050 versions (AFS=2 fix, only affected a couple sample boards with MPU6000-ES, MPU6050-EL now works).
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@156 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
18db641282
commit
b929f79b54
5 changed files with 1513 additions and 1495 deletions
|
@ -768,10 +768,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>36</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>70</TopLine>
|
<TopLine>415</TopLine>
|
||||||
<CurrentLine>98</CurrentLine>
|
<CurrentLine>428</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\cli.c</PathWithFileName>
|
<PathWithFileName>.\src\cli.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>cli.c</FilenameWithoutPath>
|
<FilenameWithoutPath>cli.c</FilenameWithoutPath>
|
||||||
|
@ -782,10 +782,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>18</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>152</TopLine>
|
<TopLine>1</TopLine>
|
||||||
<CurrentLine>165</CurrentLine>
|
<CurrentLine>1</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\config.c</PathWithFileName>
|
<PathWithFileName>.\src\config.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>config.c</FilenameWithoutPath>
|
<FilenameWithoutPath>config.c</FilenameWithoutPath>
|
||||||
|
@ -812,8 +812,8 @@
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>55</TopLine>
|
<TopLine>106</TopLine>
|
||||||
<CurrentLine>84</CurrentLine>
|
<CurrentLine>127</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\main.c</PathWithFileName>
|
<PathWithFileName>.\src\main.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||||
|
@ -838,10 +838,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>8</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>193</TopLine>
|
<TopLine>239</TopLine>
|
||||||
<CurrentLine>223</CurrentLine>
|
<CurrentLine>252</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\mw.c</PathWithFileName>
|
<PathWithFileName>.\src\mw.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>mw.c</FilenameWithoutPath>
|
<FilenameWithoutPath>mw.c</FilenameWithoutPath>
|
||||||
|
@ -894,10 +894,10 @@
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>16</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>240</TopLine>
|
<TopLine>252</TopLine>
|
||||||
<CurrentLine>240</CurrentLine>
|
<CurrentLine>252</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\mw.h</PathWithFileName>
|
<PathWithFileName>.\src\mw.h</PathWithFileName>
|
||||||
<FilenameWithoutPath>mw.h</FilenameWithoutPath>
|
<FilenameWithoutPath>mw.h</FilenameWithoutPath>
|
||||||
|
@ -922,10 +922,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>8</ColumnNumber>
|
<ColumnNumber>36</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>35</TopLine>
|
<TopLine>1</TopLine>
|
||||||
<CurrentLine>46</CurrentLine>
|
<CurrentLine>10</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\spektrum.c</PathWithFileName>
|
<PathWithFileName>.\src\spektrum.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>spektrum.c</FilenameWithoutPath>
|
<FilenameWithoutPath>spektrum.c</FilenameWithoutPath>
|
||||||
|
@ -936,10 +936,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>10</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>1</TopLine>
|
<TopLine>7</TopLine>
|
||||||
<CurrentLine>35</CurrentLine>
|
<CurrentLine>28</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\buzzer.c</PathWithFileName>
|
<PathWithFileName>.\src\buzzer.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>buzzer.c</FilenameWithoutPath>
|
<FilenameWithoutPath>buzzer.c</FilenameWithoutPath>
|
||||||
|
@ -957,10 +957,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>35</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>0</TopLine>
|
<TopLine>5</TopLine>
|
||||||
<CurrentLine>0</CurrentLine>
|
<CurrentLine>26</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\drv_adc.c</PathWithFileName>
|
<PathWithFileName>.\src\drv_adc.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>drv_adc.c</FilenameWithoutPath>
|
<FilenameWithoutPath>drv_adc.c</FilenameWithoutPath>
|
||||||
|
@ -1013,10 +1013,10 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>1</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>1</TopLine>
|
<TopLine>310</TopLine>
|
||||||
<CurrentLine>15</CurrentLine>
|
<CurrentLine>331</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\drv_i2c.c</PathWithFileName>
|
<PathWithFileName>.\src\drv_i2c.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>drv_i2c.c</FilenameWithoutPath>
|
<FilenameWithoutPath>drv_i2c.c</FilenameWithoutPath>
|
||||||
|
@ -1039,12 +1039,12 @@
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>20</FileNumber>
|
<FileNumber>20</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>1</TopLine>
|
<TopLine>1</TopLine>
|
||||||
<CurrentLine>1</CurrentLine>
|
<CurrentLine>12</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\drv_pwm.c</PathWithFileName>
|
<PathWithFileName>.\src\drv_pwm.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>drv_pwm.c</FilenameWithoutPath>
|
<FilenameWithoutPath>drv_pwm.c</FilenameWithoutPath>
|
||||||
|
@ -1057,8 +1057,8 @@
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>0</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>101</TopLine>
|
<TopLine>25</TopLine>
|
||||||
<CurrentLine>101</CurrentLine>
|
<CurrentLine>39</CurrentLine>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\src\drv_system.c</PathWithFileName>
|
<PathWithFileName>.\src\drv_system.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>drv_system.c</FilenameWithoutPath>
|
<FilenameWithoutPath>drv_system.c</FilenameWithoutPath>
|
||||||
|
@ -1125,7 +1125,7 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<Focus>0</Focus>
|
<Focus>0</Focus>
|
||||||
<ColumnNumber>0</ColumnNumber>
|
<ColumnNumber>16</ColumnNumber>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<TopLine>0</TopLine>
|
<TopLine>0</TopLine>
|
||||||
<CurrentLine>0</CurrentLine>
|
<CurrentLine>0</CurrentLine>
|
||||||
|
|
|
@ -165,8 +165,8 @@
|
||||||
:100A30004379636C652054696D653A2000000000BD
|
:100A30004379636C652054696D653A2000000000BD
|
||||||
:100A4000300100202C20493243204572726F7273AE
|
:100A4000300100202C20493243204572726F7273AE
|
||||||
:100A50003A2000004166726F333220434C492076C1
|
:100A50003A2000004166726F333220434C492076C1
|
||||||
:100A6000657273696F6E20322E30204D61792020BF
|
:100A6000657273696F6E20322E30204D61792031AE
|
||||||
:100A7000392032303132202F2031333A32383A3374
|
:100A7000372032303132202F2032333A34353A3079
|
||||||
:100A800033000000300200200D0A456E7465726963
|
:100A800033000000300200200D0A456E7465726963
|
||||||
:100A90006E6720434C49204D6F64652C207479703B
|
:100A90006E6720434C49204D6F64652C207479703B
|
||||||
:100AA000652027657869742720746F2072657475D6
|
:100AA000652027657869742720746F2072657475D6
|
||||||
|
@ -1413,7 +1413,7 @@
|
||||||
:105830002080BDF8020040BA6080BDF8040040BA84
|
:105830002080BDF8020040BA6080BDF8040040BA84
|
||||||
:10584000A0801CBD10B580226B216820FFF7EAF80C
|
:10584000A0801CBD10B580226B216820FFF7EAF80C
|
||||||
:105850000520FFF7FCFC002219216820FFF7E2F881
|
:105850000520FFF7FCFC002219216820FFF7E2F881
|
||||||
:1058600000221A216820FFF7DDF803226B2168204F
|
:1058600003226B216820FFF7DDF803221A2168204C
|
||||||
:10587000FFF7D8F818221B21BDE810406820FFF779
|
:10587000FFF7D8F818221B21BDE810406820FFF779
|
||||||
:10588000D1B8B0F90210B0F90020CB1701EB537179
|
:10588000D1B8B0F90210B0F90020CB1701EB537179
|
||||||
:10589000C91001805142CA1701EB5271C9104180F1
|
:10589000C91001805142CA1701EB5271C9104180F1
|
||||||
|
@ -1421,7 +1421,7 @@
|
||||||
:1058B0001CB504466B4606223B216820FFF7B8F86A
|
:1058B0001CB504466B4606223B216820FFF7B8F86A
|
||||||
:1058C000BDF8000040BA2080BDF8020040BA6080F8
|
:1058C000BDF8000040BA2080BDF8020040BA6080F8
|
||||||
:1058D000BDF8040040BAA0801CBD10B510221C21E8
|
:1058D000BDF8040040BAA0801CBD10B510221C21E8
|
||||||
:1058E0006820FFF79FF814494FF40070088010BD3E
|
:1058E0006820FFF79FF8144940F2FF30088010BD90
|
||||||
:1058F00038B504460D462320FFF7A9FC6B4601226C
|
:1058F00038B504460D462320FFF7A9FC6B4601226C
|
||||||
:1059000075216820FFF794F8002804D09DF8000066
|
:1059000075216820FFF794F8002804D09DF8000066
|
||||||
:10591000682801D0002038BD084820600848606031
|
:10591000682801D0002038BD084820600848606031
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -111,7 +111,8 @@
|
||||||
#define MPU_RA_WHO_AM_I 0x75
|
#define MPU_RA_WHO_AM_I 0x75
|
||||||
|
|
||||||
#define MPU6050_SMPLRT_DIV 0 //8000Hz
|
#define MPU6050_SMPLRT_DIV 0 //8000Hz
|
||||||
#define MPU6050_DLPF_CFG 0
|
// #define MPU6050_DLPF_CFG 0 // 256Hz
|
||||||
|
#define MPU6050_DLPF_CFG 3 // 42Hz
|
||||||
|
|
||||||
static void mpu6050AccInit(void);
|
static void mpu6050AccInit(void);
|
||||||
static void mpu6050AccRead(int16_t * accData);
|
static void mpu6050AccRead(int16_t * accData);
|
||||||
|
@ -164,7 +165,7 @@ static void mpu6050AccInit(void)
|
||||||
// note: something seems to be wrong in the spec here. With AFS=2 1G = 4096 but according to my measurement: 1G=2048 (and 2048/8 = 256)
|
// note: something seems to be wrong in the spec here. With AFS=2 1G = 4096 but according to my measurement: 1G=2048 (and 2048/8 = 256)
|
||||||
// confirmed here: http://www.multiwii.com/forum/viewtopic.php?f=8&t=1080&start=10#p7480
|
// confirmed here: http://www.multiwii.com/forum/viewtopic.php?f=8&t=1080&start=10#p7480
|
||||||
// seems to be not a problem on MPU6000 lol
|
// seems to be not a problem on MPU6000 lol
|
||||||
acc_1G = 512; // 1023;
|
acc_1G = 1023;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mpu6050AccRead(int16_t * accData)
|
static void mpu6050AccRead(int16_t * accData)
|
||||||
|
@ -199,8 +200,8 @@ static void mpu6050GyroInit(void)
|
||||||
i2cWrite(MPU6050_ADDRESS, 0x6B, 0x80); //PWR_MGMT_1 -- DEVICE_RESET 1
|
i2cWrite(MPU6050_ADDRESS, 0x6B, 0x80); //PWR_MGMT_1 -- DEVICE_RESET 1
|
||||||
delay(5);
|
delay(5);
|
||||||
i2cWrite(MPU6050_ADDRESS, 0x19, 0x00); //SMPLRT_DIV -- SMPLRT_DIV = 0 Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV)
|
i2cWrite(MPU6050_ADDRESS, 0x19, 0x00); //SMPLRT_DIV -- SMPLRT_DIV = 0 Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV)
|
||||||
i2cWrite(MPU6050_ADDRESS, 0x1A, MPU6050_DLPF_CFG); //CONFIG -- EXT_SYNC_SET 0 (disable input pin for data sync) ; default DLPF_CFG = 0 => ACC bandwidth = 260Hz GYRO bandwidth = 256Hz)
|
|
||||||
i2cWrite(MPU6050_ADDRESS, 0x6B, 0x03); //PWR_MGMT_1 -- SLEEP 0; CYCLE 0; TEMP_DIS 0; CLKSEL 3 (PLL with Z Gyro reference)
|
i2cWrite(MPU6050_ADDRESS, 0x6B, 0x03); //PWR_MGMT_1 -- SLEEP 0; CYCLE 0; TEMP_DIS 0; CLKSEL 3 (PLL with Z Gyro reference)
|
||||||
|
i2cWrite(MPU6050_ADDRESS, 0x1A, MPU6050_DLPF_CFG); //CONFIG -- EXT_SYNC_SET 0 (disable input pin for data sync) ; default DLPF_CFG = 0 => ACC bandwidth = 260Hz GYRO bandwidth = 256Hz)
|
||||||
i2cWrite(MPU6050_ADDRESS, 0x1B, 0x18); //GYRO_CONFIG -- FS_SEL = 3: Full scale set to 2000 deg/sec
|
i2cWrite(MPU6050_ADDRESS, 0x1B, 0x18); //GYRO_CONFIG -- FS_SEL = 3: Full scale set to 2000 deg/sec
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
16
src/mw.c
16
src/mw.c
|
@ -248,6 +248,11 @@ void computeRC(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
uint32_t trollTime = 0;
|
||||||
|
uint16_t cn = 0xffff, cx = 0x0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void loop(void)
|
void loop(void)
|
||||||
{
|
{
|
||||||
static uint8_t rcDelayCommand; // this indicates the number of time (multiple of RC measurement at 50Hz) the sticks must be maintained to run or switch off motors
|
static uint8_t rcDelayCommand; // this indicates the number of time (multiple of RC measurement at 50Hz) the sticks must be maintained to run or switch off motors
|
||||||
|
@ -603,4 +608,15 @@ void loop(void)
|
||||||
mixTable();
|
mixTable();
|
||||||
writeServos();
|
writeServos();
|
||||||
writeMotors();
|
writeMotors();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
while (micros() < trollTime + 2000);
|
||||||
|
LED0_TOGGLE;
|
||||||
|
{
|
||||||
|
if (cycleTime < cn)
|
||||||
|
cn = cycleTime;
|
||||||
|
if (cycleTime > cx)
|
||||||
|
cx = cycleTime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue