diff --git a/MobiFlight/Board.cs b/MobiFlight/Board.cs index 83010b6a..9c2008da 100644 --- a/MobiFlight/Board.cs +++ b/MobiFlight/Board.cs @@ -139,7 +139,7 @@ public class Connection /// /// Number of milliseconds to wait for the firmware update to complete before attempting to call GetInfo on the board. /// - public int TimeoutForFirmwareUpdate = 15000; + public int TimeoutForFirmwareUpdate; } /// @@ -414,6 +414,23 @@ public void Migrate() Info.FirmwareExtension = "hex"; } } + + // Issue 1838: + // Handle undefined TimeoutForFirmwareUpdate by setting it to the value for Timeout. + if (Connection.TimeoutForFirmwareUpdate == 0) + { + // This test is required to ensure AvrDudeSettings actually exists. It may not, for example when + // loading a board.json file for something like a Pico. + if (AvrDudeSettings != null) + { + Connection.TimeoutForFirmwareUpdate = AvrDudeSettings.Timeout != 0 ? AvrDudeSettings.Timeout : 15000; + } + else + { + Connection.TimeoutForFirmwareUpdate = 15000; + } + } + } #pragma warning restore CS0612 // Type or member is obsolete