mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
Fix unhandled SPI4 // Size reduction F1
This commit is contained in:
parent
07dc9eaa5e
commit
32ec29ccce
3 changed files with 14 additions and 3 deletions
|
@ -270,7 +270,7 @@ int16_t firFilterInt16Get(const firFilter_t *filter, int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
void initFirFilter(firFilterState_t *filter, uint8_t gyroSoftLpfHz, uint16_t targetLooptime) {
|
void initFirFilter(firFilterState_t *filter, uint8_t gyroSoftLpfHz, uint16_t targetLooptime) {
|
||||||
filter->targetCount = constrain(lrintf((1.0f / (0.000001f * (float)targetLooptime)) / gyroSoftLpfHz), 1, MAX_DENOISE_WINDOW_SIZE);
|
filter->targetCount = constrain(lrintf((1.0f / (0.000001f * (float)targetLooptime)) / gyroSoftLpfHz), 1, MAX_FIR_WINDOW_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prototype function for denoising of signal by dynamic moving average. Mainly for test purposes */
|
/* prototype function for denoising of signal by dynamic moving average. Mainly for test purposes */
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_DENOISE_WINDOW_SIZE 120
|
#ifdef STM32F10X
|
||||||
|
#define MAX_FIR_WINDOW_SIZE 60
|
||||||
|
#else
|
||||||
|
#define MAX_FIR_WINDOW_SIZE 120
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct pt1Filter_s {
|
typedef struct pt1Filter_s {
|
||||||
float state;
|
float state;
|
||||||
|
@ -34,7 +38,7 @@ typedef struct firFilterState_s {
|
||||||
int targetCount;
|
int targetCount;
|
||||||
int index;
|
int index;
|
||||||
float movingSum;
|
float movingSum;
|
||||||
float state[MAX_DENOISE_WINDOW_SIZE];
|
float state[MAX_FIR_WINDOW_SIZE];
|
||||||
} firFilterState_t;
|
} firFilterState_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -199,6 +199,13 @@ bool spiInit(SPIDevice device)
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
case SPIDEV_4:
|
||||||
|
#if defined(USE_SPI_DEVICE_4)
|
||||||
|
spiInitDevice(device);
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue