mavlink: stop unnecessarily passing around time

This commit is contained in:
Daniel Agar
2020-10-09 10:30:30 -04:00
parent 97cf714c7a
commit f26d4f2b6b
22 changed files with 87 additions and 87 deletions
@@ -53,7 +53,7 @@ public:
private:
explicit MavlinkStreamAutopilotVersion(Mavlink *mavlink) : MavlinkStream(mavlink) {}
bool send(const hrt_abstime t) override
bool send() override
{
return _mavlink->send_autopilot_capabilities();
}
+1 -1
View File
@@ -59,7 +59,7 @@ private:
uORB::Subscription _esc_status_sub{ORB_ID(esc_status)};
uint8_t _number_of_batches{0};
bool send(const hrt_abstime t) override
bool send() override
{
static constexpr uint8_t batch_size = MAVLINK_MSG_ESC_INFO_FIELD_TEMPERATURE_LEN;
esc_status_s esc_status;
+1 -1
View File
@@ -59,7 +59,7 @@ private:
uORB::Subscription _esc_status_sub{ORB_ID(esc_status)};
uint8_t _number_of_batches{0};
bool send(const hrt_abstime t) override
bool send() override
{
static constexpr uint8_t batch_size = MAVLINK_MSG_ESC_STATUS_FIELD_RPM_LEN;
esc_status_s esc_status;
@@ -63,7 +63,7 @@ private:
uORB::Subscription _control_mode_sub{ORB_ID(vehicle_control_mode)};
mavlink_extended_sys_state_t _msg{};
bool send(const hrt_abstime t) override
bool send() override
{
bool updated = false;
@@ -61,7 +61,7 @@ private:
uORB::Subscription _armed_sub{ORB_ID(actuator_armed)};
param_t _param_com_flight_uuid;
bool send(const hrt_abstime t) override
bool send() override
{
actuator_armed_s actuator_armed{};
bool ret = _armed_sub.copy(&actuator_armed);
@@ -97,8 +97,10 @@ private:
bool connected{false};
};
bool send(const hrt_abstime t) override
bool send() override
{
const hrt_abstime t = hrt_absolute_time();
// only send the struct if transmitting is allowed
// this assures that the stream timer is only reset when actually a message is transmitted
if (_mavlink->should_transmit()) {
@@ -53,7 +53,7 @@ public:
private:
explicit MavlinkStreamProtocolVersion(Mavlink *mavlink) : MavlinkStream(mavlink) {}
bool send(const hrt_abstime t) override
bool send() override
{
_mavlink->send_protocol_version();
return true;
+1 -1
View File
@@ -57,7 +57,7 @@ private:
uORB::Subscription _rpm_sub{ORB_ID(rpm)};
bool send(const hrt_abstime t) override
bool send() override
{
rpm_s rpm;
@@ -63,14 +63,14 @@ public:
float param5, float param6, float param7) override
{
_storage_id = (int)roundf(param2);
return send(hrt_absolute_time());
return send();
}
private:
explicit MavlinkStreamStorageInformation(Mavlink *mavlink) : MavlinkStream(mavlink) {}
int _storage_id{0};
bool send(const hrt_abstime t) override
bool send() override
{
mavlink_storage_information_t storage_info{};
const char *microsd_dir = PX4_STORAGEDIR;
@@ -103,7 +103,7 @@ private:
return false; // results in MAV_RESULT_DENIED
}
storage_info.time_boot_ms = t / 1000;
storage_info.time_boot_ms = hrt_absolute_time() / 1000;
mavlink_msg_storage_information_send_struct(_mavlink->get_channel(), &storage_info);
return true;
}