diff --git a/src/main/io/beeper.c b/src/main/io/beeper.c index f8cbcbed2b..ae067d6b44 100644 --- a/src/main/io/beeper.c +++ b/src/main/io/beeper.c @@ -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; diff --git a/src/main/io/rc_controls.c b/src/main/io/rc_controls.c index a36d88e398..3e5ffb4e5f 100644 --- a/src/main/io/rc_controls.c +++ b/src/main/io/rc_controls.c @@ -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; diff --git a/src/main/mw.c b/src/main/mw.c index d726c20670..f071619580 100755 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -333,9 +333,9 @@ void handleInflightCalibrationStickPosition(void) } else { AccInflightCalibrationArmed = !AccInflightCalibrationArmed; if (AccInflightCalibrationArmed) { - queueConfirmationBeep(2); + queueConfirmationBeep(4); } else { - queueConfirmationBeep(3); + queueConfirmationBeep(6); } } } diff --git a/src/main/sensors/acceleration.c b/src/main/sensors/acceleration.c index e8ce78b304..b48e796990 100644 --- a/src/main/sensors/acceleration.c +++ b/src/main/sensors/acceleration.c @@ -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]; diff --git a/src/test/unit/rc_controls_unittest.cc b/src/test/unit/rc_controls_unittest.cc index 87b00c4790..b202d8a38d 100644 --- a/src/test/unit/rc_controls_unittest.cc +++ b/src/test/unit/rc_controls_unittest.cc @@ -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); }