Skip to content

Commit

Permalink
Merge pull request #5 from lansalot/NewFeatures
Browse files Browse the repository at this point in the history
Added BMAC link and support for local firmware
  • Loading branch information
lansalot authored Apr 17, 2024
2 parents 428a08b + 597b9b9 commit d90d67b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Firmwares.csv → TeensyFlasher/Firmwares.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ CANBUS for AIO (test added MF7S and CatMT support),https://raw.githubusercontent
Keya Motorwheel (for PCB4.1 and Keya CANBUS),https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares/AOG-Keya-CANBUS.hex
Keya Motorwheel 08G-V1-beta (for PCB4.1 and Keya CANBUS 160324),https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares/Keya-08G-v1-beta3.hex
PANDA (for PCBv2),https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares/AOG-2.5.hex
Rate Controller (RC21 rate app),https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares/RCteensy.hex
Rate Controller (RC21 rate app),https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares/RCteensy.hex
4 changes: 1 addition & 3 deletions TeensyFlasher/TeensyFlasher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.cs" />
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
Expand Down
46 changes: 37 additions & 9 deletions TeensyFlasher/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@

namespace TeensyFlasher
{
public class TeensyFirmwareItem
{
public string DisplayText { get; set; }
public string Location { get; set; }

// Constructor
public TeensyFirmwareItem(string displayText, string location)
{
DisplayText = displayText;
Location = location;
}
}
public partial class frmMain : Form
{
private AutoResetEvent _waitForAckNak = new AutoResetEvent(false);
Expand All @@ -39,6 +51,8 @@ public partial class frmMain : Form
private bool isClosing = false;
private int errorCount = 0;

private List<TeensyFirmwareItem> teensyFirmwareItems = new List<TeensyFirmwareItem>();

#region Teensy


Expand All @@ -55,11 +69,25 @@ void LogMessage(string Text)
}
void UpdateFirmwareBox()
{
// Read the CSV file and fill the listbox with the first column
var lines = File.ReadAllLines(localCSV);
var firstColumn = lines.Select(line => line.Split(',')[0]).ToList();
lbFirmware.DataSource = firstColumn;
foreach (var line in File.ReadAllLines(localCSV))
{
var parts = line.Split(',');
teensyFirmwareItems.Add(new TeensyFirmwareItem(parts[0], parts[1]));
}
var hexFiles = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.hex");
foreach (var hexFile in hexFiles)
{
if (!teensyFirmwareItems.Any(s => s.Location.IndexOf(Path.GetFileName(hexFile)) > -1))
{
teensyFirmwareItems.Add(new TeensyFirmwareItem(Path.GetFileName(hexFile), Path.GetFileName(hexFile)));
}
}
lbFirmware.DataSource = teensyFirmwareItems;
lbFirmware.DisplayMember = "DisplayText";
lbFirmware.ValueMember = "Location";
lbFirmware.SelectedIndex = -1;
// add any *.hex files in current folder to the list

}
public frmMain()
{
Expand Down Expand Up @@ -772,11 +800,7 @@ private void rbDualRelPos_CheckedChanged(object sender, EventArgs e)

private void lbFirmware_SelectedIndexChanged_1(object sender, EventArgs e)
{
var lines = File.ReadAllLines(localCSV);
chosenFirmware = lines
.Where(line => line.Split(',')[0] == (String)lbFirmware.SelectedValue)
.Select(line => line.Split(',')[1])
.FirstOrDefault();
chosenFirmware = (lbFirmware.SelectedItem as TeensyFirmwareItem)?.Location;
if (lbFirmware.SelectedIndex > -1 && lbTeensies.SelectedIndex > -1 && lbTeensies.Items.Count > 0)
{
btnProgram.Enabled = true;
Expand All @@ -793,6 +817,7 @@ private void btnHelp_Click(object sender, EventArgs e)
contexMenu.Items.Add("AgOpenGPS");
contexMenu.Items.Add("AgHardware");
contexMenu.Items.Add("AOG Discourse");
contexMenu.Items.Add("Donate to AOG!");
contexMenu.Show(Cursor.Position.X, Cursor.Position.Y);
contexMenu.ItemClicked += new ToolStripItemClickedEventHandler(
contexMenu_ItemClicked);
Expand Down Expand Up @@ -821,6 +846,9 @@ void contexMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
case "AgOpenGPS Tools":
System.Diagnostics.Process.Start("https://github.com/lansalot/AgOpenGPS-Tools");
break;
case "Donate to AOG!":
System.Diagnostics.Process.Start("https://www.buymeacoffee.com/agopengps");
break;
}
}

Expand Down

0 comments on commit d90d67b

Please sign in to comment.