Skip to content

Commit c79f0ef

Browse files
Merge pull request #9443 from shota3527/sh_change_pitot
Increase pitot`s default LPF frequency
2 parents c676075 + aa32cc8 commit c79f0ef

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

docs/Settings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5613,12 +5613,12 @@ Selection of pitot hardware.
56135613
---
56145614

56155615
### pitot_lpf_milli_hz
5616+
Pitot tube lowpass filter cutoff frequency in milli Hz(0.001hz). Set as 0 to disable LPF Lower cutoff frequencies result in smoother response at expense of command control delay
56165617

5617-
Pitot tube lowpass filter cutoff frequency. Lower cutoff frequencies result in smoother response at expense of command control delay
56185618

56195619
| Default | Min | Max |
56205620
| --- | --- | --- |
5621-
| 350 | 0 | 10000 |
5621+
| 3000 | 0 | 50000 |
56225622

56235623
---
56245624

src/main/fc/settings.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,10 +668,10 @@ groups:
668668
default_value: "NONE"
669669
table: pitot_hardware
670670
- name: pitot_lpf_milli_hz
671-
description: "Pitot tube lowpass filter cutoff frequency. Lower cutoff frequencies result in smoother response at expense of command control delay"
671+
description: "Pitot tube lowpass filter cutoff frequency in milli Hz(0.001hz). Set as 0 to disable LPF Lower cutoff frequencies result in smoother response at expense of command control delay"
672672
min: 0
673-
max: 10000
674-
default_value: 350
673+
max: 50000
674+
default_value: 3000
675675
- name: pitot_scale
676676
description: "Pitot tube scale factor"
677677
min: 0

src/main/sensors/pitotmeter.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ STATIC_PROTOTHREAD(pitotThread)
209209

210210
// Init filter
211211
pitot.lastMeasurementUs = micros();
212-
213-
pt1FilterInit(&pitot.lpfState, pitotmeterConfig()->pitot_lpf_milli_hz / 1000.0f, 0.0f);
214-
212+
if(pitotmeterConfig()->pitot_lpf_milli_hz >0){
213+
pt1FilterInit(&pitot.lpfState, pitotmeterConfig()->pitot_lpf_milli_hz / 1000.0f, 0.0f);
214+
}
215215
while(1) {
216216
#ifdef USE_SIMULATOR
217217
while (SIMULATOR_HAS_OPTION(HITL_AIRSPEED) && SIMULATOR_HAS_OPTION(HITL_PITOT_FAILURE))
@@ -263,7 +263,11 @@ STATIC_PROTOTHREAD(pitotThread)
263263

264264
// NOTE ::filter pressure - apply filter when NOT calibrating for zero !!!
265265
currentTimeUs = micros();
266-
pitot.pressure = pt1FilterApply3(&pitot.lpfState, pitotPressureTmp, US2S(currentTimeUs - pitot.lastMeasurementUs));
266+
if(pitotmeterConfig()->pitot_lpf_milli_hz >0){
267+
pitot.pressure = pt1FilterApply3(&pitot.lpfState, pitotPressureTmp, US2S(currentTimeUs - pitot.lastMeasurementUs));
268+
}else{
269+
pitot.pressure = pitotPressureTmp;
270+
}
267271
pitot.lastMeasurementUs = currentTimeUs;
268272

269273
pitot.airSpeed = pitotmeterConfig()->pitot_scale * fast_fsqrtf(2.0f * fabsf(pitot.pressure - pitot.pressureZero) / SSL_AIR_DENSITY) * 100; // cm/s

0 commit comments

Comments
 (0)