本文整理匯總了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