mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-12 17:41:36 +08:00
px4io: add RC update monotonic count and cleanup unused
This commit is contained in:
@@ -525,16 +525,9 @@ Syslink::handle_raw(syslink_message_t *sys)
|
||||
|
||||
crtp_commander *cmd = (crtp_commander *) &c->data[0];
|
||||
|
||||
input_rc_s rc = {};
|
||||
|
||||
rc.timestamp = hrt_absolute_time();
|
||||
rc.timestamp_last_signal = rc.timestamp;
|
||||
input_rc_s rc{};
|
||||
rc.timestamp_sample = hrt_absolute_time();
|
||||
rc.channel_count = 5;
|
||||
rc.rc_failsafe = false;
|
||||
rc.rc_lost = false;
|
||||
rc.rc_lost_frame_count = 0;
|
||||
rc.rc_total_frame_count = 1;
|
||||
rc.rc_ppm_frame_length = 0;
|
||||
rc.input_source = input_rc_s::RC_INPUT_SOURCE_MAVLINK;
|
||||
rc.rssi = _rssi;
|
||||
|
||||
@@ -548,6 +541,7 @@ Syslink::handle_raw(syslink_message_t *sys)
|
||||
rc.values[3] = cmd->thrust * 1000 / USHRT_MAX + 1000;
|
||||
rc.values[4] = 1000; // Dummy channel as px4 needs at least 5
|
||||
|
||||
rc.timestamp = hrt_absolute_time();
|
||||
_rc_pub.publish(rc);
|
||||
|
||||
} else if (c->port == CRTP_PORT_MAVLINK) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -119,8 +119,6 @@ void NavioSysRCInput::Run()
|
||||
connected_buf[sizeof(connected_buf) - 1] = '\0';
|
||||
_connected = (atoi(connected_buf) == 1);
|
||||
|
||||
data.rc_lost = !_connected;
|
||||
|
||||
uint64_t timestamp_sample = hrt_absolute_time();
|
||||
|
||||
for (int i = 0; i < CHANNELS; ++i) {
|
||||
@@ -145,11 +143,11 @@ void NavioSysRCInput::Run()
|
||||
}
|
||||
}
|
||||
|
||||
if (all_zero) {
|
||||
if (all_zero || !_connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.timestamp_last_signal = timestamp_sample;
|
||||
data.timestamp_sample = timestamp_sample;
|
||||
data.channel_count = CHANNELS;
|
||||
data.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM;
|
||||
data.timestamp = hrt_absolute_time();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user