diff --git a/GCSViews/ConfigurationView/ConfigDroneCAN.cs b/GCSViews/ConfigurationView/ConfigDroneCAN.cs index f2aceb0690..0740f30cf7 100644 --- a/GCSViews/ConfigurationView/ConfigDroneCAN.cs +++ b/GCSViews/ConfigurationView/ConfigDroneCAN.cs @@ -18,6 +18,7 @@ using static DroneCAN.DroneCAN; using System.ComponentModel; using System.Drawing; +using MissionPlanner.ArduPilot; namespace MissionPlanner.GCSViews.ConfigurationView { @@ -495,6 +496,12 @@ private void FirmwareUpdate(byte nodeID, bool beta = false) { var url = can.LookForUpdate(devicename, hwversion, beta); + if (url == string.Empty) + url = APFirmware.Manifest.Firmware.Where(a => a.MavFirmwareVersionType == (beta ? APFirmware.RELEASE_TYPES.BETA.ToString() : APFirmware.RELEASE_TYPES.OFFICIAL.ToString()) && + a.VehicleType == "AP_Periph" && a.Format == "bin" && + a.MavType == "CAN_PERIPHERAL" && + devicename.EndsWith(a.Platform)).First()?.Url.ToString(); + if (url != string.Empty) { try @@ -557,7 +564,7 @@ private void FirmwareUpdate(byte nodeID, bool beta = false) { FileDialog fd = new OpenFileDialog(); fd.RestoreDirectory = true; - fd.Filter = "*.bin|*.bin|*.*|*.*"; + fd.Filter = "*.bin;*.apj|*.bin;*.apj"; var dia = fd.ShowDialog(); if (fd.CheckFileExists && dia == DialogResult.OK) @@ -575,6 +582,14 @@ private void FirmwareUpdate(byte nodeID, bool beta = false) try { + if (fd.FileName.ToLower().EndsWith(".apj")) + { + var fw = px4uploader.Firmware.ProcessFirmware(fd.FileName); + var tmp = Path.GetTempFileName(); + File.WriteAllBytes(tmp, fw.imagebyte); + fd.FileName = tmp; + } + var cancel = new CancellationTokenSource(); prd.DoWork += dialogue =>