1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00

fixed bug with telemetry/powermeter labels in CLI - wasn't synced with enum properly.

baro altitude telemetry fix.


git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@301 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2013-04-07 09:24:31 +00:00
parent 98d0581ac2
commit 880b7418fd
3 changed files with 8 additions and 9 deletions

View file

@ -44,7 +44,7 @@ const char * const mixerNames[] = {
const char * const featureNames[] = { const char * const featureNames[] = {
"PPM", "VBAT", "INFLIGHT_ACC_CAL", "SPEKTRUM", "MOTOR_STOP", "PPM", "VBAT", "INFLIGHT_ACC_CAL", "SPEKTRUM", "MOTOR_STOP",
"SERVO_TILT", "GYRO_SMOOTHING", "LED_RING", "GPS", "SERVO_TILT", "GYRO_SMOOTHING", "LED_RING", "GPS",
"FAILSAFE", "SONAR", "TELEMETRY", "VARIO", "FAILSAFE", "SONAR", "TELEMETRY", "POWERMETER", "VARIO",
NULL NULL
}; };

View file

@ -275,12 +275,13 @@ void loop(void)
uint8_t stTmp = 0; uint8_t stTmp = 0;
uint8_t axis, i; uint8_t axis, i;
int16_t error, errorAngle; int16_t error, errorAngle;
int16_t delta, deltaSum;
int16_t PTerm, ITerm, PTermACC, ITermACC = 0, PTermGYRO = 0, ITermGYRO = 0, DTerm; int16_t PTerm, ITerm, PTermACC, ITermACC = 0, PTermGYRO = 0, ITermGYRO = 0, DTerm;
static int16_t lastGyro[3] = { 0, 0, 0 };
static int16_t delta1[3], delta2[3];
static int16_t errorGyroI[3] = { 0, 0, 0 }; static int16_t errorGyroI[3] = { 0, 0, 0 };
static int16_t errorAngleI[2] = { 0, 0 }; static int16_t errorAngleI[2] = { 0, 0 };
int16_t delta;
static int16_t lastGyro[3] = { 0, 0, 0 };
static int16_t delta1[3], delta2[3];
int16_t deltaSum;
static uint32_t rcTime = 0; static uint32_t rcTime = 0;
static int16_t initialThrottleHold; static int16_t initialThrottleHold;
static uint32_t loopTime; static uint32_t loopTime;
@ -734,13 +735,11 @@ void loop(void)
} }
PTerm -= (int32_t)gyroData[axis] * dynP8[axis] / 10 / 8; // 32 bits is needed for calculation PTerm -= (int32_t)gyroData[axis] * dynP8[axis] / 10 / 8; // 32 bits is needed for calculation
delta = gyroData[axis] - lastGyro[axis]; // 16 bits is ok here, the dif between 2 consecutive gyro reads is limited to 800 delta = gyroData[axis] - lastGyro[axis]; // 16 bits is ok here, the dif between 2 consecutive gyro reads is limited to 800
lastGyro[axis] = gyroData[axis]; lastGyro[axis] = gyroData[axis];
deltaSum = delta1[axis] + delta2[axis] + delta; deltaSum = delta1[axis] + delta2[axis] + delta;
delta2[axis] = delta1[axis]; delta2[axis] = delta1[axis];
delta1[axis] = delta; delta1[axis] = delta;
DTerm = ((int32_t)deltaSum * dynD8[axis]) >> 5; // 32 bits is needed for calculation DTerm = ((int32_t)deltaSum * dynD8[axis]) >> 5; // 32 bits is needed for calculation
axisPID[axis] = PTerm + ITerm - DTerm; axisPID[axis] = PTerm + ITerm - DTerm;
} }

View file

@ -95,9 +95,9 @@ static void sendAccel(void)
static void sendBaro(void) static void sendBaro(void)
{ {
sendDataHead(ID_ALTITUDE_BP); sendDataHead(ID_ALTITUDE_BP);
serialize16(EstAlt / 100); serialize16(BaroAlt / 100);
sendDataHead(ID_ALTITUDE_AP); sendDataHead(ID_ALTITUDE_AP);
serialize16(EstAlt % 100); serialize16(BaroAlt % 100);
} }
static void sendTemperature1(void) static void sendTemperature1(void)