From 880b7418fd4cf3461901cb83529d3260aa32d6f7 Mon Sep 17 00:00:00 2001 From: "timecop@gmail.com" Date: Sun, 7 Apr 2013 09:24:31 +0000 Subject: [PATCH] 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 --- src/cli.c | 2 +- src/mw.c | 11 +++++------ src/telemetry.c | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/cli.c b/src/cli.c index d8aa3f0b5..d0d28df0f 100644 --- a/src/cli.c +++ b/src/cli.c @@ -44,7 +44,7 @@ const char * const mixerNames[] = { const char * const featureNames[] = { "PPM", "VBAT", "INFLIGHT_ACC_CAL", "SPEKTRUM", "MOTOR_STOP", "SERVO_TILT", "GYRO_SMOOTHING", "LED_RING", "GPS", - "FAILSAFE", "SONAR", "TELEMETRY", "VARIO", + "FAILSAFE", "SONAR", "TELEMETRY", "POWERMETER", "VARIO", NULL }; diff --git a/src/mw.c b/src/mw.c index 9156154a3..a2b172cf5 100755 --- a/src/mw.c +++ b/src/mw.c @@ -275,12 +275,13 @@ void loop(void) uint8_t stTmp = 0; uint8_t axis, i; int16_t error, errorAngle; - int16_t delta, deltaSum; 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 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 int16_t initialThrottleHold; static uint32_t loopTime; @@ -697,7 +698,7 @@ void loop(void) } } - // **** PITCH & ROLL & YAW PID **** + // **** PITCH & ROLL & YAW PID **** prop = max(abs(rcCommand[PITCH]), abs(rcCommand[ROLL])); // range [0;500] for (axis = 0; axis < 3; axis++) { if ((f.ANGLE_MODE || f.HORIZON_MODE) && axis < 2) { // MODE relying on ACC @@ -734,13 +735,11 @@ void loop(void) } 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 lastGyro[axis] = gyroData[axis]; deltaSum = delta1[axis] + delta2[axis] + delta; delta2[axis] = delta1[axis]; delta1[axis] = delta; - DTerm = ((int32_t)deltaSum * dynD8[axis]) >> 5; // 32 bits is needed for calculation axisPID[axis] = PTerm + ITerm - DTerm; } diff --git a/src/telemetry.c b/src/telemetry.c index 31be61c95..582ca6c89 100644 --- a/src/telemetry.c +++ b/src/telemetry.c @@ -95,9 +95,9 @@ static void sendAccel(void) static void sendBaro(void) { sendDataHead(ID_ALTITUDE_BP); - serialize16(EstAlt / 100); + serialize16(BaroAlt / 100); sendDataHead(ID_ALTITUDE_AP); - serialize16(EstAlt % 100); + serialize16(BaroAlt % 100); } static void sendTemperature1(void)