mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 03:53:34 +08:00
mavlink: stop unnecessarily passing around time
This commit is contained in:
@@ -956,7 +956,7 @@ MavlinkFTP::_copy_file(const char *src_path, const char *dst_path, size_t length
|
||||
return (length > 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
void MavlinkFTP::send(const hrt_abstime t)
|
||||
void MavlinkFTP::send()
|
||||
{
|
||||
|
||||
if (_work_buffer1 || _work_buffer2) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
* Handle sending of messages. Call this regularly at a fixed frequency.
|
||||
* @param t current time
|
||||
*/
|
||||
void send(const hrt_abstime t);
|
||||
void send();
|
||||
|
||||
/// Handle possible FTP message
|
||||
void handle_message(const mavlink_message_t *msg);
|
||||
|
||||
@@ -115,7 +115,7 @@ MavlinkLogHandler::handle_message(const mavlink_message_t *msg)
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void
|
||||
MavlinkLogHandler::send(const hrt_abstime /*t*/)
|
||||
MavlinkLogHandler::send()
|
||||
{
|
||||
//-- An arbitrary count of max bytes in one go (one of the two below but never both)
|
||||
#define MAX_BYTES_SEND 256 * 1024
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
* Handle sending of messages. Call this regularly at a fixed frequency.
|
||||
* @param t current time
|
||||
*/
|
||||
void send(const hrt_abstime t);
|
||||
void send();
|
||||
|
||||
unsigned get_size();
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ protected:
|
||||
explicit MavlinkStreamHeartbeat(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
// always send the heartbeat, independent of the update status of the topics
|
||||
vehicle_status_s status{};
|
||||
@@ -499,7 +499,7 @@ protected:
|
||||
explicit MavlinkStreamStatustext(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (!_mavlink->get_logbuffer()->empty() && _mavlink->is_connected()) {
|
||||
|
||||
@@ -591,7 +591,7 @@ protected:
|
||||
explicit MavlinkStreamCommandLong(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
struct vehicle_command_s cmd;
|
||||
bool sent = false;
|
||||
@@ -662,7 +662,7 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_status_sub.updated() || _cpuload_sub.updated() || _battery_status_subs.updated()) {
|
||||
vehicle_status_s status{};
|
||||
@@ -766,7 +766,7 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
@@ -890,7 +890,7 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
@@ -977,7 +977,7 @@ protected:
|
||||
explicit MavlinkStreamHighresIMU(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
@@ -1098,7 +1098,7 @@ protected:
|
||||
explicit MavlinkStreamScaledPressureBase(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_sensor_baro_sub.updated() || _differential_pressure_sub.updated()) {
|
||||
sensor_baro_s sensor_baro{};
|
||||
@@ -1258,7 +1258,7 @@ protected:
|
||||
explicit MavlinkStreamScaledIMU(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_raw_imu_sub.updated() || _raw_mag_sub.updated()) {
|
||||
|
||||
@@ -1344,7 +1344,7 @@ protected:
|
||||
explicit MavlinkStreamScaledIMU2(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_raw_imu_sub.updated() || _raw_mag_sub.updated()) {
|
||||
|
||||
@@ -1429,7 +1429,7 @@ protected:
|
||||
explicit MavlinkStreamScaledIMU3(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_raw_imu_sub.updated() || _raw_mag_sub.updated()) {
|
||||
|
||||
@@ -1517,7 +1517,7 @@ protected:
|
||||
explicit MavlinkStreamAttitude(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_attitude_s att;
|
||||
|
||||
@@ -1593,7 +1593,7 @@ protected:
|
||||
explicit MavlinkStreamAttitudeQuaternion(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_attitude_s att;
|
||||
|
||||
@@ -1695,7 +1695,7 @@ protected:
|
||||
explicit MavlinkStreamVFRHUD(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_lpos_sub.updated() || _airspeed_validated_sub.updated()) {
|
||||
|
||||
@@ -1804,7 +1804,7 @@ protected:
|
||||
explicit MavlinkStreamGPSRawInt(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
sensor_gps_s gps;
|
||||
|
||||
@@ -1880,7 +1880,7 @@ protected:
|
||||
explicit MavlinkStreamGPS2Raw(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
sensor_gps_s gps;
|
||||
|
||||
@@ -1951,7 +1951,7 @@ protected:
|
||||
explicit MavlinkStreamSystemTime(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
timespec tv;
|
||||
px4_clock_gettime(CLOCK_REALTIME, &tv);
|
||||
@@ -2013,7 +2013,7 @@ protected:
|
||||
explicit MavlinkStreamTimesync(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
mavlink_timesync_t msg{};
|
||||
|
||||
@@ -2075,7 +2075,7 @@ protected:
|
||||
explicit MavlinkStreamADSBVehicle(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
transponder_report_s pos;
|
||||
bool sent = false;
|
||||
@@ -2175,7 +2175,7 @@ protected:
|
||||
explicit MavlinkStreamUTMGlobalPosition(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_global_position_s global_pos;
|
||||
|
||||
@@ -2342,7 +2342,7 @@ protected:
|
||||
explicit MavlinkStreamCollision(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
collision_report_s report;
|
||||
bool sent = false;
|
||||
@@ -2415,7 +2415,7 @@ protected:
|
||||
explicit MavlinkStreamCameraTrigger(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
camera_trigger_s trigger;
|
||||
|
||||
@@ -2520,7 +2520,7 @@ protected:
|
||||
explicit MavlinkStreamCameraImageCaptured(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
camera_capture_s capture;
|
||||
|
||||
@@ -2599,7 +2599,7 @@ protected:
|
||||
explicit MavlinkStreamGlobalPositionInt(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_global_position_s gpos;
|
||||
vehicle_local_position_s lpos;
|
||||
@@ -2707,7 +2707,7 @@ protected:
|
||||
explicit MavlinkStreamOdometry(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_odometry_s odom;
|
||||
// check if it is to send visual odometry loopback or not
|
||||
@@ -2857,7 +2857,7 @@ protected:
|
||||
explicit MavlinkStreamLocalPositionNED(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_local_position_s lpos;
|
||||
|
||||
@@ -2925,7 +2925,7 @@ protected:
|
||||
explicit MavlinkStreamEstimatorStatus(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
estimator_status_s est;
|
||||
|
||||
@@ -3005,7 +3005,7 @@ protected:
|
||||
explicit MavlinkStreamVibration(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_sensor_selection_sub.updated() || _vehicle_imu_status_subs.updated()) {
|
||||
|
||||
@@ -3113,7 +3113,7 @@ protected:
|
||||
explicit MavlinkStreamAttPosMocap(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_odometry_s mocap;
|
||||
|
||||
@@ -3183,7 +3183,7 @@ protected:
|
||||
explicit MavlinkStreamHomePosition(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
/* we're sending the GPS home periodically to ensure the
|
||||
* the GCS does pick it up at one point */
|
||||
@@ -3275,7 +3275,7 @@ protected:
|
||||
explicit MavlinkStreamServoOutputRaw(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
actuator_outputs_s act;
|
||||
|
||||
@@ -3394,7 +3394,7 @@ protected:
|
||||
delete _act_ctrl_sub;
|
||||
}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
actuator_controls_s act_ctrl;
|
||||
|
||||
@@ -3462,7 +3462,7 @@ protected:
|
||||
explicit MavlinkStreamHILActuatorControls(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
actuator_outputs_s act;
|
||||
|
||||
@@ -3620,7 +3620,7 @@ protected:
|
||||
explicit MavlinkStreamPositionTargetGlobalInt(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_control_mode_s control_mode{};
|
||||
_control_mode_sub.copy(&control_mode);
|
||||
@@ -3714,7 +3714,7 @@ protected:
|
||||
explicit MavlinkStreamLocalPositionSetpoint(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_local_position_setpoint_s pos_sp;
|
||||
|
||||
@@ -3790,7 +3790,7 @@ protected:
|
||||
explicit MavlinkStreamAttitudeTarget(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_attitude_setpoint_s att_sp;
|
||||
|
||||
@@ -3864,7 +3864,7 @@ protected:
|
||||
explicit MavlinkStreamRCChannels(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
input_rc_s rc;
|
||||
|
||||
@@ -3950,7 +3950,7 @@ protected:
|
||||
explicit MavlinkStreamManualControl(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
manual_control_setpoint_s manual_control_setpoint;
|
||||
|
||||
@@ -4028,7 +4028,7 @@ protected:
|
||||
explicit MavlinkStreamTrajectoryRepresentationWaypoints(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_trajectory_waypoint_s traj_wp_avoidance_desired;
|
||||
|
||||
@@ -4132,7 +4132,7 @@ protected:
|
||||
explicit MavlinkStreamOpticalFlowRad(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
optical_flow_s flow;
|
||||
|
||||
@@ -4206,7 +4206,7 @@ protected:
|
||||
explicit MavlinkStreamNamedValueFloat(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
debug_key_value_s debug;
|
||||
|
||||
@@ -4272,7 +4272,7 @@ protected:
|
||||
explicit MavlinkStreamDebug(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
debug_value_s debug;
|
||||
|
||||
@@ -4335,7 +4335,7 @@ protected:
|
||||
explicit MavlinkStreamDebugVect(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
debug_vect_s debug;
|
||||
|
||||
@@ -4403,7 +4403,7 @@ protected:
|
||||
explicit MavlinkStreamDebugFloatArray(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
debug_array_s debug;
|
||||
|
||||
@@ -4475,7 +4475,7 @@ protected:
|
||||
explicit MavlinkStreamNavControllerOutput(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_pos_ctrl_status_sub.updated()) {
|
||||
|
||||
@@ -4549,7 +4549,7 @@ protected:
|
||||
explicit MavlinkStreamCameraCapture(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
vehicle_status_s status;
|
||||
|
||||
@@ -4620,7 +4620,7 @@ protected:
|
||||
explicit MavlinkStreamDistanceSensor(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
@@ -4713,7 +4713,7 @@ protected:
|
||||
explicit MavlinkStreamAltitude(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
mavlink_altitude_t msg{};
|
||||
|
||||
@@ -4830,7 +4830,7 @@ protected:
|
||||
explicit MavlinkStreamWind(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
wind_estimate_s wind_estimate;
|
||||
|
||||
@@ -4907,7 +4907,7 @@ protected:
|
||||
explicit MavlinkStreamMountOrientation(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
mount_orientation_s mount_orientation;
|
||||
|
||||
@@ -4979,7 +4979,7 @@ protected:
|
||||
explicit MavlinkStreamGroundTruth(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
if (_angular_velocity_sub.updated() || _att_sub.updated() || _gpos_sub.updated() || _lpos_sub.updated()) {
|
||||
vehicle_attitude_s att{};
|
||||
@@ -5078,7 +5078,7 @@ protected:
|
||||
_sequence(0)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
mavlink_ping_t msg = {};
|
||||
|
||||
@@ -5137,7 +5137,7 @@ protected:
|
||||
explicit MavlinkStreamOrbitStatus(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
orbit_status_s _orbit_status;
|
||||
|
||||
@@ -5203,7 +5203,7 @@ protected:
|
||||
explicit MavlinkStreamObstacleDistance(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send(const hrt_abstime t) override
|
||||
bool send() override
|
||||
{
|
||||
obstacle_distance_s obstacle_distance;
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ MavlinkMissionManager::send_mission_item_reached(uint16_t seq)
|
||||
}
|
||||
|
||||
void
|
||||
MavlinkMissionManager::send(const hrt_abstime now)
|
||||
MavlinkMissionManager::send()
|
||||
{
|
||||
// do not send anything over high latency communication
|
||||
if (_mavlink->get_mode() == Mavlink::MAVLINK_MODE_IRIDIUM) {
|
||||
@@ -501,7 +501,7 @@ MavlinkMissionManager::send(const hrt_abstime now)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_slow_rate_limiter.check(now)) {
|
||||
if (_slow_rate_limiter.check(hrt_absolute_time())) {
|
||||
send_mission_current(_current_seq);
|
||||
|
||||
// send the reached message another 10 times
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
* Handle sending of messages. Call this regularly at a fixed frequency.
|
||||
* @param t current time
|
||||
*/
|
||||
void send(const hrt_abstime t);
|
||||
void send();
|
||||
|
||||
void handle_message(const mavlink_message_t *msg);
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg)
|
||||
}
|
||||
|
||||
void
|
||||
MavlinkParametersManager::send(const hrt_abstime t)
|
||||
MavlinkParametersManager::send()
|
||||
{
|
||||
int max_num_to_send;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
* Handle sending of messages. Call this regularly at a fixed frequency.
|
||||
* @param t current time
|
||||
*/
|
||||
void send(const hrt_abstime t);
|
||||
void send();
|
||||
|
||||
unsigned get_size();
|
||||
|
||||
|
||||
@@ -2997,15 +2997,15 @@ MavlinkReceiver::Run()
|
||||
|
||||
if (t - last_send_update > timeout * 1000) {
|
||||
_mission_manager.check_active_mission();
|
||||
_mission_manager.send(t);
|
||||
_mission_manager.send();
|
||||
|
||||
_parameters_manager.send(t);
|
||||
_parameters_manager.send();
|
||||
|
||||
if (_mavlink->ftp_enabled()) {
|
||||
_mavlink_ftp.send(t);
|
||||
_mavlink_ftp.send();
|
||||
}
|
||||
|
||||
_mavlink_log_handler.send(t);
|
||||
_mavlink_log_handler.send();
|
||||
last_send_update = t;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ MavlinkStream::update(const hrt_abstime &t)
|
||||
// this will give different messages on the same run a different
|
||||
// initial timestamp which will help spacing them out
|
||||
// on the link scheduling
|
||||
if (send(t)) {
|
||||
if (send()) {
|
||||
_last_sent = hrt_absolute_time();
|
||||
|
||||
if (!_first_message_sent) {
|
||||
@@ -112,7 +112,7 @@ MavlinkStream::update(const hrt_abstime &t)
|
||||
// do not use the actual time but increment at a fixed rate, so that processing delays do not
|
||||
// distort the average rate. The check of the maximum interval is done to ensure that after a
|
||||
// long time not sending anything, sending multiple messages in a short time is avoided.
|
||||
if (send(t)) {
|
||||
if (send()) {
|
||||
_last_sent = ((interval > 0) && ((int64_t)(1.5f * interval) > dt)) ? _last_sent + interval : t;
|
||||
|
||||
if (!_first_message_sent) {
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
virtual bool request_message(float param2 = 0.0, float param3 = 0.0, float param4 = 0.0,
|
||||
float param5 = 0.0, float param6 = 0.0, float param7 = 0.0)
|
||||
{
|
||||
return send(hrt_absolute_time());
|
||||
return send();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ protected:
|
||||
Mavlink *const _mavlink;
|
||||
int _interval{1000000}; ///< if set to negative value = unlimited rate
|
||||
|
||||
virtual bool send(const hrt_abstime t) = 0;
|
||||
virtual bool send() = 0;
|
||||
|
||||
/**
|
||||
* Function to collect/update data for the streams at a high rate independant of
|
||||
|
||||
@@ -619,8 +619,7 @@ bool MavlinkFtpTest::_burst_test()
|
||||
_ftp_server->handle_message(&msg);
|
||||
|
||||
// First packet is sent using stream mechanism, so we need to force it out ourselves
|
||||
hrt_abstime t = 0;
|
||||
_ftp_server->send(t);
|
||||
_ftp_server->send();
|
||||
|
||||
ut_compare("Incorrect sequence of messages", burst_info.burst_state, burst_state_complete);
|
||||
|
||||
@@ -876,7 +875,6 @@ void MavlinkFtpTest::receive_message_handler_burst(const mavlink_file_transfer_p
|
||||
bool MavlinkFtpTest::_receive_message_handler_burst(const mavlink_file_transfer_protocol_t *ftp_msg,
|
||||
BurstInfo *burst_info)
|
||||
{
|
||||
hrt_abstime t = 0;
|
||||
const MavlinkFTP::PayloadHeader *reply{nullptr};
|
||||
uint32_t full_packet_bytes = MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader);
|
||||
uint32_t expected_bytes;
|
||||
@@ -897,7 +895,7 @@ bool MavlinkFtpTest::_receive_message_handler_burst(const mavlink_file_transfer_
|
||||
burst_info->burst_state = burst_info->single_packet_file ? burst_state_nak_eof : burst_state_last_ack;
|
||||
|
||||
ut_assert("Remaining stream packets missing", _ftp_server->get_size());
|
||||
_ftp_server->send(t);
|
||||
_ftp_server->send();
|
||||
break;
|
||||
|
||||
case burst_state_last_ack:
|
||||
@@ -913,7 +911,7 @@ bool MavlinkFtpTest::_receive_message_handler_burst(const mavlink_file_transfer_
|
||||
burst_info->burst_state = burst_state_nak_eof;
|
||||
|
||||
ut_assert("Remaining stream packets missing", _ftp_server->get_size());
|
||||
_ftp_server->send(t);
|
||||
_ftp_server->send();
|
||||
break;
|
||||
|
||||
case burst_state_nak_eof:
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user