Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm firmware implementation #407

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0844c36
Arm Firmware Progress
TateKolton Feb 28, 2022
c006f77
updated comments
TateKolton Feb 28, 2022
b929a07
uncommented code
TateKolton Feb 28, 2022
1423da3
Updated by removing useless compiler files from firmware folder
TateKolton Mar 1, 2022
586d383
Update src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.cs
TateKolton Mar 3, 2022
7cc105c
Update src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.cs
TateKolton Mar 3, 2022
68d19a5
Update src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.cs
TateKolton Mar 3, 2022
f8d7295
Update src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.cs
TateKolton Mar 3, 2022
308ec3d
Update src/firmware/arm_firmware/armSketchRev3.ino
TateKolton Mar 3, 2022
3dc74ad
Update src/firmware/arm_firmware/armSketchRev3.ino
TateKolton Mar 3, 2022
906afe3
Added arduino sketch to a folder so it can run in IDE. Totally refact…
TateKolton Mar 4, 2022
df2dfb0
whoopsies, wrong pin mode
TateKolton Mar 4, 2022
170c6ea
new file! for xbox control. this version has not been tested but it w…
TateKolton Mar 10, 2022
ea90ea5
firmware updated to include wrist motion special case
TateKolton Mar 15, 2022
4ff1907
updated switch firmware
TateKolton Apr 13, 2022
f7e16b0
progress
TateKolton Apr 18, 2022
bf4197e
actual-progress
TateKolton Apr 27, 2022
c01198d
test
TateKolton Apr 27, 2022
4ba0340
prog
TateKolton Apr 27, 2022
7d98817
progress
TateKolton Apr 27, 2022
fbd3c36
progress
TateKolton Apr 28, 2022
fcb9330
updated
TateKolton Apr 28, 2022
00002db
prog
TateKolton Apr 27, 2022
9c5c2fa
progress
TateKolton May 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ src/external_pkgs/
src/mapping_urc/multi_resolution_graph
/.project
phidgetlog.log

# arm firmware ignores

src/firmware/arm_firmware/SerialCom1/.vs/
src/firmware/arm_firmware/SerialCom1/SerialCom/bin
src/firmware/arm_firmware/SerialCom1/SerialCom/obj
src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.resx
25 changes: 25 additions & 0 deletions src/firmware/arm_firmware/SerialCom1/SerialCom.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31624.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialCom", "SerialCom\SerialCom.csproj", "{293C7DFD-2AF8-4E61-927A-46072A9F6182}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{293C7DFD-2AF8-4E61-927A-46072A9F6182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{293C7DFD-2AF8-4E61-927A-46072A9F6182}.Debug|Any CPU.Build.0 = Debug|Any CPU
{293C7DFD-2AF8-4E61-927A-46072A9F6182}.Release|Any CPU.ActiveCfg = Release|Any CPU
{293C7DFD-2AF8-4E61-927A-46072A9F6182}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D52D6B80-3854-499E-8028-35CA40DD7D18}
EndGlobalSection
EndGlobal
649 changes: 649 additions & 0 deletions src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.Designer.cs

Large diffs are not rendered by default.

257 changes: 257 additions & 0 deletions src/firmware/arm_firmware/SerialCom1/SerialCom/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
#define CRT_SECURE_NO_WARNINGS
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.IO;




namespace SerialCom
{

public partial class Form1 : Form
{

bool inc_flag;
bool abs_flag;

const int a1_max = 360;
const int a2_max = 360;
const int a3_max = 90;
const int a4_max = 90;
const int a5_max = 90;
const int a6_max = 90;

string dataOUT;
string homeOUT = "H";
string moveOUT = "M";
string inc = "I";
string abs = "A";
string dataIN;

string A1; //angles
string A2;
string A3;
string A4;
string A5;
string A6;

public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)
{

}

private void progressBar1_Click(object sender, EventArgs e)
{

}



private void button1_Click(object sender, EventArgs e)
{

}


private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void tBoxDATAOUT_TextChanged(object sender, EventArgs e)
{

}

private void Form1_Load_1(object sender, EventArgs e)
{
string[] ports = SerialPort.GetPortNames();
cBoxCOMPORT.Items.AddRange(ports);
}

private void btnOPEN_Click(object sender, EventArgs e)
{

try
{
serialPort1.PortName = cBoxCOMPORT.Text;
serialPort1.BaudRate = Convert.ToInt32(cBoxBAUDRATE.Text);
serialPort1.DataBits = Convert.ToInt32(cBoxDATABITS.Text);
serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), cBoxSTOPBITS.Text);
serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), cBoxPARITYBITS.Text);

serialPort1.Open();
progressBar1.Value = 100;
}
catch (Exception err)
{
MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void button2_Click(object sender, EventArgs e) /* Close button */
{
if(serialPort1.IsOpen)
{
serialPort1.Close();
progressBar1.Value = 0;
}
}


private void button3_Click(object sender, EventArgs e) /* send data button*/
{
if (serialPort1.IsOpen)
{
dataOUT = tBoxDATAOUT.Text;

if (abs_flag)
{
dataOUT = abs + dataOUT;
}

else if(inc_flag)
{
dataOUT = inc + dataOUT;
}

serialPort1.WriteLine(inc+dataOUT);
tBoxDATAOUT.Text = "";
}
}

private void label7_Click(object sender, EventArgs e)
{

}

private void label6_Click(object sender, EventArgs e)
{

}

private void absPosition_TextChanged(object sender, EventArgs e)
{

}



private void label10_Click(object sender, EventArgs e)
{

}

private void label11_Click(object sender, EventArgs e)
{

}
TateKolton marked this conversation as resolved.
Show resolved Hide resolved

private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (serialPort1.ReadLine().Contains('r'))
{
A1 = serialPort1.ReadLine();
A2 = serialPort1.ReadLine();
A3 = serialPort1.ReadLine();
A4 = serialPort1.ReadLine();
A5 = serialPort1.ReadLine();
A6 = serialPort1.ReadLine();
}
}

private void timer1_Tick(object sender, EventArgs e)
{
label11.Text = A1;
label14.Text = A2;
label16.Text = A3;
label22.Text = A4;
label20.Text = A5;
label18.Text = A6;

if (A1 != null)
{
a1prog.Value = (int)((100 * Int64.Parse(A1)) / a1_max);
}
if (A2 != null)
{
a2prog.Value = (int)((100 * Int64.Parse(A2)) / a2_max);
}
if (A3 != null)
{
a3prog.Value = (int)((100 * Int64.Parse(A3)) / a3_max);
}
if (A4 != null)
{
a4prog.Value = (int)((100 * Int64.Parse(A4)) / a4_max);
}
if (A5 != null)
{
a5prog.Value = (int)((100 * Int64.Parse(A5)) / a5_max);
}
if (A6 != null)
{
a6prog.Value = (int)((100 * Int64.Parse(A6)) / a6_max);
}

}

private void button1_Click_1(object sender, EventArgs e)
{

}

private void button1_Click_2(object sender, EventArgs e)
{

}

private void label15_Click(object sender, EventArgs e)
{

}

private void label16_Click(object sender, EventArgs e)
{

}

private void button1_Click_3(object sender, EventArgs e) // HOME BUTTON //
{
serialPort1.WriteLine(homeOUT);
}

private void btnMOVE_Click(object sender, EventArgs e) // MOTION DEMO BUTTON //
{
serialPort1.WriteLine(moveOUT);
}

private void btnINC_CheckedChanged(object sender, EventArgs e)
{
inc_flag = !inc_flag;
}

private void btnABS_CheckedChanged(object sender, EventArgs e)
{
abs_flag = !abs_flag;
}
}
}
21 changes: 21 additions & 0 deletions src/firmware/arm_firmware/SerialCom1/SerialCom/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SerialCom
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SerialCom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("SerialCom")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("293c7dfd-2af8-4e61-927a-46072a9f6182")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading