mavlink: Added parsing of CLI option to configure HL frequency

This commit is contained in:
oravla5
2024-04-26 09:42:06 +02:00
committed by Beat Küng
parent e7b4c5903f
commit 2b2e1c9521
2 changed files with 25 additions and 2 deletions
+24 -2
View File
@@ -1689,7 +1689,7 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
break;
case MAVLINK_MODE_IRIDIUM:
configure_stream_local("HIGH_LATENCY2", 0.015f);
configure_stream_local("HIGH_LATENCY2", _high_latency_freq);
break;
case MAVLINK_MODE_MINIMAL:
@@ -1843,7 +1843,7 @@ Mavlink::task_main(int argc, char *argv[])
int temp_int_arg;
#endif
while ((ch = px4_getopt(argc, argv, "b:r:d:n:u:o:m:t:c:fswxzZp", &myoptind, &myoptarg)) != EOF) {
while ((ch = px4_getopt(argc, argv, "b:r:d:n:u:o:m:t:c:F:fswxzZp", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
if (px4_get_parameter_value(myoptarg, _baudrate) != 0) {
@@ -2031,6 +2031,24 @@ Mavlink::task_main(int argc, char *argv[])
break;
}
case 'F': {
float freq;
if (px4_get_parameter_value(myoptarg, freq) != 0) {
PX4_ERR("iridium mode frequency parsing failed");
err_flag = true;
}
else {
if (freq >= 0) {
_high_latency_freq = freq;
} else {
PX4_ERR("Invalid value for iridium mode frequency.");
err_flag = true;
}
}
break;
}
case 'f':
_forwarding_on = true;
break;
@@ -2904,6 +2922,9 @@ Mavlink::display_status()
_ftp_on ? "YES" : "NO",
_transmitting_enabled ? "YES" : "NO");
printf("\tmode: %s\n", mavlink_mode_str(_mode));
if (_mode == MAVLINK_MODE_IRIDIUM) {
printf("\t iridium tx freq: %.3f\n", (double)(_high_latency_freq));
}
printf("\tForwarding: %s\n", get_forwarding_on() ? "On" : "Off");
printf("\tMAVLink version: %" PRId32 "\n", _protocol_version);
@@ -3284,6 +3305,7 @@ $ mavlink stream -u 14556 -s HIGHRES_IMU -r 50
#if defined(CONFIG_NET_IGMP) && defined(CONFIG_NET_ROUTE)
PRINT_MODULE_USAGE_PARAM_STRING('c', nullptr, "Multicast address in the range [239.0.0.0,239.255.255.255]", "Multicast address (multicasting can be enabled via MAV_{i}_BROADCAST param)", true);
#endif
PRINT_MODULE_USAGE_PARAM_FLOAT('F', 0.015, 0.0, 50.0, "Sets the transmission frequency for iridium mode", true);
PRINT_MODULE_USAGE_PARAM_FLAG('f', "Enable message forwarding to other Mavlink instances", true);
PRINT_MODULE_USAGE_PARAM_FLAG('w', "Wait to send, until first message received", true);
PRINT_MODULE_USAGE_PARAM_FLAG('x', "Enable FTP", true);
+1
View File
@@ -584,6 +584,7 @@ private:
int _baudrate{57600};
int _datarate{1000}; ///< data rate for normal streams (attitude, position, etc.)
float _rate_mult{1.0f};
float _high_latency_freq{0.015f}; ///< frequency of HIGH_LATENCY2 stream
bool _radio_status_available{false};
bool _radio_status_critical{false};