From 6e63307de8988fd8c415d8bee192594a7ef94327 Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Thu, 24 Jul 2025 10:10:44 -0800 Subject: [PATCH] cleanup and notes --- mavlink_notes.md | 19 ++++++++++++++++++- src/modules/mavlink/mavlink_main.cpp | 6 ++++-- src/modules/mavlink/mavlink_receiver.cpp | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/mavlink_notes.md b/mavlink_notes.md index d7854b81cb..c7e346af6b 100644 --- a/mavlink_notes.md +++ b/mavlink_notes.md @@ -1,2 +1,19 @@ ## Mavlink MAIN Loop -- +- Some nonsense at the top for iridium mode +- Calculate rate multiplier (look at impl) + +## These are kinda BS +- Configure SiK radio (move!!!) +- handleStatus() --> sets HIL mode or handles Iridium nonsense ... move!!! +- handleCommands() --> iridium nonsense and gimbal v1 ... remove! +- handleAndGetCurrentCommandAck() --> sends out ACKS, needs to be simplified +- handleMavlinkShellOutput() --> sends out mavlink shell output if enabled +- check_requested_subscriptions() --> configures streams that have been request, could be simplified + +## Not BS +- Iterate over all streams and send +- Send ulog data +- check and send events +- forward messages in message_buffer +- update stats and publish telemetry status +- BACK TO THE TOP diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index c3b7eaf45f..e349183a37 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -2371,8 +2371,10 @@ Mavlink::task_main(int argc, char *argv[]) PX4_INFO("Total stream B/s --> %f", (double)total_bytes_per_s); + // MAIN LOOP while (!should_exit()) { - /* main loop */ + + // Sleep shouldn't happen here px4_usleep(_main_loop_delay); if (!should_transmit()) { @@ -2513,7 +2515,7 @@ Mavlink::task_main(int argc, char *argv[]) } perf_end(_loop_perf); - } + } // END MAIN LOOP _receiver.stop(); diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 62d2ffc4d9..dc7e3f6948 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -3235,7 +3235,7 @@ MavlinkReceiver::run() break; } - _mavlink.set_has_received_messages(true); // Received first message, unlock wait to transmit '-w' command-line flag + _mavlink.set_has_received_messages(true); update_rx_stats(msg); if (_message_statistics_enabled) {