Skip to content

Commit

Permalink
Added opamp and finished resistors
Browse files Browse the repository at this point in the history
  • Loading branch information
vanBassum committed Dec 8, 2020
1 parent 4556c7f commit 1ab9bc1
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Library
Submodule Library updated 88 files
+1 −0 .gitignore
+ DLL/Newtonsoft.Json.dll
+5 −4 FRMLib/FRMLib.csproj
+160 −0 FRMLib/Kernel32.cs
+104 −1 FRMLib/Scope/Controls/GraphicsExt.cs
+8 −6 FRMLib/Scope/Controls/MarkerView.cs
+6 −6 FRMLib/Scope/Controls/MathView.cs
+202 −71 FRMLib/Scope/Controls/ScopeView.cs
+1 −1 FRMLib/Scope/Controls/ScopeViewSettings.cs
+1 −0 FRMLib/Scope/Controls/TraceView.cs
+39 −0 FRMLib/Scope/Cursor.cs
+2 −1 FRMLib/Scope/Ext.cs
+29 −31 FRMLib/Scope/Marker.cs
+1 −0 FRMLib/Scope/MathFunctions/AVG.cs
+60 −0 FRMLib/Scope/MathFunctions/LinearRegression.cs
+1 −0 FRMLib/Scope/MathFunctions/Max.cs
+1 −0 FRMLib/Scope/MathFunctions/Min.cs
+2 −2 FRMLib/Scope/MathItem.cs
+43 −1 FRMLib/Scope/Palettes.cs
+12 −0 FRMLib/Scope/ScopeController.cs
+0 −21 FRMLib/Scope/SizeD.cs
+11 −8 FRMLib/Scope/Trace.cs
+94 −0 STDLib/Commands/BaseCommand.cs
+11 −0 STDLib/Commands/Exit.cs
+18 −0 STDLib/Commands/Help.cs
+10 −1 STDLib/Ethernet/TcpSocketClient.cs
+0 −90 STDLib/JBVProtocol/Client.cs
+81 −0 STDLib/JBVProtocol/Commands/Command.cs
+42 −0 STDLib/JBVProtocol/Commands/CommandList.cs
+19 −0 STDLib/JBVProtocol/Commands/ReplyACK.cs
+19 −0 STDLib/JBVProtocol/Commands/ReplyCMDINV.cs
+21 −0 STDLib/JBVProtocol/Commands/ReplyID.cs
+23 −0 STDLib/JBVProtocol/Commands/ReplyLease.cs
+22 −0 STDLib/JBVProtocol/Commands/ReplyNACK.cs
+21 −0 STDLib/JBVProtocol/Commands/ReplySID.cs
+21 −0 STDLib/JBVProtocol/Commands/RequestID.cs
+23 −0 STDLib/JBVProtocol/Commands/RequestLease.cs
+28 −0 STDLib/JBVProtocol/Commands/RequestSID.cs
+22 −0 STDLib/JBVProtocol/Commands/RoutingInvalid.cs
+49 −0 STDLib/JBVProtocol/ConnectionServer.cs
+23 −0 STDLib/JBVProtocol/Devices/CMD/SetFreq.cs
+23 −0 STDLib/JBVProtocol/Devices/CMD/SetLED.cs
+24 −0 STDLib/JBVProtocol/Devices/DPS50xx/DPS50xx.cs
+67 −0 STDLib/JBVProtocol/Devices/Device.cs
+36 −0 STDLib/JBVProtocol/Devices/FunctionGenerator/FunctionGenerator.cs
+12 −8 STDLib/JBVProtocol/DummyConnection.cs
+85 −0 STDLib/JBVProtocol/Frame.cs
+23 −25 STDLib/JBVProtocol/Framing.cs
+13 −0 STDLib/JBVProtocol/IConnection.cs
+0 −61 STDLib/JBVProtocol/IO/Connection.cs
+0 −172 STDLib/JBVProtocol/IO/Frame.cs
+0 −217 STDLib/JBVProtocol/IO/Router.cs
+197 −0 STDLib/JBVProtocol/JBVClient.cs
+58 −0 STDLib/JBVProtocol/Lease.cs
+144 −0 STDLib/JBVProtocol/LeaseServer.cs
+51 −0 STDLib/JBVProtocol/Logger.cs
+0 −41 STDLib/JBVProtocol/Message.cs
+232 −0 STDLib/JBVProtocol/Router.cs
+19 −0 STDLib/JBVProtocol/SoftwareIDList.cs
+25 −0 STDLib/JBVProtocol/TCPConnection.cs
+28 −0 STDLib/Math/Linear.cs
+20 −16 STDLib/Math/PointD.cs
+49 −0 STDLib/Math/RectangleD.cs
+39 −0 STDLib/Math/SizeD.cs
+49 −0 STDLib/Math/V2D.cs
+96 −10 STDLib/Misc/Logger.cs
+79 −0 STDLib/Misc/Map.cs
+36 −0 STDLib/Misc/TaskEvents.cs
+17 −1 STDLib/Misc/ThreadedBindingList.cs
+62 −0 STDLib/Misc/ThreadsafeBindingList.cs
+5 −0 STDLib/STDLib.csproj
+0 −15 STDLib/STDLib.xml
+161 −44 STDLib/Saveable/BaseSettings.cs
+48 −0 STDLib/Saveable/Saveable.cs
+2 −39 STDLib/Saveable/SaveableSettings.cs
+1 −7 STDLib/Serializers/JSON.cs
+7 −6 TestProjects/ProtocolTesting/JBV Protocol test/DirectComminucationTest.cs
+65 −0 TestProjects/ProtocolTesting/JBV Protocol test/IDServerTest.cs
+10 −0 TestProjects/ProtocolTesting/JBV Protocol test/RouterCircleTest.cs
+10 −0 TestProjects/ProtocolTesting/JBV Protocol test/RouterDuplicateTest.cs
+10 −0 TestProjects/ProtocolTesting/JBV Protocol test/RouterLoopbackTest.cs
+98 −16 TestProjects/ProtocolTesting/JBV Protocol test/RouterStarTest.cs
+6 −6 TestProjects/ProtocolTesting/JBV Protocol test/RouterTest.cs
+7 −1 TestProjects/ProtocolTesting/ProtocolTesting.sln
+0 −24 TestProjects/ProtocolTesting/ProtocolTesting/Form1.Designer.cs
+18 −21 TestProjects/ProtocolTesting/ProtocolTesting/Form1.cs
+5 −0 TestProjects/ProtocolTesting/ProtocolTesting/ProtocolTesting.csproj
+37 −0 TestProjects/ProtocolTesting/ProtocolTesting/SerialConnection.cs
3 changes: 2 additions & 1 deletion StuffDatabase/StuffDatabase/CTRL_Component.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions StuffDatabase/StuffDatabase/CTRL_Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,13 @@ public void Import(string file)
}
}
}

private void treeView1_KeyDown(object sender, KeyEventArgs e)
{
if(e.Control && e.KeyCode == Keys.P)
{
btn_Print_Click(null, null);
}
}
}
}
54 changes: 54 additions & 0 deletions StuffDatabase/StuffDatabase/Components/Opamp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using DYMO.Label.Framework;
using System.ComponentModel;
using System.Reflection;
using System.Text.RegularExpressions;

namespace StuffDatabase.Components
{
public class Opamp : BaseComponent, ILabelConvertable
{
[Category("Specifics")]
public double UnityGainBandwidth { get { return GetPar<double>(0); } set { SetPar<double>(value); } }

[Category("Specifics")]
public double Slewrate { get { return GetPar<double>(0); } set { SetPar<double>(value); } }

[Category("Specifics")]
public double IOut { get { return GetPar<double>(0); } set { SetPar<double>(value); } }





string Spacing(double var, int space = 8)
{
string hrd = Ext.ToHumanReadable(var, 0);
int i = space - Regex.Match(hrd, @"[\d\.]+").Value.Length;
return new string(' ', i) + hrd;
}

public void PopulateLabel(ILabel label)
{
foreach (DYMO.Label.Framework.ILabelObject labelObj in label.Objects)
{
string name = labelObj.Name;
Match m = Regex.Match(name, @"([^_ \r\n]+)");

if (m.Success)
{
switch (m.Groups[1].Value)
{
default:
PropertyInfo propInfo = this.GetType().GetProperty(m.Groups[1].Value);
if (propInfo != null)
{
string txt = propInfo.GetValue(this).ToString();
label.FillLabelObject(name, txt);
}
break;
}
}
}
}
}
}
47 changes: 45 additions & 2 deletions StuffDatabase/StuffDatabase/Components/Resistor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.ComponentModel;
using DYMO.Label.Framework;
using System.ComponentModel;
using System.Reflection;
using System.Text.RegularExpressions;

namespace StuffDatabase.Components
{
public class Resistor : BaseComponent
public class Resistor : BaseComponent, ILabelConvertable
{
[Category("Specifics")]
public double Resistance { get { return GetPar<double>(0); } set { SetPar<double>(value); } }
Expand All @@ -12,5 +15,45 @@ public class Resistor : BaseComponent

[Category("Specifics")]
public double Power { get { return GetPar<double>(0); } set { SetPar<double>(value); } }

string Spacing(double var, int space = 8)
{
string hrd = Ext.ToHumanReadable(var, 0);
int i = space - Regex.Match(hrd, @"[\d\.]+").Value.Length;
return new string(' ', i) + hrd;
}

public void PopulateLabel(ILabel label)
{
foreach (DYMO.Label.Framework.ILabelObject labelObj in label.Objects)
{
string name = labelObj.Name;
Match m = Regex.Match(name, @"([^_ \r\n]+)");

if (m.Success)
{
switch (m.Groups[1].Value)
{

case nameof(Resistor.Tolerance):
label.FillLabelObject(name, $"Tol {Spacing(Tolerance)}%");
break;

case nameof(Resistor.Power):
label.FillLabelObject(name, $"Pow {Spacing(Power)}W");
break;

default:
PropertyInfo propInfo = this.GetType().GetProperty(m.Groups[1].Value);
if (propInfo != null)
{
string txt = propInfo.GetValue(this).ToString();
label.FillLabelObject(name, txt);
}
break;
}
}
}
}
}
}
6 changes: 3 additions & 3 deletions StuffDatabase/StuffDatabase/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class Form1 : Form

public Form1()
{
Settings.Load("Settings.json");
Settings.Load();
InitializeComponent();
}

Expand Down Expand Up @@ -53,7 +53,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
CTRL_Component ctrl = tp.Tag as CTRL_Component;
if (ctrl.ChangePending)
{
if (MessageBox.Show("Do you want to save changes to your text?", "My Application", MessageBoxButtons.YesNo) == DialogResult.Yes)
if (MessageBox.Show("Do you want to save changes?", "My Application", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
e.Cancel = true;
save = true;
Expand All @@ -66,7 +66,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
componentDB.Save();


Settings.Save("Settings.json");
Settings.Save();
e.Cancel = false;
}

Expand Down
2 changes: 1 addition & 1 deletion StuffDatabase/StuffDatabase/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace StuffDatabase
{
public sealed class Settings : BaseSettings
public sealed class Settings : BaseSettings<Settings>
{
public static string ComponentDB { get { return GetPar(@"Resources\Components\Database.json"); } set { SetPar(value); } }
public static string ComponentData { get { return GetPar(@"Resources\Components"); } set { SetPar(value); } }
Expand Down
4 changes: 4 additions & 0 deletions StuffDatabase/StuffDatabase/StuffDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<Compile Include="Components\BaseComponent.cs" />
<Compile Include="Components\Capacitor.cs" />
<Compile Include="Components\FET.cs" />
<Compile Include="Components\Opamp.cs" />
<Compile Include="Components\Resistor.cs" />
<Compile Include="Components\Transistor.cs" />
<Compile Include="CTRL_Chemical.cs">
Expand Down Expand Up @@ -94,12 +95,15 @@
<Compile Include="Template.cs" />
<EmbeddedResource Include="CTRL_Chemical.resx">
<DependentUpon>CTRL_Chemical.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CTRL_Component.resx">
<DependentUpon>CTRL_Component.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Frm_Import.resx">
<DependentUpon>Frm_Import.cs</DependentUpon>
Expand Down

0 comments on commit 1ab9bc1

Please sign in to comment.