From 02a4d93c7485eaffe0a8d2c88c2067a26538056a Mon Sep 17 00:00:00 2001 From: Peter van der Perk Date: Tue, 13 Apr 2021 16:37:29 +0200 Subject: [PATCH] [UAVCANv1] snprintf and cleanup ram usage ~4KB --- src/drivers/uavcan_v1/Publishers/Publisher.hpp | 1 - src/drivers/uavcan_v1/Subscribers/DynamicPortSubscriber.hpp | 2 +- src/drivers/uavcan_v1/Uavcan.hpp | 4 ---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/drivers/uavcan_v1/Publishers/Publisher.hpp b/src/drivers/uavcan_v1/Publishers/Publisher.hpp index f31306c521..a33d51682a 100644 --- a/src/drivers/uavcan_v1/Publishers/Publisher.hpp +++ b/src/drivers/uavcan_v1/Publishers/Publisher.hpp @@ -94,7 +94,6 @@ public: protected: CanardInstance &_canard_instance; UavcanParamManager &_param_manager; - CanardRxSubscription _canard_sub; const char *_subject_name; uint8_t _instance {0}; diff --git a/src/drivers/uavcan_v1/Subscribers/DynamicPortSubscriber.hpp b/src/drivers/uavcan_v1/Subscribers/DynamicPortSubscriber.hpp index 89ae5431f6..dcd379f720 100644 --- a/src/drivers/uavcan_v1/Subscribers/DynamicPortSubscriber.hpp +++ b/src/drivers/uavcan_v1/Subscribers/DynamicPortSubscriber.hpp @@ -64,7 +64,7 @@ public: while (curSubj != NULL) { char uavcan_param[90]; - sprintf(uavcan_param, "uavcan.sub.%s.%d.id", curSubj->_subject_name, _instance); + snprintf(uavcan_param, sizeof(uavcan_param), "uavcan.sub.%s.%d.id", curSubj->_subject_name, _instance); // Set _port_id from _uavcan_param uavcan_register_Value_1_0 value; diff --git a/src/drivers/uavcan_v1/Uavcan.hpp b/src/drivers/uavcan_v1/Uavcan.hpp index da01b15427..9a8f960c7f 100644 --- a/src/drivers/uavcan_v1/Uavcan.hpp +++ b/src/drivers/uavcan_v1/Uavcan.hpp @@ -185,11 +185,7 @@ private: pthread_mutex_t _node_mutex; CanardRxSubscription _heartbeat_subscription; - CanardRxSubscription _pnp_v1_subscription; - CanardRxSubscription _drone_srv_battery_subscription; CanardRxSubscription _drone_srv_gps_subscription; - CanardRxSubscription _register_access_subscription; - CanardRxSubscription _register_list_subscription; uORB::Subscription _battery_status_sub{ORB_ID(battery_status)}; uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};