mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 04:53:34 +08:00
board_name.c: remove the file and HW_ARCH macro, use px4_board_name() instead
boards define BOARD_NAME, so board_name() is not necessary. HW_ARCH was just a wrapper around board_name(). This patch simplifies to having only one common method px4_board_name().
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include <px4_sem.h>
|
||||
#include <systemlib/mavlink_log.h>
|
||||
#include <replay/definitions.hpp>
|
||||
#include <version/version.h>
|
||||
|
||||
#ifdef __PX4_DARWIN
|
||||
#include <sys/param.h>
|
||||
@@ -1361,7 +1362,7 @@ void Logger::write_header()
|
||||
void Logger::write_version()
|
||||
{
|
||||
write_info("ver_sw", PX4_GIT_VERSION_STR);
|
||||
write_info("ver_hw", HW_ARCH);
|
||||
write_info("ver_hw", px4_board_name());
|
||||
write_info("sys_name", "PX4");
|
||||
int32_t utc_offset = 0;
|
||||
|
||||
|
||||
@@ -874,7 +874,7 @@ int write_version(int fd)
|
||||
|
||||
/* fill version message and write it */
|
||||
strncpy(log_msg_VER.body.fw_git, px4_git_version, sizeof(log_msg_VER.body.fw_git));
|
||||
strncpy(log_msg_VER.body.arch, HW_ARCH, sizeof(log_msg_VER.body.arch));
|
||||
strncpy(log_msg_VER.body.arch, px4_board_name(), sizeof(log_msg_VER.body.arch));
|
||||
return write(fd, &log_msg_VER, sizeof(log_msg_VER));
|
||||
}
|
||||
|
||||
|
||||
@@ -183,14 +183,14 @@ int UavcanNode::getHardwareVersion(uavcan::protocol::HardwareVersion &hwver)
|
||||
int rv = -1;
|
||||
|
||||
if (UavcanNode::instance()) {
|
||||
if (!std::strncmp(HW_ARCH, "PX4FMU_V1", 9)) {
|
||||
if (!std::strncmp(px4_board_name(), "PX4FMU_V1", 9)) {
|
||||
hwver.major = 1;
|
||||
|
||||
} else if (!std::strncmp(HW_ARCH, "PX4FMU_V2", 9)) {
|
||||
} else if (!std::strncmp(px4_board_name(), "PX4FMU_V2", 9)) {
|
||||
hwver.major = 2;
|
||||
|
||||
} else {
|
||||
; // All other values of HW_ARCH resolve to zero
|
||||
; // All other values of px4_board_name() resolve to zero
|
||||
}
|
||||
|
||||
uint8_t udid[12] = {}; // Someone seems to love magic numbers
|
||||
|
||||
Reference in New Issue
Block a user