Position hold depends on GPS (#14101)
[betaflight.git] / src / test / unit / rc_controls_unittest.cc
blob862c43119d07a5aa86012ee51d91cdedb78c9a12
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
17 #include <stdint.h>
19 #include <limits.h>
21 //#define DEBUG_RC_CONTROLS
23 extern "C" {
24 #include "platform.h"
26 #include "common/maths.h"
27 #include "common/axis.h"
28 #include "common/bitarray.h"
30 #include "pg/pg.h"
31 #include "pg/pg_ids.h"
32 #include "pg/rx.h"
34 #include "blackbox/blackbox.h"
35 #include "blackbox/blackbox_fielddefs.h"
37 #include "drivers/sensor.h"
39 #include "sensors/sensors.h"
40 #include "sensors/acceleration.h"
42 #include "io/beeper.h"
44 #include "rx/rx.h"
46 #include "flight/pid.h"
48 #include "config/config.h"
49 #include "fc/controlrate_profile.h"
50 #include "fc/rc_modes.h"
51 #include "fc/rc_adjustments.h"
53 #include "fc/rc_controls.h"
54 #include "fc/runtime_config.h"
55 #include "fc/core.h"
57 #include "scheduler/scheduler.h"
60 #include "unittest_macros.h"
61 #include "gtest/gtest.h"
63 void unsetArmingDisabled(armingDisableFlags_e flag)
65 UNUSED(flag);
68 class RcControlsModesTest : public ::testing::Test {
69 protected:
70 virtual void SetUp() {
74 TEST_F(RcControlsModesTest, updateActivatedModesWithAllInputsAtMidde)
76 // given
77 boxBitmask_t mask;
78 memset(&mask, 0, sizeof(mask));
79 rcModeUpdate(&mask);
81 // and
82 memset(&rxRuntimeState, 0, sizeof(rxRuntimeState_t));
83 rxRuntimeState.channelCount = MAX_SUPPORTED_RC_CHANNEL_COUNT - NON_AUX_CHANNEL_COUNT;
85 // and
86 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
87 rcData[index] = PWM_RANGE_MIDDLE;
90 // when
91 analyzeModeActivationConditions();
92 updateActivatedModes();
94 // then
95 for (int index = 0; index < CHECKBOX_ITEM_COUNT; index++) {
96 #ifdef DEBUG_RC_CONTROLS
97 printf("iteration: %d\n", index);
98 #endif
99 EXPECT_FALSE(IS_RC_MODE_ACTIVE((boxId_e)index));
103 TEST_F(RcControlsModesTest, updateActivatedModesUsingValidAuxConfigurationAndRXValues)
105 // given
106 modeActivationConditionsMutable(0)->modeId = (boxId_e)0;
107 modeActivationConditionsMutable(0)->auxChannelIndex = AUX1 - NON_AUX_CHANNEL_COUNT;
108 modeActivationConditionsMutable(0)->range.startStep = CHANNEL_VALUE_TO_STEP(1700);
109 modeActivationConditionsMutable(0)->range.endStep = CHANNEL_VALUE_TO_STEP(2100);
111 modeActivationConditionsMutable(1)->modeId = (boxId_e)1;
112 modeActivationConditionsMutable(1)->auxChannelIndex = AUX2 - NON_AUX_CHANNEL_COUNT;
113 modeActivationConditionsMutable(1)->range.startStep = CHANNEL_VALUE_TO_STEP(1300);
114 modeActivationConditionsMutable(1)->range.endStep = CHANNEL_VALUE_TO_STEP(1700);
116 modeActivationConditionsMutable(2)->modeId = (boxId_e)2;
117 modeActivationConditionsMutable(2)->auxChannelIndex = AUX3 - NON_AUX_CHANNEL_COUNT;
118 modeActivationConditionsMutable(2)->range.startStep = CHANNEL_VALUE_TO_STEP(900);
119 modeActivationConditionsMutable(2)->range.endStep = CHANNEL_VALUE_TO_STEP(1200);
121 modeActivationConditionsMutable(3)->modeId = (boxId_e)3;
122 modeActivationConditionsMutable(3)->auxChannelIndex = AUX4 - NON_AUX_CHANNEL_COUNT;
123 modeActivationConditionsMutable(3)->range.startStep = CHANNEL_VALUE_TO_STEP(900);
124 modeActivationConditionsMutable(3)->range.endStep = CHANNEL_VALUE_TO_STEP(2100);
126 modeActivationConditionsMutable(4)->modeId = (boxId_e)4;
127 modeActivationConditionsMutable(4)->auxChannelIndex = AUX5 - NON_AUX_CHANNEL_COUNT;
128 modeActivationConditionsMutable(4)->range.startStep = CHANNEL_VALUE_TO_STEP(900);
129 modeActivationConditionsMutable(4)->range.endStep = CHANNEL_VALUE_TO_STEP(925);
131 EXPECT_EQ(0, modeActivationConditions(4)->range.startStep);
132 EXPECT_EQ(1, modeActivationConditions(4)->range.endStep);
134 modeActivationConditionsMutable(5)->modeId = (boxId_e)5;
135 modeActivationConditionsMutable(5)->auxChannelIndex = AUX6 - NON_AUX_CHANNEL_COUNT;
136 modeActivationConditionsMutable(5)->range.startStep = CHANNEL_VALUE_TO_STEP(2075);
137 modeActivationConditionsMutable(5)->range.endStep = CHANNEL_VALUE_TO_STEP(2100);
139 EXPECT_EQ(47, modeActivationConditions(5)->range.startStep);
140 EXPECT_EQ(48, modeActivationConditions(5)->range.endStep);
142 modeActivationConditionsMutable(6)->modeId = (boxId_e)6;
143 modeActivationConditionsMutable(6)->auxChannelIndex = AUX7 - NON_AUX_CHANNEL_COUNT;
144 modeActivationConditionsMutable(6)->range.startStep = CHANNEL_VALUE_TO_STEP(925);
145 modeActivationConditionsMutable(6)->range.endStep = CHANNEL_VALUE_TO_STEP(950);
147 EXPECT_EQ(1, modeActivationConditions(6)->range.startStep);
148 EXPECT_EQ(2, modeActivationConditions(6)->range.endStep);
150 // and
151 boxBitmask_t mask;
152 memset(&mask, 0, sizeof(mask));
153 rcModeUpdate(&mask);
155 // and
156 memset(&rxRuntimeState, 0, sizeof(rxRuntimeState_t));
157 rxRuntimeState.channelCount = MAX_SUPPORTED_RC_CHANNEL_COUNT - NON_AUX_CHANNEL_COUNT;
159 // and
160 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
161 rcData[index] = PWM_RANGE_MIDDLE;
164 rcData[AUX1] = PWM_RANGE_MAX;
165 rcData[AUX2] = PWM_RANGE_MIDDLE;
166 rcData[AUX3] = PWM_RANGE_MIN;
167 rcData[AUX4] = PWM_RANGE_MAX;
168 rcData[AUX5] = 899; // value lower that range minimum should be treated the same as the lowest range value
169 rcData[AUX6] = 2101; // value higher than the range maximum should be treated the same as the highest range value
170 rcData[AUX7] = 950; // value equal to range step upper boundary should not activate the mode
172 // and
173 boxBitmask_t activeBoxIds;
174 memset(&activeBoxIds, 0, sizeof(boxBitmask_t));
175 bitArraySet(&activeBoxIds, 0);
176 bitArraySet(&activeBoxIds, 1);
177 bitArraySet(&activeBoxIds, 2);
178 bitArraySet(&activeBoxIds, 3);
179 bitArraySet(&activeBoxIds, 4);
180 bitArraySet(&activeBoxIds, 5);
182 // when
183 analyzeModeActivationConditions();
184 updateActivatedModes();
186 // then
187 for (int index = 0; index < CHECKBOX_ITEM_COUNT; index++) {
188 #ifdef DEBUG_RC_CONTROLS
189 printf("iteration: %d, %d\n", index, (bool)(bitArrayGet(&activeBoxIds, index)));
190 #endif
191 EXPECT_EQ((bool)(bitArrayGet(&activeBoxIds, index)), IS_RC_MODE_ACTIVE((boxId_e)index));
195 enum {
196 COUNTER_QUEUE_CONFIRMATION_BEEP,
197 COUNTER_CHANGE_CONTROL_RATE_PROFILE
199 #define CALL_COUNT_ITEM_COUNT 2
201 static int callCounts[CALL_COUNT_ITEM_COUNT];
203 #define CALL_COUNTER(item) (callCounts[item])
205 extern "C" {
206 void beeperConfirmationBeeps(uint8_t)
208 callCounts[COUNTER_QUEUE_CONFIRMATION_BEEP]++;
211 void beeper(beeperMode_e mode)
213 UNUSED(mode);
216 void changeControlRateProfile(uint8_t)
218 callCounts[COUNTER_CHANGE_CONTROL_RATE_PROFILE]++;
223 void resetCallCounters(void)
225 memset(&callCounts, 0, sizeof(callCounts));
228 uint32_t fixedMillis;
230 extern "C" {
231 uint32_t millis(void)
233 return fixedMillis;
236 uint32_t micros(void)
238 return fixedMillis * 1000;
242 void resetMillis(void)
244 fixedMillis = 0;
247 #define DEFAULT_MIN_CHECK 1100
248 #define DEFAULT_MAX_CHECK 1900
250 extern "C" {
251 PG_REGISTER(rxConfig_t, rxConfig, PG_RX_CONFIG, 0);
253 extern int stepwiseAdjustmentCount;
254 extern timedAdjustmentState_t stepwiseAdjustments[MAX_ADJUSTMENT_RANGE_COUNT];
256 extern int continuosAdjustmentCount;
257 extern continuosAdjustmentState_t continuosAdjustments[MAX_ADJUSTMENT_RANGE_COUNT];
260 class RcControlsAdjustmentsTest : public ::testing::Test {
261 protected:
262 controlRateConfig_t controlRateConfig = {
263 .thrMid8 = 0,
264 .thrExpo8 = 0,
265 .rcRates = {[FD_ROLL] = 90, [FD_PITCH] = 90},
266 .rcExpo = {[FD_ROLL] = 0, [FD_PITCH] = 0, [FD_YAW] = 0},
267 .rates = {0, 0, 0},
270 channelRange_t fullRange = {
271 .startStep = MIN_MODE_RANGE_STEP,
272 .endStep = MAX_MODE_RANGE_STEP
275 int adjustmentRangesIndex;
277 virtual void SetUp() {
278 PG_RESET(rxConfig);
279 rxConfigMutable()->mincheck = DEFAULT_MIN_CHECK;
280 rxConfigMutable()->maxcheck = DEFAULT_MAX_CHECK;
281 rxConfigMutable()->midrc = 1500;
283 controlRateConfig.rcRates[FD_ROLL] = 90;
284 controlRateConfig.rcRates[FD_PITCH] = 90;
285 controlRateConfig.rcExpo[FD_ROLL] = 0;
286 controlRateConfig.rcExpo[FD_PITCH] = 0;
287 controlRateConfig.thrMid8 = 0;
288 controlRateConfig.thrExpo8 = 0;
289 controlRateConfig.rcExpo[FD_YAW] = 0;
290 controlRateConfig.rates[0] = 0;
291 controlRateConfig.rates[1] = 0;
292 controlRateConfig.rates[2] = 0;
294 PG_RESET(adjustmentRanges);
295 adjustmentRangesIndex = 0;
297 stepwiseAdjustmentCount = 0;
298 continuosAdjustmentCount = 0;
301 int configureAdjustmentRange(uint8_t switchChannelIndex, uint8_t adjustmentConfigIndex) {
302 adjustmentRange_t *adjustmentRange = adjustmentRangesMutable(adjustmentRangesIndex);
303 adjustmentRange->auxChannelIndex = AUX1 - NON_AUX_CHANNEL_COUNT;
304 adjustmentRange->range = fullRange;
306 adjustmentRange->adjustmentConfig = adjustmentConfigIndex;
307 adjustmentRange->auxSwitchChannelIndex = switchChannelIndex;
309 return adjustmentRangesIndex++;
312 timedAdjustmentState_t *configureStepwiseAdjustment(uint8_t switchChannelIndex, uint8_t adjustmentConfigIndex) {
313 int adjustmentRangeIndex = configureAdjustmentRange(switchChannelIndex, adjustmentConfigIndex);
315 timedAdjustmentState_t *adjustmentState = &stepwiseAdjustments[stepwiseAdjustmentCount++];
316 adjustmentState->adjustmentRangeIndex = adjustmentRangeIndex;
317 adjustmentState->timeoutAt = 0;
318 adjustmentState->ready = true;
320 return adjustmentState;
323 void configureContinuosAdjustment(uint8_t switchChannelIndex, uint8_t adjustmentConfigIndex) {
324 int adjustmentRangeIndex = configureAdjustmentRange(switchChannelIndex, adjustmentConfigIndex);
326 continuosAdjustmentState_t *adjustmentState = &continuosAdjustments[continuosAdjustmentCount++];
327 adjustmentState->adjustmentRangeIndex = adjustmentRangeIndex;
328 adjustmentState->lastRcData = 0;
332 #define ADJUSTMENT_CONFIG_RATE_INDEX 1
334 TEST_F(RcControlsAdjustmentsTest, processRcAdjustmentsSticksInMiddle)
336 // given
337 const timedAdjustmentState_t *adjustmentState = configureStepwiseAdjustment(AUX3 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_CONFIG_RATE_INDEX);
339 // and
340 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
341 rcData[index] = PWM_RANGE_MIDDLE;
344 // and
345 resetCallCounters();
346 resetMillis();
348 // when
349 processRcAdjustments(&controlRateConfig);
351 // then
352 EXPECT_EQ(90, controlRateConfig.rcRates[FD_ROLL]);
353 EXPECT_EQ(90, controlRateConfig.rcRates[FD_PITCH]);
354 EXPECT_EQ(0, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
355 EXPECT_TRUE(adjustmentState->ready);
358 TEST_F(RcControlsAdjustmentsTest, processRcAdjustmentsWithRcRateFunctionSwitchUp)
360 // given
361 controlRateConfig_t controlRateConfig = {
362 .thrMid8 = 0,
363 .thrExpo8 = 0,
364 .rcRates = {[FD_ROLL] = 90, [FD_PITCH] = 90},
365 .rcExpo = {[FD_ROLL] = 0, [FD_PITCH] = 0, [FD_YAW] = 0},
366 .rates = {0,0,0},
369 // and
370 PG_RESET(rxConfig);
371 rxConfigMutable()->mincheck = DEFAULT_MIN_CHECK;
372 rxConfigMutable()->maxcheck = DEFAULT_MAX_CHECK;
373 rxConfigMutable()->midrc = 1500;
375 // and
376 const timedAdjustmentState_t *adjustmentState = configureStepwiseAdjustment(AUX3 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_CONFIG_RATE_INDEX);
378 // and
379 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
380 rcData[index] = PWM_RANGE_MIDDLE;
383 // and
384 resetCallCounters();
385 resetMillis();
387 // and
388 rcData[AUX3] = PWM_RANGE_MAX;
390 // and
391 fixedMillis = 496;
393 // when
394 processRcAdjustments(&controlRateConfig);
396 // then
397 EXPECT_EQ(91, controlRateConfig.rcRates[FD_ROLL]);
398 EXPECT_EQ(91, controlRateConfig.rcRates[FD_PITCH]);
399 EXPECT_EQ(1, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
400 EXPECT_FALSE(adjustmentState->ready);
403 // now pretend a short amount of time has passed, but not enough time to allow the value to have been increased
406 // given
407 fixedMillis = 497;
409 // when
410 processRcAdjustments(&controlRateConfig);
412 EXPECT_EQ(91, controlRateConfig.rcRates[FD_ROLL]);
413 EXPECT_EQ(91, controlRateConfig.rcRates[FD_PITCH]);
414 EXPECT_FALSE(adjustmentState->ready);
418 // moving the switch back to the middle should immediately reset the state flag without increasing the value
422 // given
423 rcData[AUX3] = PWM_RANGE_MIDDLE;
425 // and
426 fixedMillis = 498;
428 // when
429 processRcAdjustments(&controlRateConfig);
431 EXPECT_EQ(91, controlRateConfig.rcRates[FD_ROLL]);
432 EXPECT_EQ(91, controlRateConfig.rcRates[FD_PITCH]);
433 EXPECT_TRUE(adjustmentState->ready);
437 // flipping the switch again, before the state reset would have occurred, allows the value to be increased again
439 // given
440 rcData[AUX3] = PWM_RANGE_MAX;
442 // and
443 fixedMillis = 499;
445 // when
446 processRcAdjustments(&controlRateConfig);
448 // then
449 EXPECT_EQ(92, controlRateConfig.rcRates[FD_ROLL]);
450 EXPECT_EQ(92, controlRateConfig.rcRates[FD_PITCH]);
451 EXPECT_EQ(2, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
452 EXPECT_FALSE(adjustmentState->ready);
455 // leaving the switch up, after the original timer would have reset the state should now NOT cause
456 // the rate to increase, it should only increase after another 500ms from when the state was reset.
459 // given
460 fixedMillis = 500;
462 // when
463 processRcAdjustments(&controlRateConfig);
465 // then
466 EXPECT_EQ(92, controlRateConfig.rcRates[FD_ROLL]);
467 EXPECT_EQ(92, controlRateConfig.rcRates[FD_PITCH]);
468 EXPECT_FALSE(adjustmentState->ready);
471 // should still not be able to be increased
474 // given
475 fixedMillis = 997;
477 // when
478 processRcAdjustments(&controlRateConfig);
480 // then
481 EXPECT_EQ(92, controlRateConfig.rcRates[FD_ROLL]);
482 EXPECT_EQ(92, controlRateConfig.rcRates[FD_PITCH]);
483 EXPECT_FALSE(adjustmentState->ready);
486 // 500ms has now passed since the switch was returned to the middle, now that
487 // switch is still in the UP position after the timer has elapses it should
488 // be increased again.
491 // given
492 fixedMillis = 998;
494 // when
495 processRcAdjustments(&controlRateConfig);
497 // then
498 EXPECT_EQ(93, controlRateConfig.rcRates[FD_ROLL]);
499 EXPECT_EQ(93, controlRateConfig.rcRates[FD_PITCH]);
500 EXPECT_EQ(3, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
501 EXPECT_FALSE(adjustmentState->ready);
504 #define ADJUSTMENT_RATE_PROFILE_INDEX 12
506 TEST_F(RcControlsAdjustmentsTest, processRcRateProfileAdjustments)
508 // given
509 configureContinuosAdjustment(AUX4 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_RATE_PROFILE_INDEX);
511 // and
512 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
513 rcData[index] = PWM_RANGE_MIDDLE;
516 // and
517 resetCallCounters();
518 resetMillis();
520 // and
521 rcData[AUX4] = PWM_RANGE_MAX;
523 // when
524 processRcAdjustments(&controlRateConfig);
526 // then
527 EXPECT_EQ(1, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
528 EXPECT_EQ(1, CALL_COUNTER(COUNTER_CHANGE_CONTROL_RATE_PROFILE));
531 #define ADJUSTMENT_PITCH_ROLL_P_INDEX 6
532 #define ADJUSTMENT_PITCH_ROLL_I_INDEX 7
533 #define ADJUSTMENT_PITCH_ROLL_D_INDEX 8
534 #define ADJUSTMENT_YAW_P_INDEX 9
535 #define ADJUSTMENT_YAW_I_INDEX 10
536 #define ADJUSTMENT_YAW_D_INDEX 11
538 TEST_F(RcControlsAdjustmentsTest, processPIDIncreasePidController0)
540 // given
541 pidProfile_t pidProfile;
542 memset(&pidProfile, 0, sizeof(pidProfile));
543 pidProfile.pid[PID_PITCH].P = 0;
544 pidProfile.pid[PID_PITCH].I = 10;
545 pidProfile.pid[PID_PITCH].D = 20;
546 pidProfile.pid[PID_ROLL].P = 5;
547 pidProfile.pid[PID_ROLL].I = 15;
548 pidProfile.pid[PID_ROLL].D = 25;
549 pidProfile.pid[PID_YAW].P = 7;
550 pidProfile.pid[PID_YAW].I = 17;
551 pidProfile.pid[PID_YAW].D = 27;
553 // and
554 controlRateConfig_t controlRateConfig;
555 memset(&controlRateConfig, 0, sizeof(controlRateConfig));
557 const timedAdjustmentState_t *adjustmentState1 = configureStepwiseAdjustment(AUX1 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_PITCH_ROLL_P_INDEX);
558 const timedAdjustmentState_t *adjustmentState2 = configureStepwiseAdjustment(AUX2 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_PITCH_ROLL_I_INDEX);
559 const timedAdjustmentState_t *adjustmentState3 = configureStepwiseAdjustment(AUX3 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_PITCH_ROLL_D_INDEX);
560 const timedAdjustmentState_t *adjustmentState4 = configureStepwiseAdjustment(AUX1 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_YAW_P_INDEX);
561 const timedAdjustmentState_t *adjustmentState5 = configureStepwiseAdjustment(AUX2 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_YAW_I_INDEX);
562 const timedAdjustmentState_t *adjustmentState6 = configureStepwiseAdjustment(AUX3 - NON_AUX_CHANNEL_COUNT, ADJUSTMENT_YAW_D_INDEX);
564 // and
565 for (int index = AUX1; index < MAX_SUPPORTED_RC_CHANNEL_COUNT; index++) {
566 rcData[index] = PWM_RANGE_MIDDLE;
569 // and
570 resetCallCounters();
571 resetMillis();
573 // and
574 rcData[AUX1] = PWM_RANGE_MAX;
575 rcData[AUX2] = PWM_RANGE_MAX;
576 rcData[AUX3] = PWM_RANGE_MAX;
578 // when
579 currentPidProfile = &pidProfile;
580 rcControlsInit();
581 processRcAdjustments(&controlRateConfig);
583 // then
584 EXPECT_EQ(6, CALL_COUNTER(COUNTER_QUEUE_CONFIRMATION_BEEP));
585 EXPECT_FALSE(adjustmentState1->ready);
586 EXPECT_FALSE(adjustmentState2->ready);
587 EXPECT_FALSE(adjustmentState3->ready);
588 EXPECT_FALSE(adjustmentState4->ready);
589 EXPECT_FALSE(adjustmentState5->ready);
590 EXPECT_FALSE(adjustmentState6->ready);
592 // and
593 EXPECT_EQ(1, pidProfile.pid[PID_PITCH].P);
594 EXPECT_EQ(11, pidProfile.pid[PID_PITCH].I);
595 EXPECT_EQ(21, pidProfile.pid[PID_PITCH].D);
596 EXPECT_EQ(6, pidProfile.pid[PID_ROLL].P);
597 EXPECT_EQ(16, pidProfile.pid[PID_ROLL].I);
598 EXPECT_EQ(26, pidProfile.pid[PID_ROLL].D);
599 EXPECT_EQ(8, pidProfile.pid[PID_YAW].P);
600 EXPECT_EQ(18, pidProfile.pid[PID_YAW].I);
601 EXPECT_EQ(28, pidProfile.pid[PID_YAW].D);
604 extern "C" {
605 void setConfigDirty(void) {}
606 void saveConfigAndNotify(void) {}
607 void initRcProcessing(void) {}
608 void changePidProfile(uint8_t) {}
609 void pidInitConfig(const pidProfile_t *) {}
610 void accStartCalibration(void) {}
611 void gyroStartCalibration(bool isFirstArmingCalibration)
613 UNUSED(isFirstArmingCalibration);
615 void applyAccelerometerTrimsDelta(rollAndPitchTrims_t*) {}
616 void handleInflightCalibrationStickPosition(void) {}
617 bool featureIsEnabled(uint32_t) { return false;}
618 bool sensors(uint32_t) { return false;}
619 void tryArm(void) {}
620 void disarm(flightLogDisarmReason_e) {}
621 void dashboardDisablePageCycling() {}
622 void dashboardEnablePageCycling() {}
624 bool failsafeIsActive() { return false; }
625 bool isRxReceivingSignal() { return true; }
626 bool failsafeIsReceivingRxData() { return true; }
628 uint8_t getCurrentControlRateProfileIndex(void)
630 return 0;
632 void GPS_reset_home_position(void) {}
633 void baroSetGroundLevel(void) {}
635 void blackboxLogEvent(FlightLogEvent, flightLogEventData_t *) {}
637 bool cmsInMenu = false;
638 uint8_t armingFlags = 0;
639 uint16_t flightModeFlags = 0;
640 int16_t heading;
641 uint8_t stateFlags = 0;
642 float rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
643 pidProfile_t *currentPidProfile;
644 rxRuntimeState_t rxRuntimeState;
645 PG_REGISTER(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 0);
646 PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 2);
647 void resetArmingDisabled(void) {}
648 timeDelta_t getTaskDeltaTimeUs(taskId_e) { return 20000; }
649 armingDisableFlags_e getArmingDisableFlags(void)
651 return (armingDisableFlags_e) 0;
653 bool isTryingToArm(void) { return false; }
654 void resetTryingToArm(void) {}
655 void setLedProfile(uint8_t profile) { UNUSED(profile); }
656 uint8_t getLedProfile(void) { return 0; }
657 uint8_t getLedBrightness(void) { return 50; }
658 void setLedBrightness(uint8_t brightness) { UNUSED(brightness); }
659 void compassStartCalibration(void) {}
660 void pinioBoxTaskControl(void) {}
661 void schedulerIgnoreTaskExecTime(void) {}