diff --git a/src-tauri/src/irishypersptral/mod.rs b/src-tauri/src/irishypersptral/mod.rs index 553cd79..6ec4d48 100644 --- a/src-tauri/src/irishypersptral/mod.rs +++ b/src-tauri/src/irishypersptral/mod.rs @@ -220,7 +220,45 @@ pub fn readformport_iris(commanid: serde_json::Value, wait_time_json: serde_json println!("read data: {}", str); return str.to_string(); } +pub fn set_weave_coeff_iris(specnumber: i32, a0: f64, a1: f64, a2: f64, a3: f64) -> String { + logtorust(format!( + "set_weave_coeff_iris specnumber:{} a0:{} a1:{} a2:{} a3:{}", + specnumber, a0, a1, a2, a3 + )); + // 新建一个serde_json对象 + /* + { + "command": "set_bochangxishu", + "bochangxishu": { + "a0": -1.08988798e-09, + "a1": -5.32620063e-05, + "a2": 0.441532, + "a3": 348.5026, + "b0": -1.2597071e-9, + "b1": -0.000053, + "b2": 0.440609, + "b3": 48.3989 + } + } + */ + let mut data = serde_json::Map::new(); + data.insert("command".to_string(), serde_json::Value::String("set_bochangxishu".to_string())); + let mut bochangxishu = serde_json::Map::new(); + bochangxishu.insert("a0".to_string(), serde_json::Value::from(a0)); + bochangxishu.insert("a1".to_string(), serde_json::Value::from(a1)); + bochangxishu.insert("a2".to_string(), serde_json::Value::from(a2)); + bochangxishu.insert("a3".to_string(), serde_json::Value::from(a3)); + bochangxishu.insert("b0".to_string(), serde_json::Value::from(a0)); + bochangxishu.insert("b1".to_string(), serde_json::Value::from(a1)); + bochangxishu.insert("b2".to_string(), serde_json::Value::from(a2)); + bochangxishu.insert("b3".to_string(), serde_json::Value::from(a3)); + data.insert("bochangxishu".to_string(), serde_json::Value::Object(bochangxishu)); + let data = serde_json::Value::Object(data); + let resut= sendtoport_andgetreturn_iris(data, serde_json::Value::String("json".to_string())); + println!("set_weave_coeff_iris result: {:?}", resut.as_ref().unwrap().content); + "OK".to_string() +} pub fn sendtoport_andgetreturn_iris( data: serde_json::Value, diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 946fa3e..c4ff536 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -146,6 +146,9 @@ fn set_weave_coeff(specnumber: i32, a0: f64, a1: f64, a2: f64, a3: f64) -> Strin DevName::IRIS_SENSOR(sensor_type) =>{ iris_spectral::set_weave_coeff(specnumber, a0, a1, a2, a3); } , + DevName::IRIS_IS11=> { + irishypersptral::set_weave_coeff_iris(specnumber, a0, a1, a2, a3); + }, _ => {}, } "OK".to_string() diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 936f182..427679a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -10,7 +10,7 @@ "package": { "productName": "SpectralPlot", - "version": "0.6.81" + "version": "0.6.93" }, "tauri": { diff --git a/src/components/SerialPort/SerialportMethod.js b/src/components/SerialPort/SerialportMethod.js index aa1fbab..d775cc2 100644 --- a/src/components/SerialPort/SerialportMethod.js +++ b/src/components/SerialPort/SerialportMethod.js @@ -29,6 +29,7 @@ async function Dev_Opt() { } + async function Set_Gain(gain) { //todo 增益设置 @@ -280,7 +281,27 @@ async function Get_Device_Info() { return {error:"error"}; } let json=JSON.parse(message.content); + //判断是否有bandsum 如果没有 则赋值为2048 + if (!json.hasOwnProperty("bandnum")) + { + json.bandnum=2048; + json.bandsum=2048; + json.bochangxishu2=json.bochangxishu; + json.shutter_time_up=100; + json.gain_up=0; + json.gain_down=0; + json.shutter_time_down=100; + json.sensor_gain_up=0; + json.sensor_gain_down=0; + json.shutter_time_up_min=10; + + } + if(json.name=="HS") +{ + json.fiber_type="Dual"; +} dev_info=json; + return json; } diff --git a/src/components/SiderleftSerilportMethod.js b/src/components/SiderleftSerilportMethod.js index cbfead3..99cf77d 100644 --- a/src/components/SiderleftSerilportMethod.js +++ b/src/components/SiderleftSerilportMethod.js @@ -566,7 +566,7 @@ export default { EventBus.emit('setplotname',{up:"DN"}); if(typeof(this.Devinfo.fiber_type)=="undefined") { - this.Devinfo.fiber_type="Single"; + this.Devinfo.fiber_type="Dual"; } diff --git a/src/components/menubox/SetCalibrate.vue b/src/components/menubox/SetCalibrate.vue index 6a7008a..37d5dca 100644 --- a/src/components/menubox/SetCalibrate.vue +++ b/src/components/menubox/SetCalibrate.vue @@ -1,5 +1,6 @@