mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 09:40:35 +08:00
mavlink: telemetry status only log simple HEARTBEAT validity
* delete telemetry_heartbeat msg * delete unused _telemetry_status_mutex
This commit is contained in:
@@ -355,18 +355,6 @@ Mavlink::get_instance_for_network_port(unsigned long port)
|
||||
}
|
||||
#endif // MAVLINK_UDP
|
||||
|
||||
bool
|
||||
Mavlink::is_connected()
|
||||
{
|
||||
for (auto &hb : _tstatus.heartbeats) {
|
||||
if ((hb.type == telemetry_heartbeat_s::TYPE_GCS) && (hrt_elapsed_time(&hb.timestamp) < 3_s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
Mavlink::destroy_all_instances()
|
||||
{
|
||||
@@ -2120,7 +2108,6 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
/* initialize send mutex */
|
||||
pthread_mutex_init(&_send_mutex, nullptr);
|
||||
pthread_mutex_init(&_telemetry_status_mutex, nullptr);
|
||||
|
||||
/* if we are passing on mavlink messages, we need to prepare a buffer for this instance */
|
||||
if (_forwarding_on) {
|
||||
@@ -2524,7 +2511,6 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
pthread_mutex_destroy(&_send_mutex);
|
||||
pthread_mutex_destroy(&_telemetry_status_mutex);
|
||||
|
||||
PX4_INFO("exiting channel %i", (int)_channel);
|
||||
|
||||
@@ -2618,11 +2604,9 @@ void Mavlink::publish_telemetry_status()
|
||||
_tstatus.streams = _streams.size();
|
||||
|
||||
// telemetry_status is also updated from the receiver thread, but never the same fields
|
||||
lock_telemetry_status();
|
||||
_tstatus.timestamp = hrt_absolute_time();
|
||||
_telem_status_pub.publish(_tstatus);
|
||||
_tstatus_updated = false;
|
||||
unlock_telemetry_status();
|
||||
}
|
||||
|
||||
void Mavlink::configure_sik_radio()
|
||||
@@ -2761,10 +2745,8 @@ Mavlink::start(int argc, char *argv[])
|
||||
void
|
||||
Mavlink::display_status()
|
||||
{
|
||||
for (const auto &hb : _tstatus.heartbeats) {
|
||||
if ((hb.timestamp > 0) && (hb.type == telemetry_heartbeat_s::TYPE_GCS)) {
|
||||
printf("\tGCS heartbeat:\t%llu us ago\n", (unsigned long long)hrt_elapsed_time(&hb.timestamp));
|
||||
}
|
||||
if (_tstatus.heartbeat_type_gcs) {
|
||||
printf("\tGCS heartbeat valid\n");
|
||||
}
|
||||
|
||||
printf("\tmavlink chan: #%u\n", _channel);
|
||||
|
||||
Reference in New Issue
Block a user