Fix Dterm In blackbox
[betaflight.git] / q
blob04586033b6c4047da6ff7001a903a748daccc30a
1 \e[1mdiff --git a/src/main/io/rc_controls.c b/src/main/io/rc_controls.c\e[m
2 \e[1mindex fdde2cf..53464ef 100644\e[m
3 \e[1m--- a/src/main/io/rc_controls.c\e[m
4 \e[1m+++ b/src/main/io/rc_controls.c\e[m
5 \e[36m@@ -67,6 +67,7 @@\e[m \e[mstatic pidProfile_t *pidProfile;\e[m
6  static bool isUsingSticksToArm = true;\e[m
7  \e[m
8  int16_t rcCommand[4];           // interval [1000;2000] for THROTTLE and [-500;+500] for ROLL/PITCH/YAW\e[m
9 \e[32m+\e[m\e[32mint16_t rcCommandSmooth[4];     // Smoothed RcCommand\e[m
10  \e[m
11  uint32_t rcModeActivationMask; // one bit per mode defined in boxId_e\e[m
12  \e[m
13 \e[1mdiff --git a/src/main/io/rc_controls.h b/src/main/io/rc_controls.h\e[m
14 \e[1mindex eaec277..dd8afaf 100644\e[m
15 \e[1m--- a/src/main/io/rc_controls.h\e[m
16 \e[1m+++ b/src/main/io/rc_controls.h\e[m
17 \e[36m@@ -147,6 +147,7 @@\e[m \e[mtypedef struct controlRateConfig_s {\e[m
18  } controlRateConfig_t;\e[m
19  \e[m
20  extern int16_t rcCommand[4];\e[m
21 \e[32m+\e[m\e[32mextern int16_t rcCommandSmooth[4];     // Smoothed RcCommand\e[m
22  \e[m
23  typedef struct rcControlsConfig_s {\e[m
24      uint8_t deadband;                       // introduce a deadband around the stick center for pitch and roll axis. Must be greater than zero.\e[m
25 \e[1mdiff --git a/src/main/mw.c b/src/main/mw.c\e[m
26 \e[1mindex 125674c..5da79cf 100644\e[m
27 \e[1m--- a/src/main/mw.c\e[m
28 \e[1m+++ b/src/main/mw.c\e[m
29 \e[36m@@ -181,7 +181,7 @@\e[m \e[mvoid filterRc(void)\e[m
30  \e[m
31      if (isRXDataNew) {\e[m
32          for (int channel=0; channel < 4; channel++) {\e[m
33 \e[31m-            deltaRC[channel] = rcCommand[channel] -  (lastCommand[channel] - deltaRC[channel] * factor / rcInterpolationFactor);\e[m
34 \e[32m+\e[m\e[32m            deltaRC[channel] = rcCommand[channel] - (lastCommand[channel] - deltaRC[channel] * factor / rcInterpolationFactor);\e[m
35              lastCommand[channel] = rcCommand[channel];\e[m
36          }\e[m
37  \e[m
38 \e[36m@@ -194,7 +194,7 @@\e[m \e[mvoid filterRc(void)\e[m
39      // Interpolate steps of rcCommand\e[m
40      if (factor > 0) {\e[m
41          for (int channel=0; channel < 4; channel++) {\e[m
42 \e[31m-            rcCommand[channel] = lastCommand[channel] - deltaRC[channel] * factor/rcInterpolationFactor;\e[m
43 \e[32m+\e[m\e[32m            rcCommandSmooth[channel] = lastCommand[channel] - deltaRC[channel] * factor/rcInterpolationFactor;\e[m
44           }\e[m
45      } else {\e[m
46          factor = 0;\e[m
47 \e[36m@@ -649,8 +649,11 @@\e[m \e[mvoid subTaskMainSubprocesses(void) {\e[m
48  \e[m
49      const uint32_t startTime = micros();\e[m
50  \e[m
51 \e[32m+\e[m\e[32m    filterRc();\e[m
52 \e[32m+\e[m
53      if (masterConfig.rxConfig.rcSmoothing || flightModeFlags) {\e[m
54 \e[31m-        filterRc();\e[m
55 \e[32m+\e[m\e[32m        int axis;\e[m
56 \e[32m+\e[m\e[32m        for (axis = 0; axis <= 4; axis++) rcCommand[axis] = rcCommandSmooth[axis];\e[m
57      }\e[m
58  \e[m
59      // Read out gyro temperature. can use it for something somewhere. maybe get MCU temperature instead? lots of fun possibilities.\e[m