Skip to content

Commit

Permalink
update mavlink 2.0 message definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Nov 20, 2020
1 parent bb1b7e3 commit 3184ccf
Show file tree
Hide file tree
Showing 10 changed files with 3,682 additions and 1,020 deletions.
78 changes: 44 additions & 34 deletions MavLinkCom/MavLinkComGenerator/MavLinkGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,25 @@ private void GenerateCommands()
foreach (var p in cmd.parameters)
{
string fieldName = p.label;
if (string.IsNullOrWhiteSpace(fieldName))
if (!p.reserved)
{
fieldName = NameFromDescription(p.description);
}
else
{
fieldName = LegalizeIdentifier(fieldName);
}
if (fieldName != "Empty" && fieldName != "Reserved")
{
if (!string.IsNullOrWhiteSpace(p.description))
if (string.IsNullOrWhiteSpace(fieldName) && !string.IsNullOrWhiteSpace(p.description))
{
WriteComment(" ", p.description);
fieldName = NameFromDescription(p.description);
}
else
{
fieldName = LegalizeIdentifier(fieldName);
}

if (fieldName != "Empty" && fieldName != "Reserved")
{
if (!string.IsNullOrWhiteSpace(p.description))
{
WriteComment(" ", p.description);
}
header.WriteLine(" float {0} = 0;", unique.Add(fieldName));
}
header.WriteLine(" float {0} = 0;", unique.Add(fieldName));
}
}

Expand All @@ -109,18 +113,21 @@ private void GenerateCommands()
foreach (var p in cmd.parameters)
{
i++;
string fieldName = p.label;
if (string.IsNullOrWhiteSpace(fieldName))
{
fieldName = NameFromDescription(p.description);
}
else
if (!p.reserved)
{
fieldName = LegalizeIdentifier(fieldName);
}
if (fieldName != "Empty" && fieldName != "Reserved")
{
impl.WriteLine(" param{0} = {1};", i, unique.Add(fieldName));
string fieldName = p.label;
if (string.IsNullOrWhiteSpace(fieldName) && !string.IsNullOrWhiteSpace(p.description))
{
fieldName = NameFromDescription(p.description);
}
else
{
fieldName = LegalizeIdentifier(fieldName);
}
if (fieldName != "Empty" && fieldName != "Reserved")
{
impl.WriteLine(" param{0} = {1};", i, unique.Add(fieldName));
}
}
}
impl.WriteLine("}");
Expand All @@ -133,18 +140,21 @@ private void GenerateCommands()
foreach (var p in cmd.parameters)
{
i++;
string fieldName = p.label;
if (string.IsNullOrWhiteSpace(fieldName))
{
fieldName = NameFromDescription(p.description);
}
else
if (!p.reserved)
{
fieldName = LegalizeIdentifier(fieldName);
}
if (fieldName != "Empty" && fieldName != "Reserved")
{
impl.WriteLine(" {1} = param{0};", i, unique.Add(fieldName));
string fieldName = p.label;
if (string.IsNullOrWhiteSpace(fieldName) && !string.IsNullOrWhiteSpace(p.description))
{
fieldName = NameFromDescription(p.description);
}
else
{
fieldName = LegalizeIdentifier(fieldName);
}
if (fieldName != "Empty" && fieldName != "Reserved")
{
impl.WriteLine(" {1} = param{0};", i, unique.Add(fieldName));
}
}
}
impl.WriteLine("}");
Expand Down
5 changes: 5 additions & 0 deletions MavLinkCom/MavLinkComGenerator/MavLinkMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public class MavParam
[XmlAttribute]
public string label { get; set; }

[XmlAttribute]
public bool reserved { get; set; }

[XmlAttribute]
public string @default { get; set; }
}

public class MavEnumEntry
Expand Down
Loading

0 comments on commit 3184ccf

Please sign in to comment.