aboutsummaryrefslogtreecommitdiff
path: root/src/modules/uavcan/uavcan_main.cpp
diff options
context:
space:
mode:
authorPavel Kirienko <pavel.kirienko@gmail.com>2014-08-02 03:34:57 +0400
committerPavel Kirienko <pavel.kirienko@gmail.com>2014-08-02 03:34:57 +0400
commit9725a1635254ba6c0c1df0413f94398ec28e23f9 (patch)
tree3c81941289edef1a9e9f9b5ec0e881b337a83099 /src/modules/uavcan/uavcan_main.cpp
parentb606674fc77aa772fba66ad09dd3879a62a7f44c (diff)
downloadpx4-firmware-9725a1635254ba6c0c1df0413f94398ec28e23f9.tar.gz
px4-firmware-9725a1635254ba6c0c1df0413f94398ec28e23f9.tar.bz2
px4-firmware-9725a1635254ba6c0c1df0413f94398ec28e23f9.zip
UAVCAN: Fixed short git hash computation
Diffstat (limited to 'src/modules/uavcan/uavcan_main.cpp')
-rw-r--r--src/modules/uavcan/uavcan_main.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp
index ffd599070..9d5404baf 100644
--- a/src/modules/uavcan/uavcan_main.cpp
+++ b/src/modules/uavcan/uavcan_main.cpp
@@ -180,16 +180,13 @@ void UavcanNode::fill_node_info()
/* software version */
uavcan::protocol::SoftwareVersion swver;
- // Extracting the last 8 hex digits of FW_GIT and converting them to int
- const unsigned fw_git_len = std::strlen(FW_GIT);
- if (fw_git_len >= 8) {
- char fw_git_short[9] = {};
- std::memmove(fw_git_short, FW_GIT + fw_git_len - 8, 8);
- assert(fw_git_short[8] == '\0');
- char *end = nullptr;
- swver.vcs_commit = std::strtol(fw_git_short, &end, 16);
- swver.optional_field_mask |= swver.OPTIONAL_FIELD_MASK_VCS_COMMIT;
- }
+ // Extracting the first 8 hex digits of FW_GIT and converting them to int
+ char fw_git_short[9] = {};
+ std::memmove(fw_git_short, FW_GIT, 8);
+ assert(fw_git_short[8] == '\0');
+ char *end = nullptr;
+ swver.vcs_commit = std::strtol(fw_git_short, &end, 16);
+ swver.optional_field_mask |= swver.OPTIONAL_FIELD_MASK_VCS_COMMIT;
warnx("SW version vcs_commit: 0x%08x", unsigned(swver.vcs_commit));