Skip to content

Commit

Permalink
added documentation generation to markdown
Browse files Browse the repository at this point in the history
fixed saving of low and high values
its now possible to add describtions to subobjects
  • Loading branch information
gotocoffee1 committed Apr 4, 2019
1 parent 336ec77 commit e379e50
Show file tree
Hide file tree
Showing 7 changed files with 268 additions and 11 deletions.
5 changes: 3 additions & 2 deletions EDSTest/DeviceODView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ private void button_save_changes_Click(object sender, EventArgs e)

selectedobject.defaultvalue = textBox_defaultvalue.Text;
selectedobject.TPDODetectCos = checkBox_COS.Checked;


selectedobject.HighLimit = textBox_highvalue.Text;
selectedobject.LowLimit = textBox_lowvalue.Text;
selectedobject.actualvalue = textBox_actualvalue.Text;
DataType dt = (DataType)Enum.Parse(typeof(DataType), comboBox_datatype.SelectedItem.ToString());
selectedobject.datatype = dt;

Expand Down
4 changes: 3 additions & 1 deletion EDSTest/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,14 @@ private void documentationToolStripMenuItem_Click(object sender, EventArgs e)
}

string temp = dir + Path.DirectorySeparatorChar + "documentation.html";
string temp2 = dir + Path.DirectorySeparatorChar + "documentation.md";

this.UseWaitCursor = true;

DocumentationGen docgen = new DocumentationGen();
docgen.genhtmldoc(temp, dv.eds);

docgen.genmddoc(temp2, dv.eds);
System.Diagnostics.Process.Start("file://" + temp2);
if (IsRunningOnMono())
{
System.Diagnostics.Process.Start("file://" + temp);
Expand Down
13 changes: 13 additions & 0 deletions libEDSsharp/Bridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public Device convert(EDSsharp eds)
coo.AccessType = od.accesstype.ToString();
coo.DataType = string.Format("0x{0:x2}", (int)od.datatype);
coo.DefaultValue = od.defaultvalue;
coo.HighValue = od.HighLimit;
coo.LowValue = od.LowLimit;
coo.PDOmapping = od.PDOtype.ToString();
coo.TPDOdetectCOS = od.TPDODetectCos.ToString().ToLower();
coo.AccessFunctionPreCode = od.AccessFunctionPreCode;
Expand All @@ -85,10 +87,14 @@ public Device convert(EDSsharp eds)
Xml2CSharp.CANopenSubObject sub = new Xml2CSharp.CANopenSubObject();

sub.Name = subod.parameter_name;
sub.Description = new Xml2CSharp.Description();
sub.Description.Text = subod.Description;
sub.ObjectType = subod.objecttype.ToString();
sub.AccessType = subod.accesstype.ToString();
sub.DataType = string.Format("0x{0:x2}", (int)subod.datatype);
sub.DefaultValue = subod.defaultvalue;
sub.HighValue = subod.HighLimit;
sub.LowValue = subod.LowLimit;
sub.PDOmapping = subod.PDOtype.ToString();
sub.SubIndex = String.Format("{0:x2}", subindex);
sub.TPDOdetectCOS = subod.TPDODetectCos.ToString().ToLower();
Expand Down Expand Up @@ -317,6 +323,8 @@ public EDSsharp convert(Device dev)
entry.objecttype = (ObjectType)Enum.Parse(typeof(ObjectType), coo.ObjectType);

entry.defaultvalue = coo.DefaultValue;
entry.HighLimit = coo.HighValue;
entry.LowLimit = coo.LowValue;
//entry.nosubindexes = Convert.ToInt16(coo.SubNumber);

if (coo.PDOmapping != null)
Expand Down Expand Up @@ -375,7 +383,12 @@ public EDSsharp convert(Device dev)
subentry.datatype = (DataType)datatype;
}

if (coosub.Description != null)
subentry.Description = coosub.Description.Text; //FIXME URL/LANG

subentry.defaultvalue = coosub.DefaultValue;
subentry.HighLimit = coosub.HighValue;
subentry.LowLimit = coosub.LowValue;

byte subindex = Convert.ToByte(coosub.SubIndex, 16);

Expand Down
12 changes: 8 additions & 4 deletions libEDSsharp/CanOpenNodeExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,11 @@ private void export_h()

StreamWriter file = new StreamWriter(folderpath + Path.DirectorySeparatorChar + "CO_OD.h");


file.WriteLine("// clang-format off");
addGPLheader(file);

file.WriteLine("#pragma once");
file.WriteLine("#ifndef CO_OD_H_");
file.WriteLine("#define CO_OD_H_");
file.WriteLine("");

file.WriteLine(@"/*******************************************************************************
Expand Down Expand Up @@ -527,7 +528,7 @@ TYPE DEFINITIONS FOR RECORDS

file.WriteLine(string.Format("/*{0:x4} */ typedef struct {{", kvp.Key));
foreach (KeyValuePair<UInt16, ODentry> kvp2 in kvp.Value.subobjects)
{
{
string paramaterarrlen = "";

ODentry subod = kvp2.Value;
Expand Down Expand Up @@ -766,7 +767,8 @@ ALIASES FOR OBJECT DICTIONARY VARIABLES
break;
}
}

file.WriteLine("#endif");
file.WriteLine("// clang-format on");
file.Close();

}
Expand All @@ -775,6 +777,7 @@ private void export_c()
{
StreamWriter file = new StreamWriter(folderpath + Path.DirectorySeparatorChar + "CO_OD.c");

file.WriteLine("// clang-format off");
addGPLheader(file);

file.WriteLine(@"#include ""CO_driver.h""
Expand Down Expand Up @@ -840,6 +843,7 @@ OBJECT DICTIONARY
file.Write(write_od());

file.WriteLine("};");
file.WriteLine("// clang-format on");

file.Close();
}
Expand Down
14 changes: 12 additions & 2 deletions libEDSsharp/CanOpenXML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ public class CANopenObject {
public string PDOmapping { get; set; }
[XmlAttribute(AttributeName="defaultValue")]
public string DefaultValue { get; set; }
[XmlElement(ElementName="CANopenSubObject")]
[XmlAttribute(AttributeName = "highValue")]
public string HighValue { get; set; }
[XmlAttribute(AttributeName = "lowValue")]
public string LowValue { get; set; }
[XmlElement(ElementName="CANopenSubObject")]
public List<CANopenSubObject> CANopenSubObject { get; set; }
[XmlAttribute(AttributeName="subNumber")]
public string SubNumber { get; set; }
Expand All @@ -165,7 +169,9 @@ public class CANopenSubObject {
public string SubIndex { get; set; }
[XmlAttribute(AttributeName="name")]
public string Name { get; set; }
[XmlAttribute(AttributeName="objectType")]
[XmlElement(ElementName = "description")]
public Description Description { get; set; }
[XmlAttribute(AttributeName="objectType")]
public string ObjectType { get; set; }
[XmlAttribute(AttributeName="dataType")]
public string DataType { get; set; }
Expand All @@ -175,6 +181,10 @@ public class CANopenSubObject {
public string PDOmapping { get; set; }
[XmlAttribute(AttributeName="defaultValue")]
public string DefaultValue { get; set; }
[XmlAttribute(AttributeName = "highValue")]
public string HighValue { get; set; }
[XmlAttribute(AttributeName = "lowValue")]
public string LowValue { get; set; }
[XmlAttribute(AttributeName = "TPDOdetectCOS")]
public string TPDOdetectCOS { get; set; }
}
Expand Down
Loading

0 comments on commit e379e50

Please sign in to comment.