Skip to content

Commit

Permalink
ConnectionOptions fixes (#3254)
Browse files Browse the repository at this point in the history
* ConnectionOptions: wait to fetch params until added

The SerialReader thread does nothing to our new port until it is added
to the list of Comports, but we cannot add it to that list until the
BaseStream is open, or the SerialReader will dispose of the port.

* MAVLinkInterface: apply theme to progress form

The theme would show correctly for the main connection button, but if
anything else, like ConnectionOptions, launched the connection, the
progress bar would show up unthemed.
  • Loading branch information
robertlong13 authored Sep 17, 2024
1 parent c3c8475 commit 1495e88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 10 additions & 4 deletions Controls/ConnectionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ private void BUT_connect_Click(object sender, EventArgs e)

try
{
MainV2.instance.doConnect(mav, CMB_serialport.Text, CMB_baudrate.Text);

MainV2.Comports.Add(mav);

// Connect, but don't try to get params yet, the serial reader thread doesn't try to
// read from this port until we add it to Comports, and it cannot be added to Comports
// until the BaseStream is open.
MainV2.instance.doConnect(mav, CMB_serialport.Text, CMB_baudrate.Text, getparams:false);

MainV2.Comports.Add(mav);

// It is now safe to fetch params
mav.getParamList();

MainV2._connectionControl.UpdateSysIDS();
}
catch (Exception)
Expand Down
6 changes: 5 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ public static void Start(string[] args)

// generic status report screen
MAVLinkInterface.CreateIProgressReporterDialogue += title =>
new ProgressReporterDialogue() {StartPosition = FormStartPosition.CenterScreen, Text = title};
{
var ret = new ProgressReporterDialogue() {StartPosition = FormStartPosition.CenterScreen, Text = title};
ThemeManager.ApplyThemeTo(ret);
return ret;
};

Console.WriteLine("Setup proxy");
try
Expand Down

0 comments on commit 1495e88

Please sign in to comment.