From fd0b7cdf8001bb2f175ac51013afc34155d9bdec Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Sun, 1 Jun 2014 17:20:01 +0100 Subject: [PATCH] Remove unused vario feature and option. Move warning led code into statusindicator.c/h --- src/main/config/config.h | 9 +++---- src/main/config/runtime_config.h | 2 -- src/main/io/serial_cli.c | 2 +- src/main/io/serial_msp.c | 5 +--- src/main/io/statusindicator.c | 27 +++++++++++++++++++ src/main/io/statusindicator.h | 4 +++ src/main/mw.c | 45 -------------------------------- 7 files changed, 37 insertions(+), 57 deletions(-) diff --git a/src/main/config/config.h b/src/main/config/config.h index 7692380c2a..61d33ad1bf 100644 --- a/src/main/config/config.h +++ b/src/main/config/config.h @@ -14,11 +14,10 @@ typedef enum { FEATURE_SONAR = 1 << 10, FEATURE_TELEMETRY = 1 << 11, FEATURE_CURRENT_METER = 1 << 12, - FEATURE_VARIO = 1 << 13, - FEATURE_3D = 1 << 14, - FEATURE_RX_PARALLEL_PWM = 1 << 15, - FEATURE_RX_MSP = 1 << 16, - FEATURE_RSSI_ADC = 1 << 17 + FEATURE_3D = 1 << 13, + FEATURE_RX_PARALLEL_PWM = 1 << 14, + FEATURE_RX_MSP = 1 << 15, + FEATURE_RSSI_ADC = 1 << 16 } AvailableFeatures; bool feature(uint32_t mask); diff --git a/src/main/config/runtime_config.h b/src/main/config/runtime_config.h index e64c8b5a35..5a0ee68b0b 100644 --- a/src/main/config/runtime_config.h +++ b/src/main/config/runtime_config.h @@ -5,7 +5,6 @@ enum { BOXANGLE, BOXHORIZON, BOXBARO, - BOXVARIO, BOXMAG, BOXHEADFREE, BOXHEADADJ, @@ -45,7 +44,6 @@ typedef struct flags_t { uint8_t GPS_FIX_HOME; uint8_t SMALL_ANGLE; uint8_t CALIBRATE_MAG; - uint8_t VARIO_MODE; uint8_t FIXED_WING; // set when in flying_wing or airplane mode. currently used by althold selection code uint8_t AUTOTUNE_MODE; } flags_t; diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index a28231b086..ac969c9248 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -85,7 +85,7 @@ static const char * const mixerNames[] = { static const char * const featureNames[] = { "RX_PPM", "VBAT", "INFLIGHT_ACC_CAL", "RX_SERIAL", "MOTOR_STOP", "SERVO_TILT", "SOFTSERIAL", "LED_RING", "GPS", "FAILSAFE", - "SONAR", "TELEMETRY", "CURRENT_METER", "VARIO", "3D", "RX_PARALLEL_PWM", + "SONAR", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM", "RX_MSP", "RSSI_ADC", NULL }; diff --git a/src/main/io/serial_msp.c b/src/main/io/serial_msp.c index 69ec9bc138..2143b51b25 100755 --- a/src/main/io/serial_msp.c +++ b/src/main/io/serial_msp.c @@ -122,7 +122,7 @@ struct box_t { { BOXANGLE, "ANGLE;", 1 }, { BOXHORIZON, "HORIZON;", 2 }, { BOXBARO, "BARO;", 3 }, - { BOXVARIO, "VARIO;", 4 }, + //{ BOXVARIO, "VARIO;", 4 }, { BOXMAG, "MAG;", 5 }, { BOXHEADFREE, "HEADFREE;", 6 }, { BOXHEADADJ, "HEADADJ;", 7 }, @@ -337,8 +337,6 @@ void mspInit(serialConfig_t *serialConfig) if (sensors(SENSOR_BARO)) { availableBoxes[idx++] = BOXBARO; - if (feature(FEATURE_VARIO)) - availableBoxes[idx++] = BOXVARIO; } if (sensors(SENSOR_ACC) || sensors(SENSOR_MAG)) { @@ -511,7 +509,6 @@ static void evaluateCommand(void) rcOptions[BOXBEEPERON] << BOXBEEPERON | rcOptions[BOXLEDMAX] << BOXLEDMAX | rcOptions[BOXLLIGHTS] << BOXLLIGHTS | - rcOptions[BOXVARIO] << BOXVARIO | rcOptions[BOXCALIB] << BOXCALIB | rcOptions[BOXGOV] << BOXGOV | rcOptions[BOXOSD] << BOXOSD | diff --git a/src/main/io/statusindicator.c b/src/main/io/statusindicator.c index 846c7be42c..7399c89d6b 100644 --- a/src/main/io/statusindicator.c +++ b/src/main/io/statusindicator.c @@ -25,3 +25,30 @@ void blinkLedAndSoundBeeper(uint8_t num, uint8_t wait, uint8_t repeat) delay(60); } } + + +static uint32_t warningLedTimer = 0; + +void enableWarningLed(uint32_t currentTime) +{ + if (warningLedTimer != 0) { + return; // already enabled + } + warningLedTimer = currentTime + 500000; + LED0_ON; +} + +void disableWarningLed(void) +{ + warningLedTimer = 0; + LED0_OFF; +} + +void updateWarningLed(uint32_t currentTime) +{ + if (warningLedTimer && (int32_t)(currentTime - warningLedTimer) >= 0) { + LED0_TOGGLE; + warningLedTimer = warningLedTimer + 500000; + } +} + diff --git a/src/main/io/statusindicator.h b/src/main/io/statusindicator.h index 159ed71041..94295e332e 100644 --- a/src/main/io/statusindicator.h +++ b/src/main/io/statusindicator.h @@ -1,3 +1,7 @@ #pragma once void blinkLedAndSoundBeeper(uint8_t num, uint8_t wait, uint8_t repeat); + +void enableWarningLed(uint32_t currentTime); +void disableWarningLed(void); +void updateWarningLed(uint32_t currentTime); diff --git a/src/main/mw.c b/src/main/mw.c index d2b269d96b..ebe6145a41 100755 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -127,32 +127,6 @@ bool isCalibrating() return (!isAccelerationCalibrationComplete() && sensors(SENSOR_ACC)) || (!isGyroCalibrationComplete()); } -static uint32_t warningLedTimer = 0; - -void enableWarningLed(uint32_t currentTime) -{ - if (warningLedTimer != 0) { - return; // already enabled - } - warningLedTimer = currentTime + 500000; - LED0_ON; -} - -void disableWarningLed(void) -{ - warningLedTimer = 0; - LED0_OFF; -} - -void updateWarningLed(uint32_t currentTime) -{ - if (warningLedTimer && (int32_t)(currentTime - warningLedTimer) >= 0) { - LED0_TOGGLE; - warningLedTimer = warningLedTimer + 500000; - } -} - - void annexCode(void) { int32_t tmp, tmp2; @@ -317,12 +291,6 @@ void mwArm(void) } } - -static void mwVario(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 @@ -547,16 +515,6 @@ void loop(void) } else { f.BARO_MODE = 0; } - // Vario signalling activate - if (feature(FEATURE_VARIO)) { - if (rcOptions[BOXVARIO]) { - if (!f.VARIO_MODE) { - f.VARIO_MODE = 1; - } - } else { - f.VARIO_MODE = 0; - } - } } #endif @@ -633,9 +591,6 @@ void loop(void) Sonar_update(); } #endif - if (feature(FEATURE_VARIO) && f.VARIO_MODE) - mwVario(); - break; } }