From 24e90e3c9054674f191489d236cb962456045b72 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 7 Aug 2016 14:25:43 +0300 Subject: [PATCH] UAVCAN servers: fixed member initialization; removed dead stuff --- src/modules/uavcan/uavcan_servers.cpp | 18 -------------- src/modules/uavcan/uavcan_servers.hpp | 35 +++++++++++++-------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/modules/uavcan/uavcan_servers.cpp b/src/modules/uavcan/uavcan_servers.cpp index 7206e739cd..cc804ed34d 100644 --- a/src/modules/uavcan/uavcan_servers.cpp +++ b/src/modules/uavcan/uavcan_servers.cpp @@ -88,32 +88,14 @@ UavcanServers::UavcanServers(uavcan::INode &main_node) : _vdriver(NumIfaces, uavcan_stm32::SystemClock::instance(), main_node.getAllocator(), VirtualIfaceBlockAllocationQuota), _subnode(_vdriver, uavcan_stm32::SystemClock::instance(), main_node.getAllocator()), _main_node(main_node), - _tracer(), - _storage_backend(), - _fw_version_checker(), _server_instance(_subnode, _storage_backend, _tracer), _fileserver_backend(_subnode), _node_info_retriever(_subnode), _fw_upgrade_trigger(_subnode, _fw_version_checker), _fw_server(_subnode, _fileserver_backend), - _count_in_progress(false), - _count_index(0), - _param_in_progress(0), - _param_index(0), - _param_list_in_progress(false), - _param_list_all_nodes(false), - _param_list_node_id(1), - _param_dirty_bitmap{0, 0, 0, 0}, - _param_save_opcode(0), - _cmd_in_progress(false), - _param_response_pub(nullptr), _param_getset_client(_subnode), _param_opcode_client(_subnode), _param_restartnode_client(_subnode), - _mutex_inited(false), - _check_fw(false), - _esc_enumeration_active(false), - _esc_enumeration_index(0), _beep_pub(_subnode), _enumeration_indication_sub(_subnode), _enumeration_client(_subnode), diff --git a/src/modules/uavcan/uavcan_servers.hpp b/src/modules/uavcan/uavcan_servers.hpp index be3d53ec9e..b3e37b3861 100644 --- a/src/modules/uavcan/uavcan_servers.hpp +++ b/src/modules/uavcan/uavcan_servers.hpp @@ -142,23 +142,23 @@ private: * * The node's UAVCAN ID is used as the index into the _param_counts array. */ - uint8_t _param_counts[128]; - bool _count_in_progress; - uint8_t _count_index; + uint8_t _param_counts[128] = {}; + bool _count_in_progress = false; + uint8_t _count_index = 0; - bool _param_in_progress; - uint8_t _param_index; - bool _param_list_in_progress; - bool _param_list_all_nodes; - uint8_t _param_list_node_id; + bool _param_in_progress = false; + uint8_t _param_index = 0; + bool _param_list_in_progress = false; + bool _param_list_all_nodes = false; + uint8_t _param_list_node_id = 1; - uint32_t _param_dirty_bitmap[4]; - uint8_t _param_save_opcode; + uint32_t _param_dirty_bitmap[4] = {}; + uint8_t _param_save_opcode = 0; - bool _cmd_in_progress; + bool _cmd_in_progress = false; // uORB topic handle for MAVLink parameter responses - orb_advert_t _param_response_pub; + orb_advert_t _param_response_pub = nullptr; typedef uavcan::MethodBinder &)> GetSetCallback; @@ -185,15 +185,14 @@ private: void beep(float frequency); - bool _mutex_inited; - volatile bool _check_fw; + bool _mutex_inited = false; + volatile bool _check_fw = false; // ESC enumeration - bool _esc_enumeration_active; + bool _esc_enumeration_active = false; uint8_t _esc_enumeration_ids[uavcan::equipment::esc::RawCommand::FieldTypes::cmd::MaxSize]; - uint8_t _esc_enumeration_index; - uint8_t _esc_set_index; - uint8_t _esc_count; + uint8_t _esc_enumeration_index = 0; + uint8_t _esc_count = 0; typedef uavcan::MethodBinder &)> EnumerationBeginCallback;