Skip to content

Commit

Permalink
fix(plane): ArdupilotPlaneMode cast bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asvol committed Nov 13, 2023
1 parent 4dcbcec commit e8ac11d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public override Task SetAutoMode(CancellationToken cancel = default)
public override IEnumerable<IVehicleMode> AvailableModes => ArdupilotPlaneMode.AllModes;
protected override IVehicleMode? InternalInterpretMode(HeartbeatPayload heartbeatPayload)
{
return AvailableModes.Cast<ArdupilotCopterMode>()
.FirstOrDefault(_ => _.CustomMode == (CopterMode)heartbeatPayload.CustomMode);
return AvailableModes.Cast<ArdupilotPlaneMode>()
.FirstOrDefault(_ => _.CustomMode == (PlaneMode)heartbeatPayload.CustomMode);
}

public override Task SetVehicleMode(IVehicleMode mode, CancellationToken cancel = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
using Asv.Mavlink.V2.Ardupilotmega;
using Asv.Mavlink.V2.Common;
using Asv.Mavlink.V2.Minimal;
using NLog;

namespace Asv.Mavlink;

public class ArduCopterClient:ArduVehicle
{
public static readonly Logger _logger = LogManager.GetCurrentClassLogger();
public ArduCopterClient(IMavlinkV2Connection connection, MavlinkClientIdentity identity, VehicleClientConfig config, IPacketSequenceCalculator seq, IScheduler? scheduler = null)
: base(connection, identity, config, seq, scheduler)
{
Expand All @@ -37,7 +39,7 @@ protected override async Task<string> GetCustomName(CancellationToken cancel)
}
catch (Exception e)
{
// ignored
_logger.Error($"Error to get vehicle name:{e.Message}");
}

return $"Arducopter [{Identity.TargetSystemId:00},{Identity.TargetComponentId:00}]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ namespace Asv.Mavlink
{
public enum ArdupilotFrameTypeEnum
{
Unknown,
Plus = 0,
X = 1,
V = 2,
Expand All @@ -17,7 +16,7 @@ public enum ArdupilotFrameTypeEnum
I = 15,
BetaFlightXReversed = 18,
Y4 = 19,

Unknown,
}

public enum ArdupilotFrameClassEnum
Expand Down

0 comments on commit e8ac11d

Please sign in to comment.