diff --git a/ArduSub/GCS_Mavlink.cpp b/ArduSub/GCS_Mavlink.cpp index cbaa476cc9..e8ae8e390c 100644 --- a/ArduSub/GCS_Mavlink.cpp +++ b/ArduSub/GCS_Mavlink.cpp @@ -888,7 +888,7 @@ void GCS_MAVLINK_Sub::handleMessage(mavlink_message_t* msg) case MAVLINK_MSG_ID_PARAM_REQUEST_LIST: { // MAV ID: 21 // mark the firmware version in the tlog - send_text(MAV_SEVERITY_INFO, FIRMWARE_STRING); + send_text(MAV_SEVERITY_INFO, fwver.fw_string); #if defined(PX4_GIT_VERSION) && defined(NUTTX_GIT_VERSION) send_text(MAV_SEVERITY_INFO, "PX4: " PX4_GIT_VERSION " NuttX: " NUTTX_GIT_VERSION); @@ -1271,7 +1271,7 @@ void GCS_MAVLINK_Sub::handleMessage(mavlink_message_t* msg) case MAV_CMD_DO_SEND_BANNER: { result = MAV_RESULT_ACCEPTED; - send_text(MAV_SEVERITY_INFO, FIRMWARE_STRING); + send_text(MAV_SEVERITY_INFO, fwver.fw_string); #if defined(PX4_GIT_VERSION) && defined(NUTTX_GIT_VERSION) send_text(MAV_SEVERITY_INFO, "PX4: " PX4_GIT_VERSION " NuttX: " NUTTX_GIT_VERSION); diff --git a/ArduSub/GCS_Mavlink.h b/ArduSub/GCS_Mavlink.h index 1a72b74365..4e58711b9f 100644 --- a/ArduSub/GCS_Mavlink.h +++ b/ArduSub/GCS_Mavlink.h @@ -20,6 +20,7 @@ protected: AP_Camera *get_camera() const override; AP_ServoRelayEvents *get_servorelayevents() const override; AP_GPS *get_gps() const override; + MAV_RESULT handle_flight_termination(const mavlink_command_long_t &packet) override; uint8_t sysid_my_gcs() const override; diff --git a/ArduSub/Sub.cpp b/ArduSub/Sub.cpp index afeabcfe81..491ff1b99c 100644 --- a/ArduSub/Sub.cpp +++ b/ArduSub/Sub.cpp @@ -21,7 +21,7 @@ const AP_HAL::HAL& hal = AP_HAL::get_HAL(); constructor for main Sub class */ Sub::Sub(void) : - DataFlash {FIRMWARE_STRING, g.log_bitmask}, + DataFlash {fwver.fw_string, g.log_bitmask}, mission(ahrs, FUNCTOR_BIND_MEMBER(&Sub::start_command, bool, const AP_Mission::Mission_Command &), FUNCTOR_BIND_MEMBER(&Sub::verify_command_callback, bool, const AP_Mission::Mission_Command &), diff --git a/ArduSub/Sub.h b/ArduSub/Sub.h index f7a9aedd93..cb49b55797 100644 --- a/ArduSub/Sub.h +++ b/ArduSub/Sub.h @@ -82,6 +82,7 @@ #include "Parameters.h" #include "AP_Arming_Sub.h" #include "GCS_Sub.h" +#include "version.h" // libraries which are dependent on #defines in defines.h and/or config.h #if OPTFLOW == ENABLED @@ -135,6 +136,19 @@ public: void loop() override; private: + + const AP_FWVersion fwver { + major: FW_MAJOR, + minor: FW_MINOR, + patch: FW_PATCH, + fw_type: FW_TYPE, +#ifndef GIT_VERSION + fw_string: THISFIRMWARE +#else + fw_string: THISFIRMWARE " (" GIT_VERSION ")" +#endif + }; + // key aircraft parameters passed to multiple libraries AP_Vehicle::MultiCopter aparm; diff --git a/ArduSub/system.cpp b/ArduSub/system.cpp index 0d36354a8d..7b4cb6928b 100644 --- a/ArduSub/system.cpp +++ b/ArduSub/system.cpp @@ -23,9 +23,10 @@ void Sub::init_ardupilot() // initialise serial port serial_manager.init_console(); - hal.console->printf("\n\nInit " FIRMWARE_STRING - "\n\nFree RAM: %u\n", - (unsigned)hal.util->available_memory()); + hal.console->printf("\n\nInit %s" + "\n\nFree RAM: %u\n", + fwver.fw_string, + (unsigned)hal.util->available_memory()); // load parameters from EEPROM load_parameters(); diff --git a/ArduSub/version.h b/ArduSub/version.h index 8790f6050b..8f72749471 100644 --- a/ArduSub/version.h +++ b/ArduSub/version.h @@ -1,12 +1,13 @@ #pragma once -#include "ap_version.h" +#include "AP_Common/AP_FWVersion.h" #define THISFIRMWARE "ArduSub V3.6-dev" + +// the following line is parsed by the autotest scripts #define FIRMWARE_VERSION 3,6,0,FIRMWARE_VERSION_TYPE_DEV -#ifndef GIT_VERSION -#define FIRMWARE_STRING THISFIRMWARE -#else -#define FIRMWARE_STRING THISFIRMWARE " (" GIT_VERSION ")" -#endif +#define FW_MAJOR 3 +#define FW_MINOR 6 +#define FW_PATCH 0 +#define FW_TYPE FIRMWARE_VERSION_TYPE_DEV