From ab5bc0794a1eeedcc342d0212475c5772d16f712 Mon Sep 17 00:00:00 2001 From: lansalot Date: Tue, 20 Feb 2024 23:02:23 +0000 Subject: [PATCH] MINOR: add help and update pipeline --- .github/workflows/main.yml | 14 ++----- TeensyFlasher/frmMain.Designer.cs | 13 ++++++ TeensyFlasher/frmMain.cs | 67 +++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 941549a..2543a53 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,23 +40,17 @@ jobs: - uses: paulhatch/semantic-version@v5.3.0 id: versioning with: + branch: main # The prefix to use to identify tags tag_prefix: "v" # A string which, if present in a git commit, indicates that a change represents a # major (breaking) change, supports regular expressions wrapped with '/' - major_pattern: "(MAJOR)" + major_pattern: "MAJOR:" # Same as above except indicating a minor change, supports regular expressions wrapped with '/' - minor_pattern: "(MINOR)" + minor_pattern: "MINOR:" # A string to determine the format of the version output version_format: "v${major}.${minor}.${patch}.${increment}" - # Optional path to check for changes. If any changes are detected in the path the - # 'changed' output will true. Enter multiple paths separated by spaces. - change_path: "./TeensyFlasher" - # Named version, will be used as suffix for name version tag - #namespace: project-b - # Indicate whether short tags like 'v1' should be supported. If false only full - # tags like 'v1.0.0' will be recognized. - # If this is set to true, *every* commit will be treated as a new version. + bump_each_commit: false - name: Update AssemblyVersion and AssemblyFileVersion diff --git a/TeensyFlasher/frmMain.Designer.cs b/TeensyFlasher/frmMain.Designer.cs index e3b08dc..2e1cb65 100644 --- a/TeensyFlasher/frmMain.Designer.cs +++ b/TeensyFlasher/frmMain.Designer.cs @@ -64,6 +64,7 @@ private void InitializeComponent() this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.lbFirmware = new System.Windows.Forms.ListBox(); + this.btnHelp = new System.Windows.Forms.Button(); this.tbPages.SuspendLayout(); this.tabGPS.SuspendLayout(); this.pblF9PConfig.SuspendLayout(); @@ -85,6 +86,7 @@ private void InitializeComponent() // // tabGPS // + this.tabGPS.Controls.Add(this.btnHelp); this.tabGPS.Controls.Add(this.pbConfiguration); this.tabGPS.Controls.Add(this.pblF9PConfig); this.tabGPS.Controls.Add(this.lblFirmwareWarning); @@ -378,6 +380,16 @@ private void InitializeComponent() this.lbFirmware.TabIndex = 11; this.lbFirmware.SelectedIndexChanged += new System.EventHandler(this.lbFirmware_SelectedIndexChanged_1); // + // btnHelp + // + this.btnHelp.Location = new System.Drawing.Point(911, 0); + this.btnHelp.Name = "btnHelp"; + this.btnHelp.Size = new System.Drawing.Size(49, 50); + this.btnHelp.TabIndex = 14; + this.btnHelp.Text = "?"; + this.btnHelp.UseVisualStyleBackColor = true; + this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click); + // // frmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -427,6 +439,7 @@ private void InitializeComponent() private RadioButton rbDualLocation; private RadioButton rbSingleF9P; private ProgressBar pbConfiguration; + private Button btnHelp; } } diff --git a/TeensyFlasher/frmMain.cs b/TeensyFlasher/frmMain.cs index b43a76f..e02f043 100644 --- a/TeensyFlasher/frmMain.cs +++ b/TeensyFlasher/frmMain.cs @@ -37,6 +37,8 @@ public partial class frmMain : Form private string _FileName = ".\\Single.txt"; private bool isProgrammingF9P = false; private bool isClosing = false; + private int errorCount = 0; + #region Teensy @@ -275,7 +277,8 @@ private void MySerialPort_DataReceived(object sender, SerialDataReceivedEventArg safeChat("."); spL.Open(); break; - } else + } + else { break; } @@ -292,6 +295,12 @@ private void MySerialPort_DataReceived(object sender, SerialDataReceivedEventArg break; } } + if (!spL.IsOpen) + { + // sometimes the port closes, for some reason... + safeChat("Serial port closed unexpectedly - please try again!"); + return; + } buf = new byte[spL.BytesToRead]; spL.Read(buf, 0, buf.Length); bool ubxMessage = false; @@ -342,6 +351,7 @@ private void MySerialPort_DataReceived(object sender, SerialDataReceivedEventArg // 0x00 is NAK else if (_ubxParseBuffer[3] == 0x00) { + errorCount++; _ack = false; _waitForAckNak.Set(); ResetUbxBuffer(); @@ -512,8 +522,11 @@ public void ConfigureReceiver(string configurationFilename) // Retry sending line if (!SendLine(line)) { - //safeChat("Sending the line again did not work either"); - //break; + if (errorCount > 5) + { + safeChat("Too many errors, aborting"); + throw new Exception("Too many errors"); + } } } } @@ -538,6 +551,7 @@ public void ConfigureReceiver(string configurationFilename) btnConnect.Enabled = true; btnF9PFlashFirmware.Enabled = true; btnURefresh.Enabled = true; + errorCount = 0; //StopReadingData(); } } @@ -717,7 +731,7 @@ private void btnConfigF9P_Click(object sender, EventArgs e) } if (lblFirmwareWarning.ForeColor == Color.Red) { - MessageBox.Show("Firmware MUST be version 1.13. Please flash it first.","Error!!",MessageBoxButtons.OK,MessageBoxIcon.Error); + MessageBox.Show("Firmware MUST be version 1.13. Please flash it first.", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSerialChat.AppendText("Firmware MUST be version 1.13. Please flash it first." + Environment.NewLine); return; } @@ -760,6 +774,51 @@ private void lbFirmware_SelectedIndexChanged_1(object sender, EventArgs e) btnProgram.Enabled = true; } } + + private void btnHelp_Click(object sender, EventArgs e) + { + ContextMenuStrip contexMenu = new ContextMenuStrip(); + contexMenu.Font = new Font("Microsoft Sans Serif", 14); + //contexMenu.Items.Add("Video Tutorial"); + contexMenu.Items.Add("AOGConfig-O-Matic!"); + contexMenu.Items.Add("AgOpenGPS Tools"); + contexMenu.Items.Add("AgOpenGPS videos"); + contexMenu.Items.Add("AgOpenGPS"); + contexMenu.Items.Add("AgHardware"); + contexMenu.Items.Add("AOG Discourse"); + contexMenu.Show(Cursor.Position.X, Cursor.Position.Y); + contexMenu.ItemClicked += new ToolStripItemClickedEventHandler( + contexMenu_ItemClicked); + } + + void contexMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + ToolStripItem item = e.ClickedItem; + switch (item.Text) + { + case "Video Tutorial": + System.Diagnostics.Process.Start("https://www.youtube.com/user/lansing9r"); + break; + case "AgOpenGPS": + System.Diagnostics.Process.Start("https://github.com/farmerbriantee/AgOpenGPS"); + break; + case "AgHardware": + System.Diagnostics.Process.Start("https://github.com/AgHardware"); + break; + case "AgOpenGPS videos": + System.Diagnostics.Process.Start("https://www.youtube.com/user/lansing9r"); + break; + case "AOG Discourse": + System.Diagnostics.Process.Start("https://discourse.agopengps.com/"); + break; + case "AOGConfig-O-Matic!": + System.Diagnostics.Process.Start("https://github.com/lansalot/AOGConfigOMatic"); + break; + case "AgOpenGPS Tools": + System.Diagnostics.Process.Start("https://github.com/lansalot/AgOpenGPS-Tools"); + break; + } + } } }