-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Feature: Add MSP AOA sensor support for relaxed static stability aircraft control #11484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Miki4751
wants to merge
2
commits into
iNavFlight:master
Choose a base branch
from
Miki4751:clean/aoa-sensor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * This file is part of INAV Project. | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
| * You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Alternatively, the contents of this file may be used under the terms | ||
| * of the GNU General Public License Version 3, as described below: | ||
| * | ||
| * This file is free software: you may copy, redistribute and/or modify | ||
| * it under the terms of the GNU General Public License as published by the | ||
| * Free Software Foundation, either version 3 of the License, or (at your | ||
| * option) any later version. | ||
| * | ||
| * This file is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see http://www.gnu.org/licenses/. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <stdint.h> | ||
| #include <stdbool.h> | ||
| #include "common/time.h" | ||
| #include "drivers/io.h" | ||
| #include "drivers/bus.h" | ||
|
|
||
| // AOA values are in decidegrees, typical range is -600 to +600 (-60.0° to +60.0°) | ||
| // Use values outside valid range for special states | ||
| #define AOA_NO_NEW_DATA (INT16_MAX) // No new data available from sensor | ||
| #define AOA_OUT_OF_RANGE (1810) // Measurement out of valid range (181.0°) | ||
| #define AOA_HARDWARE_FAILURE (1811) // Hardware failure detected | ||
|
|
||
| struct aoaDev_s; | ||
|
|
||
| typedef void (*aoaOpInitFuncPtr)(struct aoaDev_s * dev); | ||
| typedef void (*aoaOpStartFuncPtr)(struct aoaDev_s * dev); | ||
| typedef void (*aoaOpReadFuncPtr)(struct aoaDev_s * dev, int16_t * aoa, int16_t * sideslip); | ||
|
|
||
| typedef struct aoaDev_s { | ||
| busDevice_t * busDev; | ||
| timeMs_t delayMs; | ||
| aoaOpInitFuncPtr init; | ||
| aoaOpStartFuncPtr update; | ||
| aoaOpReadFuncPtr read; | ||
| } aoaDev_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * This file is part of INAV Project. | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
| * You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Alternatively, the contents of this file may be used under the terms | ||
| * of the GNU General Public License Version 3, as described below: | ||
| * | ||
| * This file is free software: you may copy, redistribute and/or modify | ||
| * it under the terms of the GNU General Public License as published by the | ||
| * Free Software Foundation, either version 3 of the License, or (at your | ||
| * option) any later version. | ||
| * | ||
| * This file is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see http://www.gnu.org/licenses/. | ||
| */ | ||
|
|
||
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
| #include <string.h> | ||
|
|
||
| #include <platform.h> | ||
|
|
||
| #include "build/build_config.h" | ||
|
|
||
| #include "common/utils.h" | ||
|
|
||
| #include "drivers/aoa/aoa_virtual.h" | ||
|
|
||
| static const virtualAoaVTable_t * highLevelDeviceVTable = NULL; | ||
|
|
||
| static void virtualAoaInit(aoaDev_t * dev) | ||
| { | ||
| UNUSED(dev); | ||
| return highLevelDeviceVTable->init(); | ||
| } | ||
|
|
||
| static void virtualAoaUpdate(aoaDev_t * dev) | ||
| { | ||
| UNUSED(dev); | ||
| return highLevelDeviceVTable->update(); | ||
| } | ||
|
|
||
| static void virtualAoaRead(aoaDev_t * dev, int16_t * aoa, int16_t * sideslip) | ||
| { | ||
| UNUSED(dev); | ||
| highLevelDeviceVTable->read(aoa, sideslip); | ||
| } | ||
|
|
||
| bool virtualAoaDetect(aoaDev_t * dev, const virtualAoaVTable_t * vtable) | ||
| { | ||
| if (vtable && vtable->detect()) { | ||
|
|
||
| highLevelDeviceVTable = vtable; | ||
| dev->delayMs = AOA_VIRTUAL_TASK_PERIOD_MS; | ||
| dev->init = &virtualAoaInit; | ||
| dev->update = &virtualAoaUpdate; | ||
| dev->read = &virtualAoaRead; | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * This file is part of INAV Project. | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
| * You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Alternatively, the contents of this file may be used under the terms | ||
| * of the GNU General Public License Version 3, as described below: | ||
| * | ||
| * This file is free software: you may copy, redistribute and/or modify | ||
| * it under the terms of the GNU General Public License as published by the | ||
| * Free Software Foundation, either version 3 of the License, or (at your | ||
| * option) any later version. | ||
| * | ||
| * This file is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see http://www.gnu.org/licenses/. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "drivers/aoa/aoa.h" | ||
|
|
||
| #define AOA_VIRTUAL_TASK_PERIOD_MS 30 | ||
|
|
||
| typedef struct virtualAoaVTable_s { | ||
| bool (*detect)(void); | ||
| void (*init)(void); | ||
| void (*update)(void); | ||
| void (*read)(int16_t * aoa, int16_t * sideslip); | ||
| } virtualAoaVTable_t; | ||
|
|
||
| bool virtualAoaDetect(aoaDev_t * dev, const virtualAoaVTable_t * vtable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Void return expression
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools