Skip to content

Commit

Permalink
Merge pull request #80 from nimrof/normalize_line_endings
Browse files Browse the repository at this point in the history
Normalize all the line endings
  • Loading branch information
trojanobelix authored Mar 14, 2024
2 parents 3735e28 + 7ae4978 commit 0e45000
Show file tree
Hide file tree
Showing 24 changed files with 5,905 additions and 5,899 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cs text
1,692 changes: 846 additions & 846 deletions EDSEditorGUI/DeviceInfoView.Designer.cs

Large diffs are not rendered by default.

132 changes: 66 additions & 66 deletions EDSEditorGUI/DeviceInfoView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ You should have received a copy of the GNU General Public License
using System.Windows.Forms;
using libEDSsharp;
using System.IO;
using System.Runtime.CompilerServices;
using System.Drawing;

using System.Runtime.CompilerServices;
using System.Drawing;

namespace ODEditor
{
public partial class DeviceInfoView : MyTabUserControl
Expand Down Expand Up @@ -66,19 +66,19 @@ public void populatedeviceinfo()
textBox_rxpdos.Text = eds.di.NrOfRXPDO.ToString();
textBox_txpdos.Text = eds.di.NrOfTXPDO.ToString();
checkBox_lss.Checked = eds.di.LSS_Supported;
checkBox_lssMaster.Checked = eds.di.LSS_Master;

checkBox_ngSlave.Checked = eds.di.NG_Slave;
checkBox_ngMaster.Checked = eds.di.NG_Master;

if (textBox_NG_NumOfNodes.Enabled)
checkBox_lssMaster.Checked = eds.di.LSS_Master;

checkBox_ngSlave.Checked = eds.di.NG_Slave;
checkBox_ngMaster.Checked = eds.di.NG_Master;

if (textBox_NG_NumOfNodes.Enabled)
textBox_NG_NumOfNodes.Text = eds.di.NrOfNG_MonitoredNodes.ToString();
else
{
textBox_NG_NumOfNodes.Text = "";
eds.di.NrOfNG_MonitoredNodes = 0;
}

else
{
textBox_NG_NumOfNodes.Text = "";
eds.di.NrOfNG_MonitoredNodes = 0;
}

textBox_projectFileName.Text = Path.GetFileName(eds.projectFilename);
if (eds.xddfilename_1_1 != "")
textBox_projectFileVersion.Text = "v1.1";
Expand All @@ -102,33 +102,33 @@ public void populatedeviceinfo()
textBox_netnum.Text = eds.dc.NetNumber.ToString();
checkBox_canopenmanager.Checked = eds.dc.CANopenManager;
textBox_lssserial.Text = eds.dc.LSS_SerialNumber.ToString();
}

AddOnChangeHandlerToInputControls(this.Controls);

}



void AddOnChangeHandlerToInputControls(ControlCollection ctrl)
{
foreach (Control subctrl in ctrl)
{
if (subctrl is TextBox)
((TextBox)subctrl).TextChanged +=
new EventHandler(InputControls_OnChange);
else
if (subctrl is CheckBox)
((CheckBox)subctrl).CheckedChanged +=
new EventHandler(InputControls_OnChange);
else
{
if (subctrl.Controls.Count > 0)
this.AddOnChangeHandlerToInputControls(subctrl.Controls);
}
}
}

}

AddOnChangeHandlerToInputControls(this.Controls);

}



void AddOnChangeHandlerToInputControls(ControlCollection ctrl)
{
foreach (Control subctrl in ctrl)
{
if (subctrl is TextBox)
((TextBox)subctrl).TextChanged +=
new EventHandler(InputControls_OnChange);
else
if (subctrl is CheckBox)
((CheckBox)subctrl).CheckedChanged +=
new EventHandler(InputControls_OnChange);
else
{
if (subctrl.Controls.Count > 0)
this.AddOnChangeHandlerToInputControls(subctrl.Controls);
}
}
}

private void update_devfile_info()
{
if (eds == null)
Expand Down Expand Up @@ -159,23 +159,23 @@ private void update_devfile_info()

eds.di.Granularity = Convert.ToByte(textBox_granularity.Text);
eds.di.LSS_Supported = checkBox_lss.Checked;
eds.di.LSS_Master = checkBox_lssMaster.Checked;

// ToDO: Node guarding ist confiured manually, but should reflect the OD settings
// NG_Slave active if heartbeat producer time (0x1017) == 0 and Guardtime (0x100C) != 0
// NG_Master active (according DSP302) if consumer time (0x1016) == 0 and NodeID is in network list (0x1F81) and Guardtime (0x100C) != 0
// NrOfNG_MonitoredNodes should be the sum of all NodeIDs that are in network list (0x1F81) if heartbeat consumer time (0x1016) == 0 and Guardtime (0x100C) != 0
textBox_NG_NumOfNodes.Enabled = checkBox_ngMaster.Checked;
eds.di.NG_Slave = checkBox_ngSlave.Checked;
eds.di.NG_Master = checkBox_ngMaster.Checked;
System.UInt16.TryParse(textBox_NG_NumOfNodes.Text,out eds.di.NrOfNG_MonitoredNodes);
if (eds.di.NrOfNG_MonitoredNodes > 127)
{
MessageBox.Show("Number of monitored nodes must be between 0 and 127");
}

doUpdatePDOs();

eds.di.LSS_Master = checkBox_lssMaster.Checked;

// ToDO: Node guarding ist confiured manually, but should reflect the OD settings
// NG_Slave active if heartbeat producer time (0x1017) == 0 and Guardtime (0x100C) != 0
// NG_Master active (according DSP302) if consumer time (0x1016) == 0 and NodeID is in network list (0x1F81) and Guardtime (0x100C) != 0
// NrOfNG_MonitoredNodes should be the sum of all NodeIDs that are in network list (0x1F81) if heartbeat consumer time (0x1016) == 0 and Guardtime (0x100C) != 0
textBox_NG_NumOfNodes.Enabled = checkBox_ngMaster.Checked;
eds.di.NG_Slave = checkBox_ngSlave.Checked;
eds.di.NG_Master = checkBox_ngMaster.Checked;
System.UInt16.TryParse(textBox_NG_NumOfNodes.Text,out eds.di.NrOfNG_MonitoredNodes);
if (eds.di.NrOfNG_MonitoredNodes > 127)
{
MessageBox.Show("Number of monitored nodes must be between 0 and 127");
}

doUpdatePDOs();

//These are read only and auto calculated
//textBox_rxpdos.Text = eds.di.NrOfRXPDO.ToString();
//textBox_txpdos.Text = eds.di.NrOfTXPDO.ToString();
Expand All @@ -195,12 +195,12 @@ private void update_devfile_info()
{
MessageBox.Show("Update failed, reason :-\n" + ex.ToString());
}
}

void InputControls_OnChange(object sender, EventArgs e)
{
// Changes detected: Update the device info
update_devfile_info();
}
}

void InputControls_OnChange(object sender, EventArgs e)
{
// Changes detected: Update the device info
update_devfile_info();
}
}
}
Loading

0 comments on commit 0e45000

Please sign in to comment.