Add PEL_1 component and integrate into DeviceParameterRecording.vue; introduce ScanMode configuration

This commit is contained in:
peterlu14
2025-01-23 14:22:06 +08:00
parent eb686c7a11
commit fa2f45dbce
4 changed files with 304 additions and 0 deletions
@@ -115,6 +115,9 @@
<div v-if="[0,1].includes(parameter.MODE)">
<PEL :device="device"></PEL>
</div>
<div v-else-if="[3].includes(parameter.MODE)">
<PEL_1 :device="device"></PEL_1>
</div>
<div v-else>
<component
v-for="name in parameterArrayInMode"
@@ -203,6 +206,7 @@ import { mapFields } from 'vuex-map-fields'
import configTable from '@/data/config-table/index'
import ElectricalStimulation from '../parameter/itemNew/ElectricalStimulation/ElectricalStimulation'
import PEL from './itemNew/PEL'
import PEL_1 from './itemNew/PEL_1'
export default {
name: 'EliteParameterRecordingElitezm15',
@@ -220,6 +224,7 @@ export default {
TriggerNew,
ElectricalStimulation,
PEL,
PEL_1,
},
props: {
parameter: {
@@ -0,0 +1,120 @@
<template>
<div>
<div style="height: 60vh; overflow-y: scroll; overflow-x: hidden; scrollbar-width: none;">
<div>
<h1 style="font-size: 20px;">Pattern Set</h1>
</div>
<div style="display: flex; margin-top: 0.5rem; margin-bottom: 1rem; width: 90%; justify-content: flex-start; align-items: center;">
<span>From</span> <input type="text" class="flex-item mx-2" v-model="inputMin" @blur="setPatternMin">
<span>To</span> <input type="text" class="flex-item mx-2" v-model="inputMax" @blur="setPatternMax">
</div>
</div>
</div>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
import { mapFields } from 'vuex-map-fields'
export default {
name: 'PEL_1',
components: {
},
props: {
device: {
type: Object,
required: true,
},
},
data () {
return {
input1: '0',
input2: '0',
input3: '0',
input4: '0',
input5: '0',
inputMax: '0',
inputMin: '0',
switchInput: false,
}
},
computed: {
...mapFields('', [
'developerMode',
]),
},
methods: {
setPulse: function () {
this.setParameter('PULSE', [this.hexToInt(this.input1), this.hexToInt(this.input2), this.hexToInt(this.input3)])
},
setPattern: function () {
this.setParameter('PATTERN', this.input5)
},
setPatternMax: function () {
if (this.inputMax < this.inputMin) {
this.inputMax = this.inputMin + 1
} else if (this.inputMax > 100) {
this.inputMax = 100
}
this.setParameter('PATTERN_MAX', this.inputMax)
},
setPatternMin: function () {
if (this.inputMax < this.inputMin) {
this.inputMin = this.inputMax - 1
} else if (this.inputMax < 1) {
this.inputMin = 1
}
this.setParameter('PATTERN_MIN', this.inputMin)
},
setSwitch: function () {
this.setParameter('PATTERN_SWITCH', this.switchInput)
},
intToHex: function (int) {
return int.toString(2).padStart(4, '0')
},
hexToInt (hex) {
return parseInt(hex, 2)
},
mqttPublish: function (topic, mes) {
this.$mqtt.publish(topic, mes)
},
setParameter: function (parameterName, parameterValue) {
this.mqttPublish(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: this.device.mac_address,
parameter: parameterName,
content: parameterValue,
}))
},
tag: function () {
this.mqttPublish(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: this.device.mac_address,
instruction: 'get_data',
}))
},
},
mounted () {
this.inputMax = this.device.configuration.PATTERN_MAX
this.inputMin = this.device.configuration.PATTERN_MIN
},
destroyed () {
},
}
</script>
<style lang="scss">
.no-dark-style-va-button {
&:focus {
filter: brightness(100%);
}
}
.flex-item {
width: 55px; /* Max width of 75px */
padding: 5px;
margin-right: 1rem;
}
</style>
+173
View File
@@ -0,0 +1,173 @@
export default {
name: 'Electrial Stimulation',
parameter: [], // 這個mode用到的參數
showParameter: [], // 有要秀給user看的參數
headerParameter: () => [], // export header的參數
valScales: {
},
channels: {
time: {
name: 'Time',
physicalQuantity: 'ms',
unit: {
ms: 1,
s: 1e3,
minute: 60 * 1e3,
hour: 60 * 60 * 1e3,
},
defaultUnit: 'ms',
downloadUnit: 'ms',
},
10: {
order: 10,
name: 'Pattern',
physicalQuantity: '',
unit: {
'': 1,
},
defaultUnit: '',
downloadUnit: '',
},
11: {
order: 11,
name: 'Pattern Manual',
physicalQuantity: '',
unit: {
'': 1,
},
defaultUnit: '',
downloadUnit: '',
},
0: {
order: 0,
name: 'R1',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
1: {
order: 1,
name: 'R2',
physicalQuantity: 'mV',
unit: {
mV: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
2: {
order: 2,
name: 'VO',
physicalQuantity: 'mV',
unit: {
mV: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
3: {
order: 3,
name: 'VCC',
physicalQuantity: 'mV',
unit: {
mV: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
4: {
order: 4,
name: 'VEE',
physicalQuantity: 'mV',
unit: {
mV: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
5: {
order: 5,
name: 'R1 Float',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
6: {
order: 6,
name: 'R2 Float',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
7: {
order: 7,
name: 'VO Float',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
8: {
order: 8,
name: 'VCC Float',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
9: {
order: 9,
name: 'VEE Float',
physicalQuantity: 'mV',
unit: {
mv: 1,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
// 12: {
// order: 12,
// type: 'formula',
// name: '∆VO',
// physicalQuantity: 'mV',
// unit: {
// mV: 1,
// },
// formula: (data) => {
// return data[2] - data[4]
// },
// defaultUnit: 'mV',
// downloadUnit: 'mV',
// },
// 13: {
// type: 'formula',
// name: 'Current [A]',
// physicalQuantity: 'A',
// unit: {
// A: 1,
// },
// formula: (data) => {
// return (data[2] - data[4])
// },
// defaultUnit: 'A',
// downloadUnit: 'A',
// },
},
charts: {
default: [
],
},
}
+6
View File
@@ -1,6 +1,7 @@
import SelectResistor from './SelectResistor'
import SelectResistorFull from './SelectResistorFull'
import DevMode from './DevMode'
import ScanMode from './ScanMode'
/**
* Number-type-parameter
@@ -48,6 +49,10 @@ const PEL = {
id: 1,
description: 'SELECT RESISTOR FULL DATA',
},
{
id: 3,
description: 'IOPL & IOPH',
},
{
id: 2,
description: 'Dev Mode',
@@ -57,6 +62,7 @@ const PEL = {
0: SelectResistor,
1: SelectResistorFull,
2: DevMode,
3: ScanMode,
},
}