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

Remove unused vario feature and option. Move warning led code into

statusindicator.c/h
This commit is contained in:
Dominic Clifton 2014-06-01 17:20:01 +01:00
parent 4b437e8e08
commit fd0b7cdf80
7 changed files with 37 additions and 57 deletions

View file

@ -14,11 +14,10 @@ typedef enum {
FEATURE_SONAR = 1 << 10, FEATURE_SONAR = 1 << 10,
FEATURE_TELEMETRY = 1 << 11, FEATURE_TELEMETRY = 1 << 11,
FEATURE_CURRENT_METER = 1 << 12, FEATURE_CURRENT_METER = 1 << 12,
FEATURE_VARIO = 1 << 13, FEATURE_3D = 1 << 13,
FEATURE_3D = 1 << 14, FEATURE_RX_PARALLEL_PWM = 1 << 14,
FEATURE_RX_PARALLEL_PWM = 1 << 15, FEATURE_RX_MSP = 1 << 15,
FEATURE_RX_MSP = 1 << 16, FEATURE_RSSI_ADC = 1 << 16
FEATURE_RSSI_ADC = 1 << 17
} AvailableFeatures; } AvailableFeatures;
bool feature(uint32_t mask); bool feature(uint32_t mask);

View file

@ -5,7 +5,6 @@ enum {
BOXANGLE, BOXANGLE,
BOXHORIZON, BOXHORIZON,
BOXBARO, BOXBARO,
BOXVARIO,
BOXMAG, BOXMAG,
BOXHEADFREE, BOXHEADFREE,
BOXHEADADJ, BOXHEADADJ,
@ -45,7 +44,6 @@ typedef struct flags_t {
uint8_t GPS_FIX_HOME; uint8_t GPS_FIX_HOME;
uint8_t SMALL_ANGLE; uint8_t SMALL_ANGLE;
uint8_t CALIBRATE_MAG; 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 FIXED_WING; // set when in flying_wing or airplane mode. currently used by althold selection code
uint8_t AUTOTUNE_MODE; uint8_t AUTOTUNE_MODE;
} flags_t; } flags_t;

View file

@ -85,7 +85,7 @@ static const char * const mixerNames[] = {
static const char * const featureNames[] = { static const char * const featureNames[] = {
"RX_PPM", "VBAT", "INFLIGHT_ACC_CAL", "RX_SERIAL", "MOTOR_STOP", "RX_PPM", "VBAT", "INFLIGHT_ACC_CAL", "RX_SERIAL", "MOTOR_STOP",
"SERVO_TILT", "SOFTSERIAL", "LED_RING", "GPS", "FAILSAFE", "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 "RX_MSP", "RSSI_ADC", NULL
}; };

View file

@ -122,7 +122,7 @@ struct box_t {
{ BOXANGLE, "ANGLE;", 1 }, { BOXANGLE, "ANGLE;", 1 },
{ BOXHORIZON, "HORIZON;", 2 }, { BOXHORIZON, "HORIZON;", 2 },
{ BOXBARO, "BARO;", 3 }, { BOXBARO, "BARO;", 3 },
{ BOXVARIO, "VARIO;", 4 }, //{ BOXVARIO, "VARIO;", 4 },
{ BOXMAG, "MAG;", 5 }, { BOXMAG, "MAG;", 5 },
{ BOXHEADFREE, "HEADFREE;", 6 }, { BOXHEADFREE, "HEADFREE;", 6 },
{ BOXHEADADJ, "HEADADJ;", 7 }, { BOXHEADADJ, "HEADADJ;", 7 },
@ -337,8 +337,6 @@ void mspInit(serialConfig_t *serialConfig)
if (sensors(SENSOR_BARO)) { if (sensors(SENSOR_BARO)) {
availableBoxes[idx++] = BOXBARO; availableBoxes[idx++] = BOXBARO;
if (feature(FEATURE_VARIO))
availableBoxes[idx++] = BOXVARIO;
} }
if (sensors(SENSOR_ACC) || sensors(SENSOR_MAG)) { if (sensors(SENSOR_ACC) || sensors(SENSOR_MAG)) {
@ -511,7 +509,6 @@ static void evaluateCommand(void)
rcOptions[BOXBEEPERON] << BOXBEEPERON | rcOptions[BOXBEEPERON] << BOXBEEPERON |
rcOptions[BOXLEDMAX] << BOXLEDMAX | rcOptions[BOXLEDMAX] << BOXLEDMAX |
rcOptions[BOXLLIGHTS] << BOXLLIGHTS | rcOptions[BOXLLIGHTS] << BOXLLIGHTS |
rcOptions[BOXVARIO] << BOXVARIO |
rcOptions[BOXCALIB] << BOXCALIB | rcOptions[BOXCALIB] << BOXCALIB |
rcOptions[BOXGOV] << BOXGOV | rcOptions[BOXGOV] << BOXGOV |
rcOptions[BOXOSD] << BOXOSD | rcOptions[BOXOSD] << BOXOSD |

View file

@ -25,3 +25,30 @@ void blinkLedAndSoundBeeper(uint8_t num, uint8_t wait, uint8_t repeat)
delay(60); 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;
}
}

View file

@ -1,3 +1,7 @@
#pragma once #pragma once
void blinkLedAndSoundBeeper(uint8_t num, uint8_t wait, uint8_t repeat); void blinkLedAndSoundBeeper(uint8_t num, uint8_t wait, uint8_t repeat);
void enableWarningLed(uint32_t currentTime);
void disableWarningLed(void);
void updateWarningLed(uint32_t currentTime);

View file

@ -127,32 +127,6 @@ bool isCalibrating()
return (!isAccelerationCalibrationComplete() && sensors(SENSOR_ACC)) || (!isGyroCalibrationComplete()); 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) void annexCode(void)
{ {
int32_t tmp, tmp2; int32_t tmp, tmp2;
@ -317,12 +291,6 @@ void mwArm(void)
} }
} }
static void mwVario(void)
{
}
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
@ -547,16 +515,6 @@ void loop(void)
} else { } else {
f.BARO_MODE = 0; 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 #endif
@ -633,9 +591,6 @@ void loop(void)
Sonar_update(); Sonar_update();
} }
#endif #endif
if (feature(FEATURE_VARIO) && f.VARIO_MODE)
mwVario();
break;
} }
} }