AP_BoardConfig: Added ignore board validation

Added the ability to ignore board validation. This has been added to the 7th bit in BRD_OPTIONS
This commit is contained in:
Hayden 2023-04-26 14:09:24 +10:00 committed by Andrew Tridgell
parent 530e665c4d
commit 10038a64be
3 changed files with 10 additions and 7 deletions

View File

@ -287,7 +287,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = {
// @Param: OPTIONS // @Param: OPTIONS
// @DisplayName: Board options // @DisplayName: Board options
// @Description: Board specific option flags // @Description: Board specific option flags
// @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters, 3:Enable Debug Pins, 4:Unlock flash on reboot, 5:Write protect firmware flash on reboot, 6:Write protect bootloader flash on reboot // @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters, 3:Enable Debug Pins, 4:Unlock flash on reboot, 5:Write protect firmware flash on reboot, 6:Write protect bootloader flash on reboot, 7:Skip board validation
// @User: Advanced // @User: Advanced
AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT), AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT),

View File

@ -142,6 +142,7 @@ public:
UNLOCK_FLASH = (1<<4), UNLOCK_FLASH = (1<<4),
WRITE_PROTECT_FLASH = (1<<5), WRITE_PROTECT_FLASH = (1<<5),
WRITE_PROTECT_BOOTLOADER = (1<<6), WRITE_PROTECT_BOOTLOADER = (1<<6),
SKIP_BOARD_VALIDATION = (1<<7)
}; };
// return true if ftp is disabled // return true if ftp is disabled

View File

@ -301,6 +301,7 @@ void AP_BoardConfig::validate_board_type(void)
void AP_BoardConfig::board_autodetect(void) void AP_BoardConfig::board_autodetect(void)
{ {
#if defined(HAL_VALIDATE_BOARD) #if defined(HAL_VALIDATE_BOARD)
if((_options & SKIP_BOARD_VALIDATION) == 0) {
const char* errored_check = HAL_VALIDATE_BOARD; const char* errored_check = HAL_VALIDATE_BOARD;
if (errored_check == nullptr) { if (errored_check == nullptr) {
return; return;
@ -308,6 +309,7 @@ void AP_BoardConfig::board_autodetect(void)
config_error("Board Validation %s Failed", errored_check); config_error("Board Validation %s Failed", errored_check);
return; return;
} }
}
#endif #endif
if (state.board_type != PX4_BOARD_AUTO) { if (state.board_type != PX4_BOARD_AUTO) {