本文整理汇总了C#中MissionPlanner.Comms.SerialPort.ReadExisting方法的典型用法代码示例。如果您正苦于以下问题:C# SerialPort.ReadExisting方法的具体用法?C# SerialPort.ReadExisting怎么用?C# SerialPort.ReadExisting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MissionPlanner.Comms.SerialPort
的用法示例。
在下文中一共展示了SerialPort.ReadExisting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadFW
//.........这里部分代码省略.........
// default baud... guess
comPort.BaudRate = 57600;
}
else
{
comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
}
try
{
comPort.Open();
}
catch
{
CustomMessageBox.Show("Error opening port", "Error");
return;
}
uploader.ProgressEvent += uploader_ProgressEvent;
uploader.LogEvent += uploader_LogEvent;
uploader_LogEvent("Trying Firmware Mode");
bootloadermode = false;
}
// check for either already bootloadermode, or if we can do a ATI to ID the firmware
if (bootloadermode || doConnect(comPort))
{
// put into bootloader mode/update mode
if (!bootloadermode)
{
try
{
comPort.Write("AT&UPDATE\r\n");
var left = comPort.ReadExisting();
log.Info(left);
Sleep(700);
comPort.BaudRate = 115200;
}
catch
{
}
if (upload_xmodem(comPort))
{
comPort.Close();
return;
}
comPort.BaudRate = 115200;
}
try
{
// force sync after changing baudrate
uploader.connect_and_sync();
}
catch
{
CustomMessageBox.Show("Failed to sync with Radio");
goto exit;
}
var device = Uploader.Board.FAILED;
var freq = Uploader.Frequency.FAILED;
// get the device type and frequency in the bootloader