Skip to content

Virtual pitot refactor + other pitot improvements#11668

Open
breadoven wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
breadoven:abo_virtual_pitot_simplification
Open

Virtual pitot refactor + other pitot improvements#11668
breadoven wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
breadoven:abo_virtual_pitot_simplification

Conversation

@breadoven

Copy link
Copy Markdown
Collaborator

Simplifies virtual pitot by removing current driver style implementation and instead runs it as a simple function. The benefit is simplified logic and removal of essentially unnecessary and repetitive code. It also avoids the illogical conversion from airspeed to pressure than back to airspeed which makes little sense when virtual pitot provides airspeed directly from GPS and wind estimates.

PR also includes changes to the pitot protothread to simplify implementation of Fake pitot and Simulator pitot. This removes conversions to pressure and instead uses the Fake pitot and Simulated airspeed directly. This involves moving ptYield() to the end of the thread rather than have it in the middle. It's not clear why it was placed in the middle originally other than possibly to avoid time delta issues for filtering on the first iteration. Moving it doesn't seem to affect how the Virtual pitot works as currently implemented (as a driver) when tested in HITL. However, the real test will be with pitot hardware which hasn't been tested (don't have one). Pressure based airspeed calculations are skipped if Fake or Simulated airspeeds are used.

Virtual airspeed is based on the Virtual pitot driver logic using -> wind estimated airspeed falling back to -> GPS 3D speed if no wind estimate and finally -> fixedWingReferenceAirspeed if no GPS available. Not sure about using fixedWingReferenceAirspeed, it may be better to only use this for a Virtual pitot and otherwise use 0.

pitotAirspeedValidCached has been left as is but may now be redundant with the change in ptYield() position.

HITL testing shows the Virtual pitot works as expected as do HITL pitot functions, i.e. pitot simulation and pitot failure. Still needs fully testing properly with actual pitot hardware.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions

Copy link
Copy Markdown

Test firmware build ready — commit 509d20c

Download firmware for PR #11668

238 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant