Skip to content

Commit

Permalink
AP_Logger: handle LOG_DISARMED=0 in mavlink-logging backend
Browse files Browse the repository at this point in the history
In the current implementation the mavlink backend cant be used with warning messages from the GCS if the GCS doesnt want to permanently receive the whole logging stream (e.g. LOG_DISARMED=0). To explain the erroneous behaviour i want to show 3 possible situations which are possible with the mavlink-router implementation of the GCS side of mavlink-logging:

1.
mavlink-router: logging mode "always"
APM: DISARMED||ARMED +  + LOG_BACKEND_TYPE=MAVLINK-BIT-SET

Mavlink-logging backend detects mavlink-router which saves data to disc.
Mavlink-logging backend logging_failed == false

2.
mavlink-router: logging mode "while-armed"
APM: DISARMED + LOG_DISARMED=0 + LOG_BACKEND_TYPE=MAVLINK-BIT-SET

Mavlink-logging backend doesnt detect mavlink-router as no data is saved.
Mavlink-logging backend logging_failed == true

3.
mavlink-router: logging mode "while-armed"
APM: ARMED + LOG_DISARMED=0 + LOG_BACKEND_TYPE=MAVLINK-BIT-SET

Mavlink-logging backend detects mavlink-router which saves data to disc.
Mavlink-logging backend logging_failed == false

Case 1 is a inconvient for the user as a lot of non interesting data is saved.
Case 2 prevents usage of the arming checks for logging and creates warnings in AP_RCTelemetry.cpp, as the mavlink-logger always fails.

This PR tries to create a exception behaviour for Case 2 to not fail automatically when no logging stream is supposed to be sent via mavlink(LOG_DISARMED=0 + DISARMED).
  • Loading branch information
petrosilius committed Jun 5, 2024
1 parent 3968652 commit 93a633d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/AP_Logger/AP_Logger_MAVLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ void AP_Logger_MAVLink::Init()

bool AP_Logger_MAVLink::logging_failed() const
{
// Ensure check doesnt fail for special case: Plane disarmed & logging while disarmed disabled
if (_front._params.log_disarmed == AP_Logger::LogDisarmed::NONE && !hal.util->get_soft_armed()) {
return false;
}
return !_sending_to_client;
}

Expand Down

0 comments on commit 93a633d

Please sign in to comment.