Downloading logs to odroid automatically

Anyone who can point me to where i can modify the mission planner code to download the logs automatically after every flight. I’m not new to programming but there are a lot of code and i can’t seem to find the bit where they handle the log download. I want to put something like

if(armed){
downloadLogAfterLanding=true};

if(!armed & downloadLogAfterLanding & allowdownload){
“download latest log”;
downloadLogAfterLanding=false;
}

I have a odroid permanently connected to the pixhawk configured to use mavlink.

From what I can see (and with my limited understanding of C#), if you look in MissionPlanner\GCSViews\FlightData.Designer.cs (Line 1527) there will be BUT_DFMavlink just below tablogbrowse which corresponds to the user clicking the “Download DataFlash Log Via Mavlink” button under the DataFlash Logs tab in Mission Planner.

You can find the definition for this button in FlightData.cs (line 3868) which calls for a new form LogDownloadMavlink().

If you’re using Visual Studio you can expand MissionPlanner\Log\LogDownloadMavlink.cs and double click LogDownloadMavlink to bring up the file which handles the log download functions.

Perhaps looking through there would be a good start. I wouldn’t know where in the program logic you could use the functions you need to download logs.

In addition, looking through the ArduPilot code there are files for handling sending log files via mavlink in ardupilot/libraries/DataFlash. The requesting of logs and data is done via mavlink and make use of mavlink messages “LOG_REQUEST_LIST”, “LOG_ENTRY”, “LOG_DATA”, “LOG_ERASE” and “LOG_REQUEST_END”. These are message ids 117 to 122 in MissionPlanner\ExtLibs\Mavlink\message_definitions\common.xml.
You could look to see where and when these messages are used in the MissionPlanner code.

They are probably the best hints I can offer. Unfortunately I only have a C background and my only experience with C# comes from very small changes to MissionPlanner. As a result I don’t understand a lot of the syntax/GUI/form stuff so can’t help much more.

Please share back if you come up with a good solution and perhaps make a pull request. I could see this being a useful feature if there is a checkbox somewhere in the config/tuning or the DataFlash tabs to allow a user to enable/disable automatic download.

Good luck,
Mike

Thank you, i will take a look at this and see if i can make it work som how :slight_smile:

this sounds like something you could use the MP plugin interface for.

could be done fairly simply I believe.

Could you elaborate?