修复连续采集时没有时间间隔导致通讯失败从而导致无有法正常连续采集的问题 修改如下

This commit is contained in:
xin
2024-09-27 16:16:03 +08:00
parent 6d47134dac
commit e8d98f155d
37 changed files with 2361 additions and 257 deletions

View File

@ -57,7 +57,10 @@ pub fn set_port_info(portname: &String, baudrate: u32) {
pub fn get_port_name() -> Vec<String> {
let ports = serialport::available_ports().expect("No ports found!");
println!("Available ports:{}", ports.len());
let mut portnames: Vec<String> = Vec::new();
println!("{}",portnames.len() );
// portnames.push("COM5".to_string());
for p in ports {
portnames.push(p.port_name);
}
@ -91,7 +94,8 @@ pub fn closeport() -> String {
//关闭端口
port_info.port = None;
println!("Port is closed");
String::from("Port is closed")
String::from("串口已关闭")
//String::from("Port is closed")
}
pub fn sendtoprot(data: Vec<u8>) -> String {