From c17514cf858c0f1e59911b1618b2079db81bb2a6 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 13 Jun 2018 20:27:47 +1000 Subject: [PATCH] Sub: use AP_FWVersion singleton --- ArduSub/GCS_Mavlink.cpp | 5 ----- ArduSub/GCS_Mavlink.h | 1 - ArduSub/Sub.cpp | 2 +- ArduSub/system.cpp | 2 +- ArduSub/version.cpp | 9 ++++++++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ArduSub/GCS_Mavlink.cpp b/ArduSub/GCS_Mavlink.cpp index b3c4e29c78..fd1d2fec71 100644 --- a/ArduSub/GCS_Mavlink.cpp +++ b/ArduSub/GCS_Mavlink.cpp @@ -1369,11 +1369,6 @@ bool GCS_MAVLINK_Sub::set_mode(uint8_t mode) return sub.set_mode((control_mode_t)mode, MODE_REASON_GCS_COMMAND); } -const AP_FWVersion &GCS_MAVLINK_Sub::get_fwver() const -{ - return sub.fwver; -} - int32_t GCS_MAVLINK_Sub::global_position_int_alt() const { if (!sub.ap.depth_sensor_present) { return 0; diff --git a/ArduSub/GCS_Mavlink.h b/ArduSub/GCS_Mavlink.h index c609f4b248..8dd67e158c 100644 --- a/ArduSub/GCS_Mavlink.h +++ b/ArduSub/GCS_Mavlink.h @@ -16,7 +16,6 @@ protected: AP_Mission *get_mission() override; AP_Rally *get_rally() const override; AP_Camera *get_camera() const override; - const AP_FWVersion &get_fwver() const override; MAV_RESULT handle_flight_termination(const mavlink_command_long_t &packet) override; diff --git a/ArduSub/Sub.cpp b/ArduSub/Sub.cpp index ac7a772cfa..833d31fb91 100644 --- a/ArduSub/Sub.cpp +++ b/ArduSub/Sub.cpp @@ -24,7 +24,7 @@ const AP_HAL::HAL& hal = AP_HAL::get_HAL(); constructor for main Sub class */ Sub::Sub(void) - : DataFlash(fwver.fw_string, g.log_bitmask), + : DataFlash(g.log_bitmask), control_mode(MANUAL), motors(MAIN_LOOP_RATE), scaleLongDown(1), diff --git a/ArduSub/system.cpp b/ArduSub/system.cpp index 52bec52eda..cd868db73a 100644 --- a/ArduSub/system.cpp +++ b/ArduSub/system.cpp @@ -24,7 +24,7 @@ void Sub::init_ardupilot() hal.console->printf("\n\nInit %s" "\n\nFree RAM: %u\n", - fwver.fw_string, + AP::fwversion().fw_string, (unsigned)hal.util->available_memory()); // load parameters from EEPROM diff --git a/ArduSub/version.cpp b/ArduSub/version.cpp index 48bc1e6026..bbd1f6d777 100644 --- a/ArduSub/version.cpp +++ b/ArduSub/version.cpp @@ -21,7 +21,7 @@ #include -const AP_FWVersion Sub::fwver{ +const AP_FWVersion AP_FWVersion::fwver{ .major = FW_MAJOR, .minor = FW_MINOR, .patch = FW_PATCH, @@ -33,9 +33,16 @@ const AP_FWVersion Sub::fwver{ .fw_hash_str = GIT_VERSION, #endif #ifdef PX4_GIT_VERSION + .middleware_name = "PX4", .middleware_hash_str = PX4_GIT_VERSION, #endif #ifdef NUTTX_GIT_VERSION + .os_name = "NuttX", .os_hash_str = NUTTX_GIT_VERSION, +#elif defined(CHIBIOS_GIT_VERSION) + .middleware_name = nullptr, + .middleware_hash_str = nullptr, + .os_name = "ChibiOS", + .os_hash_str = CHIBIOS_GIT_VERSION, #endif };