6.95
This commit is contained in:
Binary file not shown.
@ -258,6 +258,10 @@ pub fn collcect_dark(shuttertime:u32)
|
||||
thread::spawn(move || {
|
||||
let mut datasum:Vec<u32>=vec![0;bandsunm];
|
||||
sensor_set_shutter_open(0);
|
||||
//延时200ms
|
||||
|
||||
thread::sleep(std::time::Duration::from_millis(2000));
|
||||
|
||||
for _i in 0..averagenumber {
|
||||
|
||||
let data=super::spectralbase::sensor_get_data(shuttertime as i32);
|
||||
@ -271,6 +275,7 @@ pub fn collcect_dark(shuttertime:u32)
|
||||
drop(dev_stat); //释放锁
|
||||
}
|
||||
sensor_set_shutter_open(1);
|
||||
thread::sleep(std::time::Duration::from_millis(2000));
|
||||
let data=datasum.iter().map(|x| *x as f32/averagenumber as f32).collect::<Vec<f32>>();
|
||||
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
"package": {
|
||||
"productName": "SpectralPlot",
|
||||
"version": "0.6.93"
|
||||
"version": "0.6.95"
|
||||
},
|
||||
"tauri": {
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {invoke} from "@tauri-apps/api/tauri";
|
||||
import { dialog, fs } from "@tauri-apps/api";
|
||||
import * as echarts from "echarts";
|
||||
import SerialportMethod from "../SerialPort/SerialportMethod.js";
|
||||
|
||||
@ -24,11 +25,11 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
let that=this;
|
||||
//await
|
||||
//await
|
||||
await setTimeout(function() {
|
||||
that.GetSenSorInfo();
|
||||
// 这里是你要在100毫秒后执行的代码
|
||||
|
||||
|
||||
}, 100);
|
||||
await setTimeout(function() {
|
||||
that.GetSenSorInfo();
|
||||
@ -89,7 +90,7 @@ export default {
|
||||
//min:0,
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
left: 60,
|
||||
right: '5%',
|
||||
bottom: '5%',
|
||||
top: '5%'
|
||||
@ -156,6 +157,7 @@ export default {
|
||||
|
||||
|
||||
|
||||
|
||||
let chartpeak=
|
||||
{
|
||||
data:peaksforshow, // 使用二维数组表示数据点的坐标
|
||||
@ -164,7 +166,7 @@ export default {
|
||||
show: true,
|
||||
position: 'top',
|
||||
formatter: function (params) {
|
||||
return params.value[2]
|
||||
return params.value[2]
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +207,38 @@ export default {
|
||||
chart_up.setOption(this.option);
|
||||
|
||||
// console.log(dataforshow);
|
||||
|
||||
|
||||
},
|
||||
async Set_Weave_Coeff() {
|
||||
await SerialportMethod.Set_Weave_Coeff(0, this.Devinfo.bochangxishu.a0, this.Devinfo.bochangxishu.a1, this.Devinfo.bochangxishu.a2, this.Devinfo.bochangxishu.a3);
|
||||
await this.saveCoeffToFile();
|
||||
},
|
||||
async saveCoeffToFile() {
|
||||
const now = new Date();
|
||||
const pad = n => String(n).padStart(2, '0');
|
||||
const dateStr = `${now.getFullYear()}${pad(now.getMonth()+1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
const serial = this.Devinfo?.serialnumber || this.Devinfo?.SerilNumber || "Unknown";
|
||||
const defaultName = `${serial}_${dateStr}.json`;
|
||||
|
||||
const savePath = await dialog.save({
|
||||
defaultPath: defaultName,
|
||||
filters: [{ name: "JSON文件", extensions: ["json"] }]
|
||||
});
|
||||
if (!savePath) return;
|
||||
|
||||
const data = {
|
||||
serialnumber: serial,
|
||||
saveTime: now.toISOString(),
|
||||
sensor_type: this.Devinfo?.sensor_type || "",
|
||||
bochangxishu: {
|
||||
a0: this.Devinfo.bochangxishu.a0,
|
||||
a1: this.Devinfo.bochangxishu.a1,
|
||||
a2: this.Devinfo.bochangxishu.a2,
|
||||
a3: this.Devinfo.bochangxishu.a3,
|
||||
}
|
||||
};
|
||||
|
||||
await fs.writeTextFile(savePath, JSON.stringify(data, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +294,7 @@ export default {
|
||||
</b-input-group>
|
||||
<b-button @click="GetOneData" style="position:absolute;left: 25% ">获取数据</b-button>
|
||||
<b-button @click="updataName" style="position:absolute; right: 50% ">计算</b-button>
|
||||
<b-button @click="updataName" style="position:absolute;right: 20px ">设置</b-button>
|
||||
<b-button @click="Set_Weave_Coeff" style="position:absolute;right: 20px ">设置</b-button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { dialog, fs } from "@tauri-apps/api";
|
||||
import * as echarts from "echarts";
|
||||
import SensorMethod from "../SerialPort/SerialportMethod.js";
|
||||
import { Checkbox } from "@arco-design/web-vue";
|
||||
@ -161,7 +162,7 @@ export default {
|
||||
//min:0,
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
left: 60,
|
||||
right: '5%',
|
||||
bottom: '10%',
|
||||
top: '5%'
|
||||
@ -609,10 +610,45 @@ export default {
|
||||
|
||||
},
|
||||
async Set_Weave_Coeff() {
|
||||
SensorMethod.Set_Weave_Coeff(0, this.Devinfo.bochangxishu.a0, this.Devinfo.bochangxishu.a1, this.Devinfo.bochangxishu.a2, this.Devinfo.bochangxishu.a3);
|
||||
await SensorMethod.Set_Weave_Coeff(0, this.Devinfo.bochangxishu.a0, this.Devinfo.bochangxishu.a1, this.Devinfo.bochangxishu.a2, this.Devinfo.bochangxishu.a3);
|
||||
if (this.Devinfo.fiber_type == "Dual")
|
||||
SensorMethod.Set_Weave_Coeff(1, this.Devinfo.bochangxishu2.a0, this.Devinfo.bochangxishu2.a1, this.Devinfo.bochangxishu2.a2, this.Devinfo.bochangxishu2.a3);
|
||||
await SensorMethod.Set_Weave_Coeff(1, this.Devinfo.bochangxishu2.a0, this.Devinfo.bochangxishu2.a1, this.Devinfo.bochangxishu2.a2, this.Devinfo.bochangxishu2.a3);
|
||||
|
||||
await this.saveCoeffToFile();
|
||||
|
||||
},
|
||||
async saveCoeffToFile() {
|
||||
const now = new Date();
|
||||
const pad = n => String(n).padStart(2, '0');
|
||||
const dateStr = `${now.getFullYear()}${pad(now.getMonth()+1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
const serial = this.Devinfo?.serialnumber || this.Devinfo?.SerilNumber || "Unknown";
|
||||
const defaultName = `${serial}_${dateStr}.json`;
|
||||
|
||||
const savePath = await dialog.save({
|
||||
defaultPath: defaultName,
|
||||
filters: [{ name: "JSON文件", extensions: ["json"] }]
|
||||
});
|
||||
if (!savePath) return;
|
||||
|
||||
const data = {
|
||||
serialnumber: serial,
|
||||
saveTime: now.toISOString(),
|
||||
sensor_type: this.Devinfo?.sensor_type || "",
|
||||
bochangxishu: {
|
||||
a0: this.Devinfo.bochangxishu.a0,
|
||||
a1: this.Devinfo.bochangxishu.a1,
|
||||
a2: this.Devinfo.bochangxishu.a2,
|
||||
a3: this.Devinfo.bochangxishu.a3,
|
||||
},
|
||||
bochangxishu2: this.Devinfo.bochangxishu2 ? {
|
||||
a0: this.Devinfo.bochangxishu2.a0,
|
||||
a1: this.Devinfo.bochangxishu2.a1,
|
||||
a2: this.Devinfo.bochangxishu2.a2,
|
||||
a3: this.Devinfo.bochangxishu2.a3,
|
||||
} : undefined
|
||||
};
|
||||
|
||||
await fs.writeTextFile(savePath, JSON.stringify(data, null, 2));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user