-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
Update modalai fcv2 board support for 1.14 #21653
Merged
Merged
Changes from all commits
Commits
Show all changes
4 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 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 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 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 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 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,131 @@ | ||
#include <px4_platform_common/module.h> | ||
|
||
#include "chip.h" | ||
#include "stm32_gpio.h" | ||
#include "board_config.h" | ||
|
||
#include <nuttx/board.h> | ||
#include <arch/board/board.h> | ||
|
||
// v2 | ||
#ifdef CONFIG_ARCH_CHIP_STM32H753II // chip on M0087 | ||
#include "modalai_fc-v2.h" | ||
#define MODALAI_FC_V2 1 | ||
#else | ||
#include "modalai_fc-v1.h" | ||
#endif | ||
|
||
__EXPORT int modalai_main(int argc, char *argv[]); | ||
|
||
int modalai_main(int argc, char *argv[]) | ||
{ | ||
int hw_rev = board_get_hw_revision(); | ||
int hw_ver = board_get_hw_version(); | ||
|
||
eHW_TYPE hw_type = eHwNone; | ||
|
||
#ifdef MODALAI_FC_V2 | ||
|
||
if (hw_rev == 0 && hw_ver == 3) { // (should be hw_rev == 1 && hw_ver == 3) eventually... | ||
hw_type = eM0087; | ||
|
||
} else if (hw_rev == 0 && hw_ver == 3) { | ||
hw_type = eM0079; | ||
|
||
} else { | ||
return -1; | ||
|
||
} | ||
|
||
#else | ||
|
||
if (hw_rev == 6 && hw_ver == 0) { | ||
hw_type = eM0018; | ||
|
||
} else if (hw_rev == 0 && hw_ver == 1) { | ||
hw_type = eM0019; | ||
|
||
} else if (hw_rev == 0 && hw_ver == 2) { | ||
hw_type = eM0051; | ||
|
||
} else { | ||
return -1; | ||
|
||
} | ||
|
||
#endif | ||
|
||
if (argc <= 1) { | ||
#ifdef MODALAI_FC_V2 | ||
modalai_print_usage_v2(); | ||
#else | ||
modalai_print_usage_v1(); | ||
#endif | ||
return 1; | ||
} | ||
|
||
if (!strcmp(argv[1], "led")) { | ||
#ifdef MODALAI_FC_V2 | ||
return modalai_led_test_v2(); | ||
#else | ||
return modalai_led_test_v1(); | ||
#endif | ||
|
||
} else if (!strcmp(argv[1], "con")) { | ||
if (argc <= 2) { | ||
PRINT_MODULE_USAGE_COMMAND("con"); | ||
PRINT_MODULE_USAGE_ARG("<1,4,5,6,7,9,10,12,13>", "Connector ID", false); | ||
PRINT_MODULE_USAGE_ARG("<uint>", "Pin Number", false); | ||
PRINT_MODULE_USAGE_ARG("0 | 1", "<output state> (defaults to 0)", false); | ||
return 1; | ||
} | ||
|
||
uint8_t con = 0; | ||
uint8_t pin = 0; | ||
bool state = false; | ||
|
||
if (argc > 2) { | ||
con = atoi(argv[2]); | ||
} | ||
|
||
if (argc > 3) { | ||
pin = atoi(argv[3]); | ||
} | ||
|
||
if (argc > 4) { | ||
state = atoi(argv[4]); | ||
} | ||
|
||
#ifdef MODALAI_FC_V2 | ||
return modalai_con_gpio_test_v2(con, pin, state); | ||
#else | ||
return modalai_con_gpio_test_v1(con, pin, state); | ||
#endif | ||
|
||
} else if (!strcmp(argv[1], "buzz")) { | ||
|
||
#ifdef MODALAI_FC_V2 | ||
return modalai_buzz_test_v2(hw_type); | ||
#else | ||
return modalai_buzz_test_v1(hw_type); | ||
#endif | ||
|
||
|
||
|
||
} else if (!strcmp(argv[1], "detect")) { | ||
#ifdef MODALAI_FC_V2 | ||
modalai_hw_detect_v2(hw_type); | ||
#else | ||
modalai_hw_detect_v1(hw_type); | ||
#endif | ||
|
||
return 0; | ||
} | ||
|
||
#ifdef MODALAI_FC_V2 | ||
modalai_print_usage_v2(); | ||
#else | ||
modalai_print_usage_v1(); | ||
#endif | ||
return -EINVAL; | ||
} |
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.
Was the internal mag dropped?
If nothing else it's useful having it to properly orient the external mag. The common modules from holybro and mro both use an ist8310, but it's mounted differently and we have no way to detect, so doing it at calibration time (relative to an internal) was the least bad option.
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.
I seem to remember that it was giving us some grief but I don't remember exactly what that was so I'll ask around and see what the specific issue was.
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.
I think the flight test team just said that it was super noisy? Perhaps the idea is that you enable it but set SYS_HAS_MAG and MAG_TYPE parameters to not use it unless you have a secondary unit and then you just use the internal one for reference?
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.
How is internal mag used on Pixhawks in general? Just as a reference or as the actual primary source?
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.
Not sure how having the internal one enabled helps the calibration figure out the orientation. I just tried calibrating the external compass with and without the internal one enabled and in neither case did it determine the proper rotation of the external compass.
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.
Per our discussion I will leave this disabled for now