for 合并
This commit is contained in:
@ -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,
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
"package": {
|
||||
"productName": "SpectralPlot",
|
||||
"version": "0.6.81"
|
||||
"version": "0.6.93"
|
||||
},
|
||||
"tauri": {
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import SensorMethod from "../SerialPort/SerialportMethod.js";
|
||||
import SerilporDefine from "../serportdefine.js";
|
||||
// import SerialportMethod from "../SerialPort/SerialportMethod.js";
|
||||
import * as echarts from "echarts";
|
||||
// import EventBus from "../../eventBus.js";
|
||||
@ -221,12 +222,12 @@ export default {
|
||||
|
||||
this.shutter_time_up = ret;
|
||||
this.sensor_gain_up = 0;
|
||||
let datatoshow=await SensorMethod.Get_Dark_Data("UP",this.shutter_time_up,10);
|
||||
// let datatoshow=await SensorMethod.Get_Date_on_Derction("UP",this.shutter_time_up,10);
|
||||
} else if (dire == 1) {
|
||||
var ret = await SensorMethod.Dev_Opt_Two(70);
|
||||
var ret = await SensorMethod.Dev_Opt(70);
|
||||
this.shutter_time_down = ret;
|
||||
this.sensor_gain_down = 0;
|
||||
let datatoshow=await SensorMethod.Get_Dark_Data("UP",this.shutter_time_down,10);
|
||||
// let datatoshow=await SensorMethod.Get_Date_on_Derction("UP",this.shutter_time_down,10);
|
||||
}
|
||||
|
||||
|
||||
@ -263,6 +264,7 @@ export default {
|
||||
if (this.Devinfo.fiber_type == "Single") {
|
||||
this.shutter_time_up = this.Devinfo.shutter_time;
|
||||
} else if (this.Devinfo.fiber_type == "Dual") {
|
||||
|
||||
this.sensor_gain_up = this.Devinfo.sensor_gain_up;
|
||||
this.shutter_time_down = this.Devinfo.shutter_time_down;
|
||||
this.shutter_time_up = this.Devinfo.shutter_time_up;
|
||||
@ -276,6 +278,7 @@ export default {
|
||||
|
||||
|
||||
let isDual = this.Devinfo.fiber_type == "Dual" ? true : false;
|
||||
|
||||
|
||||
var coeff = [];
|
||||
coeff[0] = this.Devinfo.bochangxishu.a0;
|
||||
@ -419,6 +422,7 @@ export default {
|
||||
this.option_down.xAxis.min = this.option_down.xAxis.max;
|
||||
this.option_down.xAxis.max = temp;
|
||||
}
|
||||
chart_down.setOption(this.option_down);
|
||||
}
|
||||
this.option_lamp.legend.data = ['Lamp'];
|
||||
this.option_lamp.series[0].name = 'Lamp';
|
||||
@ -593,7 +597,7 @@ export default {
|
||||
gain: this.upGain.Data,
|
||||
shutter: this.upGain.shutter_time,
|
||||
sensorGain: Number(this.upGain.sensor_gain),
|
||||
direction: true,
|
||||
direction: false,
|
||||
filepath: "./calibratefile/"+basename+"upgain.bin"
|
||||
}
|
||||
await invoke("savecalibratefile", data);
|
||||
@ -608,7 +612,7 @@ export default {
|
||||
gain: this.upOffset.Data,
|
||||
shutter: this.upOffset.shutter_time,
|
||||
sensorGain: Number(this.upOffset.sensor_gain),
|
||||
direction: true,
|
||||
direction: false,
|
||||
filepath: "./calibratefile/"+basename+"upOffset.bin"
|
||||
}
|
||||
await invoke("savecalibratefile", data);
|
||||
|
||||
@ -47,17 +47,17 @@ export default {
|
||||
fiber_fov:1,
|
||||
lenth_emun:[
|
||||
{value:"1", label:"1"},
|
||||
{value:"8", label:"8°"},
|
||||
{value:"25", label:"25°"},
|
||||
{value:"360", label:"RCR/360°"},
|
||||
{value:"F", label:"光纤"}
|
||||
{value:"8", label:"8°"},
|
||||
{value:"25", label:"25°"},
|
||||
{value:"180", label:"RCR/180°"},
|
||||
{value:"F", label:"光纤"}
|
||||
|
||||
],
|
||||
fiber_fov_emun:[
|
||||
{value:"1", label:"1"},
|
||||
{value:"8", label:"8°"},
|
||||
{value:"25", label:"25°"},
|
||||
{value:"360", label:"RCR/360°"}
|
||||
{value:"8", label:"8°"},
|
||||
{value:"25", label:"25°"},
|
||||
{value:"180", label:"RCR/180°"}
|
||||
|
||||
|
||||
]
|
||||
@ -635,7 +635,7 @@ export default {
|
||||
gain: this.upGain.Data,
|
||||
shutter: this.upGain.shutter_time,
|
||||
sensorGain: Number(this.upGain.sensor_gain),
|
||||
direction: true,
|
||||
direction: false,
|
||||
filepath: "./calibratefile/"+basename+"upgain.bin"
|
||||
}
|
||||
await invoke("savecalibratefile", data);
|
||||
@ -649,7 +649,7 @@ export default {
|
||||
gain: this.upOffset.Data,
|
||||
shutter: this.upOffset.shutter_time,
|
||||
sensorGain: Number(this.upOffset.sensor_gain),
|
||||
direction: true,
|
||||
direction: false,
|
||||
filepath: "./calibratefile/"+basename+"upOffset.bin"
|
||||
}
|
||||
await invoke("savecalibratefile", data);
|
||||
|
||||
@ -391,7 +391,7 @@ export default {
|
||||
let data={
|
||||
gain:this.upGain.gain,
|
||||
shutter:this.upGain.shutter_time,
|
||||
direction:true,
|
||||
direction:false,
|
||||
filepath:"./calibratefile/upgain.bin"
|
||||
}
|
||||
await invoke("savecalibratefile",data);
|
||||
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
fiber_type: "Dual"
|
||||
|
||||
|
||||
},
|
||||
},all_averagetime:1,
|
||||
WeavePeaksDeffine: [
|
||||
0,
|
||||
253.652,
|
||||
@ -105,7 +105,7 @@ export default {
|
||||
this.Devinfo = await SensorMethod.Get_Device_Info();
|
||||
this.sensor_gain_down = this.Devinfo.sensor_gain_down;
|
||||
if (typeof (this.Devinfo.fiber_type) == "string") {
|
||||
this.fiber_type = this.Devinfo.fiber_type;
|
||||
this.Devinfo.fiber_type = this.Devinfo.fiber_type;
|
||||
}
|
||||
if (this.Devinfo.fiber_type == "Single") {
|
||||
this.shutter_time_up = this.Devinfo.shutter_time;
|
||||
@ -217,7 +217,7 @@ export default {
|
||||
// width: '新的宽度',
|
||||
// height: '新的高度'
|
||||
});
|
||||
if (this.fiber_type == "Dual") {
|
||||
if (this.Devinfo.fiber_type == "Dual") {
|
||||
|
||||
this.optiondown = JSON.parse(JSON.stringify(this.option));
|
||||
|
||||
@ -464,6 +464,7 @@ export default {
|
||||
},
|
||||
async GetDataDrection(specindex) {
|
||||
if (specindex == 0) {
|
||||
var ret2 = await SensorMethod.Get_Date_on_Derction("UP", 20, false, 1)
|
||||
var ret = await SensorMethod.Dev_Opt(80, 2);
|
||||
this.shutter_time_up=ret;
|
||||
// this.shutter_time_up = ret.shuttertimes;
|
||||
@ -471,9 +472,10 @@ export default {
|
||||
this.GetOneData();
|
||||
}
|
||||
else if (specindex == 1) {
|
||||
var ret = await SensorMethod.Dev_Opt_Two(80, 3);
|
||||
this.shutter_time_down = ret.shuttertimes;
|
||||
this.sensor_gain_down = ret.gain;
|
||||
var ret2 = await SensorMethod.Get_Date_on_Derction("DOWN", 20, false,1)
|
||||
var ret = await SensorMethod.Dev_Opt(80, 3);
|
||||
this.shutter_time_down = ret
|
||||
// this.sensor_gain_down = ret.gain;
|
||||
this.GetOneDatadown();
|
||||
}
|
||||
|
||||
@ -486,7 +488,7 @@ export default {
|
||||
let coeffweave4 = this.Devinfo.bochangxishu2.a3;
|
||||
await SensorMethod.Set_Gain(this.sensor_gain_down);
|
||||
// await SensorMethod.Get_Date_on_Derction("UP", this.shutter_time_down, false, 1)
|
||||
var data = await SensorMethod.Get_Date_on_Derction("DOWN", this.shutter_time_down, false, 1)
|
||||
var data = await SensorMethod.Get_Date_on_Derction("DOWN", Number(this.shutter_time_down), false, Number(this.all_averagetime))
|
||||
this.DataDown = data; //获取波长系数
|
||||
var lenthofdata = data.data.length;
|
||||
let dataforshow = [];
|
||||
@ -516,7 +518,7 @@ export default {
|
||||
let coeffweave3 = this.Devinfo.bochangxishu.a2;
|
||||
let coeffweave4 = this.Devinfo.bochangxishu.a3;
|
||||
await SensorMethod.Set_Gain(this.sensor_gain_up);
|
||||
var data = await SensorMethod.Get_Date_on_Derction("UP", this.shutter_time_up, false, 1)
|
||||
var data = await SensorMethod.Get_Date_on_Derction("UP", Number(this.shutter_time_up), false, Number(this.all_averagetime))
|
||||
this.Data = data; //获取波长系数
|
||||
var lenthofdata = data.data.length;
|
||||
let dataforshow = [];
|
||||
@ -727,7 +729,7 @@ export default {
|
||||
</BCardText>
|
||||
</BCard>
|
||||
<BCard header="sensor 2" header-text-variant="white" header-tag="header" header-bg-variant="dark"
|
||||
style="max-width: 20rem" v-if="fiber_type == 'Dual'">
|
||||
style="max-width: 20rem" v-if="Devinfo.fiber_type == 'Dual'">
|
||||
<BCardText><b-input-group class="my-1">
|
||||
<BInputGroupPrepend is-text class="myinputprepend">a0</BInputGroupPrepend>
|
||||
<b-form-input type="number" step="0.00000000000001" v-model="Devinfo.bochangxishu2.a0"></b-form-input>
|
||||
@ -751,8 +753,15 @@ export default {
|
||||
</BCard>
|
||||
|
||||
|
||||
<p style="position:absolute ;bottom: 60px;width: 100%;height: 30px">
|
||||
<b-input-group class="my-1">
|
||||
<BInputGroupPrepend is-text class="myinputprepend">采集平均次数</BInputGroupPrepend>
|
||||
<b-form-input type="number" step="1" min="1" max="100" v-model="all_averagetime"></b-form-input>
|
||||
</b-input-group>
|
||||
</p>
|
||||
<p style="position:absolute ;bottom: 10px;width: 100%;height: 30px">
|
||||
<b-button @click="Set_Weave_Coeff" style="position:absolute;left: 20px ">设置</b-button>
|
||||
|
||||
<b-button @click="GetSenSorInfo" style="position:absolute;right: 20px ">恢复</b-button>
|
||||
</p>
|
||||
|
||||
@ -764,12 +773,12 @@ export default {
|
||||
|
||||
|
||||
|
||||
<div class="row linbox" :style="fiber_type == 'Dual' ? 'height: 50%' : 'height: 100%'">
|
||||
<div class="row linbox" :style="Devinfo.fiber_type == 'Dual' ? 'height: 50%' : 'height: 100%'">
|
||||
<b-button @click="findpeak(0)"
|
||||
style="position:absolute;right: 20%;margin-top:5px;z-index: 10;width: 60px; ">寻峰</b-button>
|
||||
<b-button @click="GetDataDrection(0)"
|
||||
style="position:absolute;right: 20%;margin-top:5%; z-index: 10; ;width: 60px ">采集</b-button>
|
||||
|
||||
style="position:absolute;right: 20%;margin-top:4%; z-index: 10; ;width: 60px ">采集 </b-button>
|
||||
|
||||
<a-tag style="position:absolute;right: 20%;margin-top:10%; z-index: 10; ;width: 80px ">{{
|
||||
shutter_time_up.toFixed(2) }} ms</a-tag>
|
||||
<a-tag style="position:absolute;right: 20%;margin-top:13%; z-index: 10; ;width: 80px ">{{
|
||||
@ -816,7 +825,7 @@ export default {
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row linbox" v-if="fiber_type == 'Dual'">
|
||||
<div class="row linbox" v-if="Devinfo.fiber_type == 'Dual'">
|
||||
<b-button @click="findpeak(1)"
|
||||
style="position:absolute;right: 20%;margin-top:5px; z-index: 10; ;width: 60px ">寻峰</b-button>
|
||||
<b-button @click="GetDataDrection(1)"
|
||||
|
||||
Reference in New Issue
Block a user