From 10038a64beed439ce95c438bbed6b76d27f96e96 Mon Sep 17 00:00:00 2001 From: Hayden Date: Wed, 26 Apr 2023 14:09:24 +1000 Subject: [PATCH] AP_BoardConfig: Added ignore board validation Added the ability to ignore board validation. This has been added to the 7th bit in BRD_OPTIONS --- libraries/AP_BoardConfig/AP_BoardConfig.cpp | 2 +- libraries/AP_BoardConfig/AP_BoardConfig.h | 1 + libraries/AP_BoardConfig/board_drivers.cpp | 14 ++++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.cpp b/libraries/AP_BoardConfig/AP_BoardConfig.cpp index ffa8eec12d..9234fb5ce6 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.cpp +++ b/libraries/AP_BoardConfig/AP_BoardConfig.cpp @@ -287,7 +287,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = { // @Param: OPTIONS // @DisplayName: Board options // @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 AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT), diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.h b/libraries/AP_BoardConfig/AP_BoardConfig.h index f190b6cf5d..1caa41f9ea 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.h +++ b/libraries/AP_BoardConfig/AP_BoardConfig.h @@ -142,6 +142,7 @@ public: UNLOCK_FLASH = (1<<4), WRITE_PROTECT_FLASH = (1<<5), WRITE_PROTECT_BOOTLOADER = (1<<6), + SKIP_BOARD_VALIDATION = (1<<7) }; // return true if ftp is disabled diff --git a/libraries/AP_BoardConfig/board_drivers.cpp b/libraries/AP_BoardConfig/board_drivers.cpp index 2fbae07b31..ed365120a0 100644 --- a/libraries/AP_BoardConfig/board_drivers.cpp +++ b/libraries/AP_BoardConfig/board_drivers.cpp @@ -301,12 +301,14 @@ void AP_BoardConfig::validate_board_type(void) void AP_BoardConfig::board_autodetect(void) { #if defined(HAL_VALIDATE_BOARD) - const char* errored_check = HAL_VALIDATE_BOARD; - if (errored_check == nullptr) { - return; - } else { - config_error("Board Validation %s Failed", errored_check); - return; + if((_options & SKIP_BOARD_VALIDATION) == 0) { + const char* errored_check = HAL_VALIDATE_BOARD; + if (errored_check == nullptr) { + return; + } else { + config_error("Board Validation %s Failed", errored_check); + return; + } } #endif