Beep when adjustments are made. (very short = adjust downwards, short =
adjust upwards).
This commit is contained in:
parent
a92b148557
commit
b2db6b3b80
|
@ -34,11 +34,10 @@
|
|||
|
||||
#include "io/beeper.h"
|
||||
|
||||
#define DOUBLE_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS * 2)
|
||||
#define LONG_PAUSE_DURATION_MILLIS 200
|
||||
#define DOUBLE_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS * 2)
|
||||
#define SHORT_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS / 4)
|
||||
#define MEDIUM_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS / 2)
|
||||
|
||||
#define SHORT_CONFIRMATION_BEEP_DURATION_MILLIS (SHORT_PAUSE_DURATION_MILLIS / 2)
|
||||
|
||||
static uint8_t beeperIsOn = 0, beepDone = 0;
|
||||
|
@ -123,7 +122,7 @@ void beepcodeUpdateState(bool warn_vbat)
|
|||
else if (FLIGHT_MODE(AUTOTUNE_MODE))
|
||||
beep_code('S','M','S','M');
|
||||
else if (toggleBeep > 0)
|
||||
beep(50); // fast confirmation beep
|
||||
beep(SHORT_CONFIRMATION_BEEP_DURATION_MILLIS); // fast confirmation beep
|
||||
else {
|
||||
beeperIsOn = 0;
|
||||
BEEP_OFF;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "sensors/acceleration.h"
|
||||
|
||||
#include "io/gps.h"
|
||||
#include "io/beeper.h"
|
||||
#include "mw.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
@ -294,6 +295,11 @@ void configureAdjustment(uint8_t index, uint8_t auxChannelIndex, const adjustmen
|
|||
void applyAdjustment(controlRateConfig_t *controlRateConfig, uint8_t adjustmentFunction, int delta) {
|
||||
int newValue;
|
||||
|
||||
if (delta > 0) {
|
||||
queueConfirmationBeep(2);
|
||||
} else {
|
||||
queueConfirmationBeep(1);
|
||||
}
|
||||
switch(adjustmentFunction) {
|
||||
case ADJUSTMENT_RC_RATE:
|
||||
newValue = (int)controlRateConfig->rcRate8 + delta;
|
||||
|
|
|
@ -333,9 +333,9 @@ void handleInflightCalibrationStickPosition(void)
|
|||
} else {
|
||||
AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
|
||||
if (AccInflightCalibrationArmed) {
|
||||
queueConfirmationBeep(2);
|
||||
queueConfirmationBeep(4);
|
||||
} else {
|
||||
queueConfirmationBeep(3);
|
||||
queueConfirmationBeep(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ void performInflightAccelerationCalibration(rollAndPitchTrims_t *rollAndPitchTri
|
|||
if (InflightcalibratingA == 1) {
|
||||
AccInflightCalibrationActive = false;
|
||||
AccInflightCalibrationMeasurementDone = true;
|
||||
queueConfirmationBeep(2); // beeper to indicating the end of calibration
|
||||
queueConfirmationBeep(5); // beeper to indicating the end of calibration
|
||||
// recover saved values to maintain current flight behaviour until new values are transferred
|
||||
accelerationTrims->raw[FD_ROLL] = accZero_saved[FD_ROLL];
|
||||
accelerationTrims->raw[FD_PITCH] = accZero_saved[FD_PITCH];
|
||||
|
|
|
@ -158,7 +158,8 @@ TEST(RcControlsTest, updateActivatedModesUsingValidAuxConfigurationAndRXValues)
|
|||
}
|
||||
|
||||
enum {
|
||||
COUNTER_GENERATE_PITCH_ROLL_CURVE = 0
|
||||
COUNTER_GENERATE_PITCH_ROLL_CURVE = 0,
|
||||
COUNTER_QUEUE_CONFIRMATION_BEEP
|
||||
};
|
||||
#define CALL_COUNT_ITEM_COUNT 1
|
||||
|
||||
|
@ -170,6 +171,9 @@ void generatePitchRollCurve(controlRateConfig_t *) {
|
|||
callCounts[COUNTER_GENERATE_PITCH_ROLL_CURVE]++;
|
||||
}
|
||||
|
||||
void queueConfirmationBeep(uint8_t) {
|
||||
callCounts[COUNTER_QUEUE_CONFIRMATION_BEEP]++;
|
||||
}
|
||||
void resetCallCounters(void) {
|
||||
memset(&callCounts, 0, sizeof(callCounts));
|
||||
}
|
||||
|
@ -191,6 +195,7 @@ static const adjustmentConfig_t rateAdjustmentConfig = {
|
|||
.adjustmentFunction = ADJUSTMENT_RC_RATE,
|
||||
.step = 1
|
||||
};
|
||||
|
||||
TEST(RcControlsTest, processRcAdjustmentsSticksInMiddle)
|
||||
{
|
||||
// given
|
||||
|
@ -226,6 +231,7 @@ TEST(RcControlsTest, processRcAdjustmentsSticksInMiddle)
|
|||
// then
|
||||
EXPECT_EQ(controlRateConfig.rcRate8, 90);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_GENERATE_PITCH_ROLL_CURVE), 0);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP), 0);
|
||||
EXPECT_EQ(adjustmentStateMask, 0);
|
||||
}
|
||||
|
||||
|
@ -275,6 +281,7 @@ TEST(RcControlsTest, processRcAdjustmentsWithRcRateFunctionSwitchUp)
|
|||
// then
|
||||
EXPECT_EQ(controlRateConfig.rcRate8, 91);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_GENERATE_PITCH_ROLL_CURVE), 1);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP), 1);
|
||||
EXPECT_EQ(adjustmentStateMask, expectedAdjustmentStateMask);
|
||||
|
||||
|
||||
|
@ -333,6 +340,7 @@ TEST(RcControlsTest, processRcAdjustmentsWithRcRateFunctionSwitchUp)
|
|||
// then
|
||||
EXPECT_EQ(controlRateConfig.rcRate8, 92);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_GENERATE_PITCH_ROLL_CURVE), 2);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP), 2);
|
||||
EXPECT_EQ(adjustmentStateMask, expectedAdjustmentStateMask);
|
||||
|
||||
//
|
||||
|
@ -379,6 +387,7 @@ TEST(RcControlsTest, processRcAdjustmentsWithRcRateFunctionSwitchUp)
|
|||
// then
|
||||
EXPECT_EQ(controlRateConfig.rcRate8, 93);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_GENERATE_PITCH_ROLL_CURVE), 3);
|
||||
EXPECT_EQ(CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP), 3);
|
||||
EXPECT_EQ(adjustmentStateMask, expectedAdjustmentStateMask);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue