Compare commits

...

41 Commits

Author SHA1 Message Date
Jordan Hsu fa7b51143b [update] neulive 3.5 repeatIntervalCheck with cycle 2021-10-28 09:54:45 +08:00
peterlu14 7c300a4ce2 [update] neulive3.5 repeatIntervalCheck 2021-10-28 00:04:32 +08:00
TommyXin e6a9a3fbd6 Merge branch 'neulive_sunpower' into release/AS_1027 2021-10-27 22:16:35 +08:00
TommyXin f523c189dc remove console.log 2021-10-27 22:15:42 +08:00
TommyXin bc86b2f541 Merge branch 'neulive_sunpower' into release/gimer_1026 2021-10-27 22:14:05 +08:00
peterlu14 5ea023df43 [update] remove filetable get sd card uuidList 2021-10-27 22:08:57 +08:00
TommyXin ebf912a971 clear stiTimeOut 2021-10-27 21:59:15 +08:00
TommyXin d440dfbe39 clear stiTimeOut 2021-10-27 21:51:52 +08:00
TommyXin e61d4340a7 gimer id 2021-10-27 16:12:33 +08:00
TommyXin 810e8c46e9 update 2021-10-27 16:12:12 +08:00
TommyXin 1c32850990 remove gimer routes 2021-10-27 16:02:46 +08:00
TommyXin 21bb7440f1 Merge remote-tracking branch 'origin/release/gimer_1026' into release/gimer_1026 2021-10-27 15:50:32 +08:00
TommyXin 505a2a9e03 Merge branch 'neulive_sunpower' into release/gimer_1026 2021-10-27 15:48:13 +08:00
TommyXin f6a6c4101d update gimer icon 2021-10-27 15:47:34 +08:00
TommyXin c4fc506f9f ch number for filter 2021-10-27 15:28:20 +08:00
TommyXin 3a8315339a Merge remote-tracking branch 'origin/neulive_sunpower' into neulive_sunpower 2021-10-27 15:27:06 +08:00
TommyXin 08b3904cb9 channel number & amplitude change 2021-10-27 15:26:55 +08:00
peterlu14 b2ba658e6e [update] add library name list 2021-10-27 15:12:21 +08:00
peterlu14 76a16cae1a [update] ampgain diff from library 2021-10-27 15:01:21 +08:00
TommyXin 9c42c05621 [bug] sti ex time = interval * number 2021-10-27 14:46:33 +08:00
TommyXin 468c5a2567 regular 3.5 check sti done 2021-10-27 11:01:43 +08:00
TommyXin 70651f55c0 [update] neulive regular 3.5 UI 2021-10-27 10:33:19 +08:00
TommyXin f237efc430 Merge remote-tracking branch 'origin/feature/sd_card_check_and_init' into release/gimer_1026 2021-10-26 18:45:34 +08:00
TommyXin ab15129100 Merge branch 'neulive_sunpower' into release/gimer_1026 2021-10-26 18:43:46 +08:00
TommyXin 38f440ea67 add gimer icon to app sidebar 2021-10-26 18:32:18 +08:00
peterlu14 6c9fb2e513 [update] update transmission_type status 2021-10-26 17:15:05 +08:00
TommyXin 7c6a05ecc4 amplitude * 10 (for UI) 2021-10-26 16:15:54 +08:00
TommyXin f63fca5fc4 remove console.log 2021-10-26 14:46:21 +08:00
TommyXin b59262643f Merge remote-tracking branch 'origin/feature/sd_card_check_and_init' into neulive_sunpower 2021-10-26 14:36:20 +08:00
TommyXin 2650ba10fb Merge branch 'feature/dpv' into neulive_sunpower 2021-10-26 14:35:56 +08:00
TommyXin 578578a312 multi filter & check stimulation 2021-10-26 14:35:04 +08:00
peterlu14 6e700e7201 [update] disable device_update_usb 2021-10-26 11:31:01 +08:00
TommyXin 99ef7bfe04 Merge branch 'neulive_sunpower' into feature/dpv 2021-10-26 11:07:52 +08:00
TommyXin 0d88866001 sti check exTime 2021-10-26 11:07:25 +08:00
TommyXin 0150eebb0c fix amp gain bug 2021-10-26 10:36:31 +08:00
Jordan Hsu f885812258 [add] missing code 2021-10-26 09:21:40 +08:00
Jordan Hsu 21f5c75836 [init] dpv front end with formula 2021-10-25 16:34:38 +08:00
TommyXin bf20a50107 realtime filter [notch] 2021-10-25 15:36:28 +08:00
TommyXin d72e59bb81 amp gain change 500&300 2021-10-22 22:00:48 +08:00
TommyXin 69058bd0f0 deviceList vuex 2021-10-22 21:25:45 +08:00
TommyXin 6639560dd4 Merge remote-tracking branch 'origin/release/neulive_elite_1012' into neulive_sunpower 2021-10-22 17:26:42 +08:00
57 changed files with 1066 additions and 857 deletions
+2 -2
View File
@@ -54,9 +54,9 @@ Vue.use(VueWorker)
Vue.use(VueAxios, axios)
// Vue.use(VueMqtt, 'ws://52.194.17.114:8083')
// Vue.use(VueMqtt, 'ws://' + location.href.split('/')[2] + ':8083')
Vue.use(VueMqtt, 'ws://' + location.href.split('/')[2] + ':8083')
// Vue.use(VueMqtt, 'ws://' + '192.168.151.125' + ':8083')
Vue.use(VueMqtt, 'ws://' + '192.168.3.48' + ':8083')
// Vue.use(VueMqtt, 'ws://' + '192.168.3.48' + ':8083')
Vue.prototype.GLOBAL = global_
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -40,13 +40,13 @@ export const navigationRoutes = {
// },
// ],
},
{
name: 'task-content-g-m',
displayName: 'Task-Gimer',
meta: {
iconClass: 'vuestic-iconset vuestic-iconset-statistics',
},
},
// {
// name: 'task-content-g-m',
// displayName: 'Gimer',
// meta: {
// iconClass: 'vuestic-iconset vuestic-iconset-statistics',
// },
// },
{
name: 'file',
displayName: 'File',
@@ -11,12 +11,26 @@
:to="to"
:target="target"
>
<va-icon
v-if="icon"
class="app-sidebar-link__item-icon"
:style="computedIconStyles"
:name="icon"
/>
<template v-if="title == 'Gimer'">
<img
v-if="this.isHovered || this.isActive"
class="app-sidebar-link__item-icon"
src="@/assets/img/gimer_white.png"
>
<img
v-else
class="app-sidebar-link__item-icon"
src="@/assets/img/gimer_gray.png"
>
</template>
<template v-else>
<va-icon
v-if="icon"
class="app-sidebar-link__item-icon"
:style="computedIconStyles"
:name="icon"
/>
</template>
<div class="app-sidebar-link__item-title" v-if="title">
<slot>
{{title}}
@@ -140,6 +154,21 @@ export default {
color: 'white',
}
},
computedGimerIcon () {
if (this.contextConfig.invertedColor) {
if (this.isHovered || this.isActive) {
return 'gimer_white.png'
}
return 'gimer_gray.png'
}
if (this.isHovered || this.isActive) {
return 'gimer_white.png'
}
return 'gimer_white.png'
},
},
methods: {
updateHoverState (isHovered) {
+1 -1
View File
@@ -127,7 +127,7 @@ export default {
getControllerList: async function () {
const update = async () => {
this.controllerList.push({
id: 'tommy_test',
id: 'BPS-HUB-02-072',
mac: '',
status: 'loading',
isScan: true,
+5 -5
View File
@@ -346,14 +346,14 @@ export default {
default:
break
}
console.log(String.fromCharCode.apply(null, data), topic)
// console.log(String.fromCharCode.apply(null, data), topic)
},
},
methods: {
getControllerList: async function () {
const update = async () => {
this.controllerList.push({
id: 'tommy_test',
id: 'BPS-HUB-02-072',
mac: '',
status: 'loading',
isScan: true,
@@ -403,9 +403,9 @@ export default {
this.mqttPub(controller.id + '_user', JSON.stringify({
header: 'hardware_info/0',
}))
this.mqttPub(controller.id + '_user', JSON.stringify({
header: 'device_update_usb/0',
}))
// this.mqttPub(controller.id + '_user', JSON.stringify({
// header: 'device_update_usb/0',
// }))
this.createInitialCollection('admin')
})
},
+1 -1
View File
@@ -43,7 +43,7 @@ export default {
getControllerList: async function () {
const update = async () => {
this.controllerList.push({
id: 'tommy_test',
id: 'BPS-HUB-02-072',
mac: '',
status: 'loading',
isScan: true,
+1 -1
View File
@@ -530,7 +530,7 @@ export default {
getControllerList: async function () {
const update = async () => {
this.controllerList.push({
id: 'tommy_test',
id: 'BPS-HUB-02-072',
mac: '',
status: 'loading',
isScan: true,
+1 -1
View File
@@ -23,7 +23,7 @@ export default {
getControllerList: async function () {
const update = async () => {
this.controllerList.push({
id: 'tommy_test',
id: 'BPS-HUB-02-072',
mac: '',
status: 'loading',
isScan: true,
+2 -2
View File
@@ -175,7 +175,7 @@
<template slot="actions" slot-scope="props" >
<va-popover :message="`sdcard ${props.rowData.name}`" placement="top">
<sd-card-button
v-if="props.rowData.type !== 'folder' && props.rowData.device.library_name.indexOf('Neulive') >= 0 && SDuuidList.includes(props.rowData.uuid)"
v-if="(props.rowData.type !== 'folder') && (props.rowData.device.library_name.indexOf('Neulive') >= 0) && (props.rowData.sd_data_record === true)"
:meta="props.rowData"
:uuidList="SDuuidList"
:controller="controllerList[0]"
@@ -718,7 +718,7 @@ export default {
async mounted () {
const controllerList = await api.controller.getAll()
this.controllerList = controllerList.data
this.getSDuuidList()
// this.getSDuuidList()
},
destroyed () {
},
+17 -2
View File
@@ -42,6 +42,7 @@
<script>
import SdCardApiAction from './SdCardApiAction.vue'
import progressModal from '@/components/common/progressBarModal/progressModal.vue'
import { apiManager } from './apiManager'
export default {
name: 'SdCardButton',
@@ -97,7 +98,6 @@ export default {
}
},
async moveToDB () {
this.$refs.progressModalRef.show()
await this.executeUpload()
this.$emit('refreshPage')
},
@@ -105,7 +105,12 @@ export default {
// return await this.$refs.sd_card_api.checkInSD(this.meta)
// },
async executeUpload () {
await this.$refs.sd_card_api.moveToDB(this.meta, this.controller)
this.$refs.progressModalRef.show()
await this.$refs.sd_card_api.moveToDB(this.meta, this.controller).catch(_ => {
this.$refs.progressModalRef.hide()
apiManager.endProgressBar()
this.pageToast('Upload SD card data error, please connect Neullive to Hub by usb or data corrupted.')
})
this.$refs.progressModalRef.progressDone()
// remove delete sd card first, still have problem.
// await this.$refs.sd_card_api.deleteSDCard(this.meta, this.controller)
@@ -113,6 +118,16 @@ export default {
executeDownload () {
this.$emit('downloadSdCard', this.meta)
},
pageToast: function (mes) {
this.showToast(
mes,
{
icon: 'fa-bell',
position: 'bottom-right',
duration: 7000,
},
)
},
},
async mounted () {
this.init()
+35 -50
View File
@@ -100,7 +100,8 @@ import { chartData } from '../../../data/task/ChartsManagement'
import { taskInfo } from '../../../data/task/TaskInfo'
import CanvasChart from './chart/CanvasChart'
import TaskDevices from './controller/TaskDevices'
import api from '@/data/api'
// import api from '@/data/api'
import { mapFields } from 'vuex-map-fields'
// import TaskFormula from './formula/TaskFormula'
// TODO change chart data tag format
@@ -112,9 +113,11 @@ export default {
TaskDevices,
// TaskFormula,
},
// async created () {
// await taskInfo.updateTaskInfo(this.$route.params.taskID)
// },
computed: {
...mapFields('taskContent', [
'deviceList',
]),
},
data () {
return {
// modal
@@ -130,21 +133,19 @@ export default {
selectChartID: null,
showDeviceSetting: true,
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
getParmDone: false,
deviceList: {},
}
},
mqtt: {
async '+/get_device_info_all/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
this.refreshDevicesWindow()
},
async '+/get_device_info/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
this.refreshDevicesWindow()
this.getParmDone = true
this.checkStiStatus()
},
async '+/device_parameter/+' (data, topic) {
await taskInfo.deviceParameter(String.fromCharCode.apply(null, data))
@@ -155,7 +156,7 @@ export default {
this.refreshDevicesWindow()
},
async '+/hardware_device/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
// console.log(this.deviceList)
// for (const d1 in taskInfo.getTaskInfo().deviceList) {
// if (taskInfo.getTaskInfo().deviceList[d1].info.device_address.length > 0) {
@@ -164,7 +165,7 @@ export default {
// for (const d2 in this.deviceList) {
// const addr2 = this.deviceList[d2].info.device_address.join()
// if (addr1 === addr2) {
// console.log(this.deviceList[d2].parameterSet)
// // console.log(this.deviceList[d2].parameterSet)
// for (const p in this.deviceList[d2].parameterSet) {
// if (p !== 'STIMULATING') {
// if (parameter == null) {
@@ -186,7 +187,7 @@ export default {
// }
// }
// }
// console.log('****', parameter, content)
// // console.log('****', parameter, content)
// // this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
// // header: 'device_parameter/0',
// // device: parseInt(d1),
@@ -205,19 +206,19 @@ export default {
async '+/data_server/device_data_stream/+/+' (data, topic) {
const topicSplit = topic.split('/')
if (this.getParmDone & !taskInfo.getDeviceInfoByRawID(parseInt(topicSplit[3])).info.isSync) {
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
taskInfo.deviceStart(parseInt(topicSplit[3]))
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
taskInfo.deviceStart(parseInt(topicSplit[3]), this.deviceList)
}
}
dataStreamBuffer.into(String.fromCharCode.apply(null, data), parseInt(topicSplit[3]), (parseInt(topicSplit[4]) + 1))
},
'+/device_save_path/+' (data, topic) {
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
console.log(taskInfo.getTaskInfo())
// console.log(taskInfo.getTaskInfo())
},
'+/device_save_path_set/+' (data, topic) {
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
console.log(taskInfo.getTaskInfo())
// console.log(taskInfo.getTaskInfo())
},
async '+/device_sd_card_status/+' (data, topic) {
const dataDecode = JSON.parse(String.fromCharCode.apply(null, data))
@@ -257,14 +258,14 @@ export default {
taskInfo.deviceConnected(mes[1])
break
case 'shutdown':
taskInfo.controllerShutdown()
taskInfo.controllerShutdown(this.deviceList)
this.showShutdownModal = true
break
case 'start':
if (!taskInfo.getDeviceInfoByRawID(parseInt(parseInt(mes[1]))).info.isSync) {
taskInfo.deviceStart(parseInt(mes[1]))
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
taskInfo.deviceStart(parseInt(parseInt(mes[1])))
taskInfo.deviceStart(parseInt(mes[1]), this.deviceList)
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
taskInfo.deviceStart(parseInt(parseInt(mes[1])), this.deviceList)
}
}
break
@@ -272,7 +273,7 @@ export default {
if (mes[1] === 'all') {
return false
}
taskInfo.deviceStop(parseInt(mes[1]))
taskInfo.deviceStop(parseInt(mes[1]), this.deviceList)
break
case 'device_timeout':
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] is timeout, please check its status or parameters.')
@@ -288,7 +289,7 @@ export default {
default:
break
}
console.log(String.fromCharCode.apply(null, data), topic)
// console.log(String.fromCharCode.apply(null, data), topic)
},
},
methods: {
@@ -522,7 +523,7 @@ export default {
this.pageToast('The formula [' + formulaID + '] has been removed.')
},
startAllClick: async function () {
for (const device of taskInfo.getDeviceListRegister()) {
for (const device of this.deviceList) {
if (this.$refs.devices_ref === undefined) {
this.startDevice(device)
} else {
@@ -533,7 +534,7 @@ export default {
this.pageToast('The all devices have been started')
},
startDevice: async function (device) {
chartData.defaultChartGenerator(device.id, null, 'device')
chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -542,7 +543,7 @@ export default {
instruction: 'record',
}))
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
console.log('elite')
// console.log('elite')
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
@@ -553,11 +554,11 @@ export default {
device.isSync = true
// this.$emit('refreshSetting')
// ### show device info
console.log(taskInfo.getDeviceInfo(device.id))
// console.log(taskInfo.getDeviceInfo(device.id))
}
},
stopAllClick: function () {
for (const device of taskInfo.getDeviceListRegister()) {
for (const device of this.deviceList) {
if (this.$refs.devices_ref === undefined) {
this.stopDevice(device)
} else {
@@ -585,6 +586,9 @@ export default {
device.stopping = true
}
},
checkStiStatus: function () {
this.$refs.devices_ref.checkStiStatus()
},
exit: function () {
this.$router.push({
path: '/',
@@ -594,35 +598,16 @@ export default {
watch: {
},
async mounted () {
this.deviceList = await taskInfo.updateTaskInfo(this.$route.params.taskID)
console.log(taskInfo.getTaskInfo())
await taskInfo.updateTaskInfo(this.$route.params.taskID)
// console.log(taskInfo.getTaskInfo())
// this.screenHeight = document.documentElement.clientHeight
this.pageMqttSub(taskInfo.getTaskInfo().controllerID)
console.log(taskInfo.getTaskInfo().controllerID)
// console.log(taskInfo.getTaskInfo().controllerID)
await this.pageInit()
// this.chartNumber = taskInfo.getTaskInfo().chartNumber
this.dataRefreshTimer = setInterval(this.refreshData, 100)
const ret = await api.analysis.IIRFilter({
type: 'lowpass',
order: 15,
fs: 1000,
f0: 10,
f1: 20,
f2: 50,
})
console.log(ret.data)
const sos = ret.data.split('/')
sos.forEach((v, vi) => {
sos[vi] = v.split(',')
sos[vi].forEach((s, si) => {
sos[vi][si] = parseFloat(s)
})
})
console.log(sos)
// const _this = this
// window.onresize = function () { // define the event of window size changing
// // _this.screenWidth = document.documentElement.clientWidth
@@ -630,7 +615,7 @@ export default {
// }
},
destroyed () {
taskInfo.destroyed()
taskInfo.destroyed(this.deviceList)
for (const chart in chartData.getAllChartsData()) {
this.removeChart(chart)
}
+27 -73
View File
@@ -40,10 +40,6 @@
<va-card
stripe="primary"
>
<template slot="header">
<va-icon name="fa fa-gears mr-3" color="primary"/>
<h5 class="mt-0 mb-0">CONTROL</h5>
</template>
<va-button class="no-dark-style-va-button" v-if="!showDeviceSetting" color="primary" target="_blank" @click="showDeviceSettingClick()" small>
SHOW DEVICES
</va-button>
@@ -121,6 +117,7 @@ export default {
// },
computed: {
...mapFields('taskContent', [
'deviceList',
'showTaskModal',
'taskModalText',
]),
@@ -140,21 +137,19 @@ export default {
selectChartID: null,
showDeviceSetting: true,
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
getParmDone: false,
deviceList: {},
}
},
mqtt: {
async '+/get_device_info_all/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
this.refreshDevicesWindow()
},
async '+/get_device_info/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
this.refreshDevicesWindow()
this.getParmDone = true
this.checkStiStatus()
},
async '+/device_parameter/+' (data, topic) {
await taskInfo.deviceParameter(String.fromCharCode.apply(null, data))
@@ -165,48 +160,7 @@ export default {
this.refreshDevicesWindow()
},
async '+/hardware_device/+' (data, topic) {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data))
// console.log(this.deviceList)
// for (const d1 in taskInfo.getTaskInfo().deviceList) {
// if (taskInfo.getTaskInfo().deviceList[d1].info.device_address.length > 0) {
// const addr1 = taskInfo.getTaskInfo().deviceList[d1].info.device_address.join()
// let parameter, content
// for (const d2 in this.deviceList) {
// const addr2 = this.deviceList[d2].info.device_address.join()
// if (addr1 === addr2) {
// console.log(this.deviceList[d2].parameterSet)
// for (const p in this.deviceList[d2].parameterSet) {
// if (p !== 'STIMULATING') {
// if (parameter == null) {
// parameter = p
// } else {
// parameter = parameter + '|' + p
// }
// let c
// if (Array.isArray(this.deviceList[d2].parameterSet[p])) {
// c = '0:' + this.deviceList[d2].parameterSet[p].length + '=' + this.deviceList[d2].parameterSet[p]
// } else {
// c = this.deviceList[d2].parameterSet[p]
// }
// if (content == null) {
// content = c
// } else {
// content = content + '|' + c
// }
// }
// }
// console.log('****', parameter, content)
// // this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
// // header: 'device_parameter/0',
// // device: parseInt(d1),
// // parameter: parameter,
// // content: content,
// // }))
// }
// }
// }
// }
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
if (this.$refs.devices_ref != null) {
await this.$refs.devices_ref.loadingDone()
}
@@ -215,19 +169,19 @@ export default {
async '+/data_server/device_data_stream/+/+' (data, topic) {
const topicSplit = topic.split('/')
if (this.getParmDone & !taskInfo.getDeviceInfoByRawID(parseInt(topicSplit[3])).info.isSync) {
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
taskInfo.deviceStart(parseInt(topicSplit[3]))
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(topicSplit[3])), null, 'device')) {
taskInfo.deviceStart(parseInt(topicSplit[3]), this.deviceList)
}
}
dataStreamBuffer.into(String.fromCharCode.apply(null, data), parseInt(topicSplit[3]), (parseInt(topicSplit[4]) + 1))
},
'+/device_save_path/+' (data, topic) {
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
console.log(taskInfo.getTaskInfo())
// console.log(taskInfo.getTaskInfo())
},
'+/device_save_path_set/+' (data, topic) {
taskInfo.deviceSavePath(String.fromCharCode.apply(null, data))
console.log(taskInfo.getTaskInfo())
// console.log(taskInfo.getTaskInfo())
},
async '+/broadcast' (data, topic) {
const mes = String.fromCharCode.apply(null, data).split(':')
@@ -257,14 +211,14 @@ export default {
taskInfo.deviceConnected(mes[1])
break
case 'shutdown':
taskInfo.controllerShutdown()
taskInfo.controllerShutdown(this.deviceList)
this.showShutdownModal = true
break
case 'start':
if (!taskInfo.getDeviceInfoByRawID(parseInt(parseInt(mes[1]))).info.isSync) {
taskInfo.deviceStart(parseInt(mes[1]))
if (chartData.defaultChartGenerator(taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
taskInfo.deviceStart(parseInt(parseInt(mes[1])))
taskInfo.deviceStart(parseInt(mes[1]), this.deviceList)
if (chartData.defaultChartGenerator(this.deviceList, taskInfo.getDeviceIDByRaw(parseInt(parseInt(mes[1]))), null, 'device')) {
taskInfo.deviceStart(parseInt(parseInt(mes[1])), this.deviceList)
}
}
break
@@ -272,7 +226,7 @@ export default {
if (mes[1] === 'all') {
return false
}
taskInfo.deviceStop(parseInt(mes[1]))
taskInfo.deviceStop(parseInt(mes[1]), this.deviceList)
break
case 'device_timeout':
this.pageToast('The device [' + taskInfo.getDeviceIDByRaw(parseInt(mes[1])) + '] is timeout, please check its status or parameters.')
@@ -288,7 +242,7 @@ export default {
default:
break
}
console.log(String.fromCharCode.apply(null, data), topic)
// console.log(String.fromCharCode.apply(null, data), topic)
},
},
methods: {
@@ -359,9 +313,9 @@ export default {
if (this.$refs.devices_ref != null) {
this.$refs.devices_ref.refresh()
}
// api.task.update({
// device_config: taskInfo.getTaskInfo().deviceList,
// })
},
checkStiStatus: function () {
this.$refs.devices_ref.checkStiStatus()
},
addChart: async function () {
const defaultID = {}
@@ -520,7 +474,7 @@ export default {
this.pageToast('The formula [' + formulaID + '] has been removed.')
},
startAllClick: async function () {
for (const device of taskInfo.getDeviceListRegister()) {
for (const device of this.deviceList) {
if (this.$refs.devices_ref === undefined) {
this.startDevice(device)
} else {
@@ -531,7 +485,7 @@ export default {
this.pageToast('The all devices have been started')
},
startDevice: async function (device) {
chartData.defaultChartGenerator(device.id, null, 'device')
chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -540,7 +494,7 @@ export default {
instruction: 'record',
}))
} else if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Elite')) {
console.log('elite')
// console.log('elite')
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
@@ -551,11 +505,11 @@ export default {
device.isSync = true
// this.$emit('refreshSetting')
// ### show device info
console.log(taskInfo.getDeviceInfo(device.id))
// console.log(taskInfo.getDeviceInfo(device.id))
}
},
stopAllClick: function () {
for (const device of taskInfo.getDeviceListRegister()) {
for (const device of this.deviceList) {
if (this.$refs.devices_ref === undefined) {
this.stopDevice(device)
} else {
@@ -592,11 +546,11 @@ export default {
watch: {
},
async mounted () {
this.deviceList = await taskInfo.updateTaskInfo(this.$route.params.taskID)
console.log(taskInfo.getTaskInfo())
await taskInfo.updateTaskInfo(this.$route.params.taskID)
// console.log(taskInfo.getTaskInfo())
// this.screenHeight = document.documentElement.clientHeight
this.pageMqttSub(taskInfo.getTaskInfo().controllerID)
console.log(taskInfo.getTaskInfo().controllerID)
// console.log(taskInfo.getTaskInfo().controllerID)
await this.pageInit()
// this.chartNumber = taskInfo.getTaskInfo().chartNumber
@@ -609,7 +563,7 @@ export default {
// }
},
destroyed () {
taskInfo.destroyed()
taskInfo.destroyed(this.deviceList)
for (const chart in chartData.getAllChartsData()) {
this.removeChart(chart)
}
@@ -13,7 +13,6 @@
color="white"
/>
</va-button>
<!-- <canvas-chart-filter /> -->
</div>
</div>
</template>
@@ -34,17 +33,16 @@
<canvas-chart-source :chartID="chartID" :gridInfo="data.grid"></canvas-chart-source>
</div>
<div v-else :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
<canvas-chart-setting :chartID="chartID"></canvas-chart-setting>
<!-- <canvas-chart-setting :chartID="chartID"></canvas-chart-setting> -->
</div>
<div class="row flex align--center ma-0 pa-0">
<canvas-chart-filter />
<div class="row flex align--left ma-0 pa-0">
<va-input
v-if="data.chartXMode === 'time'"
class="mx-1"
@keyup.enter="timeIntervalChange(timeIntervalInput)"
@blur="timeIntervalChange(timeIntervalInput)"
v-model="timeIntervalInput"
:label="'time-interval'"
:label="'time-grid'"
>
<p slot="append" style="margin-right: 0;" small>
ms
@@ -79,13 +77,18 @@
@keyup.enter="threeAxisIntervalChange(threeAxisIntervalInput)"
@blur="threeAxisIntervalChange(threeAxisIntervalInput)"
v-model="threeAxisIntervalInput"
:label="'3axis-interval'"
:label="'3axis-grid'"
>
<p slot="append" style="margin-right: 0;" small>
g
</p>
</va-input>
</div>
<div class="row flex ma-0 pa-0">
<canvas-chart-filter :chartID="chartID" :filterIndex="0" />
<canvas-chart-filter :chartID="chartID" :filterIndex="1" />
<canvas-chart-filter :chartID="chartID" :filterIndex="2" />
</div>
</va-card>
</div>
</template>
@@ -93,7 +96,7 @@
<script>
// import { InitChartsData, getChartsData } from '../../../../../data/task/ChartsManagement'
import CanvasChartFilter from './CanvasChartFilter.vue'
import CanvasChartSetting from './CanvasChartSetting'
// import CanvasChartSetting from './CanvasChartSetting'
import CanvasChartSource from './CanvasChartSource'
import { taskInfo } from '../../../../data/task/TaskInfo'
import { chartData } from '../../../../data/task/ChartsManagement'
@@ -101,7 +104,7 @@ import { chartData } from '../../../../data/task/ChartsManagement'
export default {
name: 'CanvasChart',
components: {
CanvasChartSetting,
// CanvasChartSetting,
CanvasChartSource,
CanvasChartFilter,
},
@@ -187,7 +190,7 @@ export default {
if (parseInt(y.channel) <= 255) {
if (chartData.getAllChartsData()[this.chartID].chartYUnit === 'uV') {
y.interval = parseInt(val)
console.log(y.interval)
// console.log(y.interval)
} else {
y.interval = val * 1000
}
@@ -1,85 +1,207 @@
<template>
<div class="row flex pa-0 ma-0">
<div class="sm3 xl3 md3 xs3 my-0 pa-0 mx-1">
<div class="filter-input my-0 pa-0 mx-1">
<va-select
small
:label="'FILTER'"
noClear
:label="'FILTER ' + (filterIndex + 1)"
v-model="selectFilter"
textBy="name"
:options="optionFilter"
/>
</div>
<va-input
v-if="[1, 2].indexOf(selectFilter.id) >= 0"
:label="'order'"
class="mx-1 order-input"
v-model="order"
/>
<va-input
v-if="[1, 2, 3].indexOf(selectFilter.id) >= 0"
:label="'FREQ'"
class="mx-1"
v-modal="input1"
/>
class="mx-1 freq-input"
v-model="freq2"
>
<p slot="append" style="margin-right: 0;" small>
Hz
</p>
</va-input>
<va-input
v-if="selectFilter.id > 2"
v-if="selectFilter.id > 3"
:label="'FREQ MIN'"
class="mx-1"
v-modal="input1"
/>
class="mx-1 freq-input"
v-model="freq0"
>
<p slot="append" style="margin-right: 0;" small>
Hz
</p>
</va-input>
<va-input
v-if="selectFilter.id > 2"
v-if="selectFilter.id > 3"
:label="'FREQ MAX'"
class="mx-1"
v-modal="input1"
/>
class="mx-1 freq-input"
v-model="freq1"
>
<p slot="append" style="margin-right: 0;" small>
Hz
</p>
</va-input>
<va-button
flat
small
:color="buttonColor"
class="circle-button pa-0 mx-0 filter-apply-button"
:icon="buttonIcon"
@click.stop="updateFilterInfo(filterIndex)"/>
</div>
</template>
<script>
import { chartData } from '../../../../data/task/ChartsManagement'
import { chartData } from '@/data/task/ChartsManagement'
import { taskInfo } from '@/data/task/TaskInfo'
import api from '@/data/api'
import { mapFields } from 'vuex-map-fields'
import { IIRFilter } from '@/data/task/filter/IIRFilter.js'
export default {
name: 'canvas-chart-setting',
name: 'canvas-chart-filter',
props: {
chartID: {
type: Number,
required: true,
},
filterIndex: {
type: Number,
required: true,
},
},
computed: {
...mapFields('taskContent', [
'filter',
]),
buttonIcon () {
if (this.data.series[0] != null) {
return this.data.series[0].filter[this.filterIndex].filter != null ? 'fa fa-stop' : 'fa fa-play'
}
return 'fa fa-play'
},
buttonColor () {
if (this.data.series[0] != null) {
return this.data.series[0].filter[this.filterIndex].filter != null ? 'danger' : 'primary'
}
return 'fa fa-play'
},
},
data () {
return {
data: chartData.getAllChartsData()[this.chartID],
selectFilter: {
id: 0,
name: 'none',
id: 1,
name: 'notch',
},
input1: '',
order: 20,
freq0: 0,
freq1: 0,
freq2: 0,
optionFilter: [
{
id: 0,
name: 'none',
},
{
id: 1,
name: 'lowpass',
name: 'notch',
},
{
id: 2,
name: 'highpass',
name: 'lowpass',
},
{
id: 3,
name: 'bandstop',
name: 'highpass',
},
{
id: 4,
name: 'bandstop',
},
{
id: 5,
name: 'bandpass',
},
],
}
},
methods: {
async updateFilterInfo (index) {
let closeFilter = false
for (let i = 0; i < this.data.series.length; i++) {
if (this.data.series[i].filter[this.filterIndex].filter != null) {
this.data.series[i].filter[this.filterIndex].filter = null
closeFilter = true
}
}
if (closeFilter) {
return false
}
let fs = 0
let sos = []
for (let i = 0; i < this.data.series.length; i++) {
const deviceID = this.data.series[i].yAxisSource[0]
// const _fs = taskInfo.getDeviceInfo(deviceID).parameterSet.SAMPLE_RATE
const _fs = 1000
const _chNum = taskInfo.getDeviceInfo(deviceID).parameterSet.CH_NUMBER
if (fs !== _fs) {
fs = _fs
const ret = await api.analysis.IIRFilter({
type: this.selectFilter.name,
order: this.order,
fs: parseInt(_fs / _chNum),
f0: parseInt(this.freq0),
f1: parseInt(this.freq1),
f2: parseInt(this.freq2),
})
if (ret.status !== 200) {
return false
}
const _sosRet = ret.data.split('/')
const _sos = []
_sosRet.forEach((v, vi) => {
const _tmp = v.split(',')
const _arr = []
_tmp.forEach(s => {
_arr.push(parseFloat(s))
})
_sos.push(_arr)
})
sos = _sos
}
this.data.series[i].filter[index].type = this.selectFilter.name
this.data.series[i].filter[index].order = this.order
// sampling rate changed by channel number
this.data.series[i].filter[index].fs = parseInt(_fs / _chNum)
this.data.series[i].filter[index].f0 = parseInt(this.freq0)
this.data.series[i].filter[index].f1 = parseInt(this.freq1)
this.data.series[i].filter[index].f2 = parseInt(this.freq2)
this.data.series[i].filter[index].sos = sos
this.data.series[i].filter[index].filter = IIRFilter.init(sos)
}
// console.log(this.data)
},
},
}
</script>
<style lang='scss'>
.filter-input {
max-width: 100px;
}
.freq-input {
max-width: 80px;
}
.order-input {
max-width: 50px;
}
.filter-apply-button {
max-width: 25px;
}
</style>
@@ -205,7 +205,7 @@ export default {
this.channelSelectDisableY = true
} else if (taskInfo.getDeviceInfo(this.deviceSelectY.id).info.library_name.indexOf('Neulive') >= 0) {
const channelSet = taskInfo.getDeviceInfo(this.deviceSelectY.id).parameterSet.RECORDING_CH.toString(2).split('').reverse()
console.log(channelSet)
// console.log(channelSet)
channelSet.forEach((element, index) => {
if (parseInt(element) > 0) {
channelOptions.push({
@@ -249,7 +249,7 @@ export default {
} else {
channelSet = taskInfo.getDeviceInfo(this.deviceSelectY.id).parameterSet.CHANNEL_LABEL
}
console.log(channelSet)
// console.log(channelSet)
channelSet.forEach((element, index) => {
channelOptions.push({
id: index + 1,
@@ -321,8 +321,8 @@ export default {
deviceNameY = 'Time'
}
chartData.register(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
console.log(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
console.log(this.deviceSelectX, this.channelSelectX, this.deviceSelectY, this.channelSelectY)
// console.log(this.chartID, gridIndex, deviceNameX, deviceIDX, channelX, deviceNameY, deviceIDY, channelY, null)
// console.log(this.deviceSelectX, this.channelSelectX, this.deviceSelectY, this.channelSelectY)
if (deviceNameX !== 'Time') {
this.sourceList.push([this.deviceSelectX.name, deviceIDX, channelX].toString())
}
@@ -343,7 +343,7 @@ export default {
value: String(i),
})
}
console.log(chartData.getAllChartsData()[this.chartID])
// console.log(chartData.getAllChartsData()[this.chartID])
},
checkSourceAddStatus () {
if (this.sourceList.indexOf([this.deviceSelectX.name, this.deviceSelectX.id, this.channelSelectX.id].toString()) >= 0) {
@@ -1,6 +1,6 @@
<template>
<div class="flex" :class="cardclass">
<va-card style="height: 88vh; overflow: auto;">
<va-card>
<template slot="header">
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
<h5 class="mt-0 mb-0">DEVICES</h5>
@@ -15,18 +15,6 @@
</div>
<div v-else class="flex row align--center">
<!-- <task-device-list-g-m
:ref="'pdlist_ref'"
:deviceList="deviceList"
@start="startDevice($event)"
@stop="stopDevice($event)"
@record="record($event)"
@stopRecord="stopRecord($event)"
@sti="sti($event)" @sti_stop="stiStop($event)"
@fast_settle="fastSettle($event)"
@generate="generateChart($event)"
@detect="detectDevice($event)"
/> -->
<task-device-list
:ref="'pdlist_ref'"
:deviceList="deviceList"
@@ -71,6 +59,7 @@ import { taskInfo } from '../../../../data/task/TaskInfo'
import { chartData } from '../../../../data/task/ChartsManagement'
import { dataStreamBuffer } from '../../../../data/task/DataStreamBuffer'
import api from '@/data/api'
import { mapFields } from 'vuex-map-fields'
export default {
name: 'TaskDevices',
@@ -87,16 +76,22 @@ export default {
},
},
},
computed: {
...mapFields('taskContent', [
'deviceList',
]),
},
created () {
},
data () {
return {
deviceSelect: '',
deviceOptions: taskInfo.getDeviceListNotRegister(),
deviceList: taskInfo.getDeviceListRegister(),
// deviceList: this.deviceList,
state: {
LOADING: false,
},
stiTimeOut: null,
}
},
mqtt: {
@@ -121,7 +116,7 @@ export default {
// }
// }
// }
console.log(this.deviceOptions)
// // console.log(this.deviceOptions)
for (let i = 0; i <= 11; i++) {
if (taskInfo.getDeviceInfoByRawID(i).info.status === 'connected') {
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
@@ -142,7 +137,7 @@ export default {
name: 'Time',
})
taskInfo.getDeviceList().push(...this.deviceList)
console.log(taskInfo.getDeviceList())
// // console.log(taskInfo.getDeviceList())
// for (let i = this.deviceOptions.length - 1; i >= 0; i--) {
// this.deviceSelect = this.deviceOptions[i]
// await this.addDevice(this.deviceOptions[i].id)
@@ -152,7 +147,7 @@ export default {
// }
},
startDevice: async function (device) {
await chartData.defaultChartGenerator(device.id, null, 'device')
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
if (taskInfo.getDeviceInfo(device.id).info.library_name.startsWith('Neulive')) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -188,7 +183,7 @@ export default {
api.task.update({
device_config: taskInfo.getTaskInfo().deviceList,
})
console.log(taskInfo.getDeviceInfo(device.id))
// // console.log(taskInfo.getDeviceInfo(device.id))
}
},
stopDevice: async function (device) {
@@ -238,7 +233,7 @@ export default {
}, 5000)
},
record: async function (device) {
await chartData.defaultChartGenerator(device.id, null, 'device')
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
@@ -253,7 +248,7 @@ export default {
})
// ### show device info
console.log(taskInfo.getDeviceInfo(device.id))
// // console.log(taskInfo.getDeviceInfo(device.id))
}
},
stopRecord: function (device) {
@@ -286,6 +281,11 @@ export default {
device_config: taskInfo.getTaskInfo().deviceList,
})
device.isStimulate = true
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
clearTimeout(this.stiTimeOut)
this.stiTimeOut = setTimeout(() => {
this.stiStop(device)
}, (stiExTime + 3000))
},
stiStop: function (device) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -300,6 +300,7 @@ export default {
content: 0,
}))
device.isStimulate = false
clearTimeout(this.stiTimeOut)
},
fastSettle: function (device) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -337,12 +338,6 @@ export default {
type = 'Neulive'
}
const macAddress = taskInfo.getDeviceInfoByRawID(selectID).info.device_address.map(data =>
data.toString(16)
.padStart(2, '0')
.toUpperCase()).join(':')
const deviceInfo = await api.device.getByMac(macAddress)
const _device = {
id: taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID),
name: '[' + taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID) + '] ' + taskInfo.getDeviceInfoByRawID(selectID).info.device_name,
@@ -355,7 +350,8 @@ export default {
isSync: taskInfo.getDeviceInfoByRawID(selectID).info.isSync,
isStimulate: taskInfo.getDeviceInfoByRawID(selectID).info.isStimulate,
sdCardStatus: taskInfo.getDeviceInfoByRawID(selectID).info.sd_card_status,
transmission_type: (deviceInfo.data.length > 0) ? deviceInfo.data[0].transmission_type : 1,
transmission_type: taskInfo.getDeviceInfoByRawID(selectID).info.transmission_type,
stimulation_last_time: taskInfo.getDeviceInfoByRawID(selectID).info.stimulation_last_time,
// stopping: false,
}
this.deviceList.push(_device)
@@ -385,6 +381,21 @@ export default {
this.deviceList.length = 0
taskInfo.updateAllList()
},
checkStiStatus: function () {
this.deviceList.forEach(device => {
if (device.stimulation_last_time > 0) {
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
const now = parseInt(Date.now() / 1000)
let stiExTimeOut = (stiExTime / 1000) - (now - parseInt(parseFloat(device.stimulation_last_time)))
stiExTimeOut = stiExTimeOut > 0 ? stiExTimeOut : 0
console.log(stiExTime, now, parseInt(parseFloat(device.stimulation_last_time)), stiExTimeOut)
clearTimeout(this.stiTimeOut)
this.stiTimeOut = setTimeout(() => {
this.stiStop(device)
}, (stiExTimeOut * 1000) + 3000)
}
})
},
generateChart: function (device) {
this.$emit('add', device.id)
},
@@ -114,6 +114,7 @@ export default {
})
},
refresh: function () {
// console.log(this.deviceList)
this.$nextTick(() => {
if (this.$refs.elewindow_ref != null) {
this.$refs.elewindow_ref.refresh()
@@ -1,6 +1,6 @@
<template>
<div class="flex" :class="cardclass">
<va-card style="height: 88vh; overflow: auto;">
<va-card>
<template slot="header">
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
<h5 class="mt-0 mb-0">DEVICES</h5>
@@ -40,6 +40,7 @@ import { chartData } from '@/data/task/ChartsManagement'
import { dataStreamBuffer } from '@/data/task/DataStreamBuffer'
import api from '@/data/api'
import { mapActions } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/task/content/types'
export default {
@@ -63,12 +64,18 @@ export default {
return {
deviceSelect: '',
deviceOptions: taskInfo.getDeviceListNotRegister(),
deviceList: taskInfo.getDeviceListRegister(),
// deviceList: this.deviceList,
state: {
LOADING: false,
},
stiTimeOut: null,
}
},
computed: {
...mapFields('taskContent', [
'deviceList',
]),
},
mqtt: {
},
methods: {
@@ -83,15 +90,7 @@ export default {
},
loadingDone: async function () {
this.state.LOADING = false
// const ret = await api.task.getAll()
// if (ret.data.length > 0) {
// for (const device in ret.data[0].device_config) {
// if (ret.data[0].device_config[device].device_address) {
// }
// }
// }
console.log(this.deviceOptions)
// console.log(this.deviceOptions)
for (let i = 0; i <= 11; i++) {
if (taskInfo.getDeviceInfoByRawID(i).info.status === 'connected') {
const index = this.deviceList.findIndex(d => taskInfo.getRawDeviceID(d.id) === i)
@@ -156,13 +155,8 @@ export default {
}))
}
})
await chartData.defaultChartGenerator(device.id, null, 'device')
await chartData.defaultChartGenerator(this.deviceList, device.id, null, 'device')
if (!taskInfo.getDeviceInfo(device.id).info.isSync) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
instruction: 'record_para_set',
}))
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
@@ -176,7 +170,7 @@ export default {
})
// ### show device info
console.log(taskInfo.getDeviceInfo(device.id))
// console.log(taskInfo.getDeviceInfo(device.id))
}
},
stopRecord: async function (device) {
@@ -221,11 +215,6 @@ export default {
this.pageToast('[Stimulation] Please run recording first.')
return false
}
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
instruction: 'stimulate_para_set',
}))
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
@@ -243,6 +232,11 @@ export default {
device_config: taskInfo.getTaskInfo().deviceList,
})
device.isStimulate = true
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
clearTimeout(this.stiTimeOut)
this.stiTimeOut = setTimeout(() => {
this.stiStop(device)
}, (stiExTime + 3000))
this.pageToast('The device ' + device.name + ' start stimulate.')
},
stiStop: function (device) {
@@ -258,6 +252,7 @@ export default {
content: 0,
}))
device.isStimulate = false
clearTimeout(this.stiTimeOut)
},
fastSettle: function (device) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
@@ -266,37 +261,6 @@ export default {
instruction: 'FAST_SET',
}))
},
// addDevice: async function () {
// if (this.deviceSelect.id == null) {
// return false
// }
// await taskInfo.getTaskInfo().deviceAddrList.push(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address)
// await taskInfo.getTaskInfo().taskDeviceID.push(this.deviceSelect.id)
// const _address = this.GLOBAL.transMac(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address)
// const pic = taskInfo.getDevicePic(taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name)
// let type = ''
// if (taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name.indexOf('Elite') >= 0) {
// type = 'Elite'
// } else if (taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.library_name.indexOf('Neulive') >= 0) {
// type = 'Neulive'
// }
// const _device = {
// id: taskInfo.getTaskInfo().taskDeviceID.indexOf(this.deviceSelect.id),
// name: '[' + taskInfo.getTaskInfo().taskDeviceID.indexOf(this.deviceSelect.id) + '] ' + taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_name,
// addr: taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.device_address,
// address: _address,
// picture: pic,
// type: type,
// isSync: taskInfo.getDeviceInfoByRawID(this.deviceSelect.id).info.isSync,
// stopping: false,
// }
// this.deviceList.push(_device)
// this.deviceSelect = ''
// taskInfo.updateAllList()
// this.$emit('add', _device.id)
// },
addDevice: async function (selectID) {
if (selectID == null) {
return false
@@ -331,9 +295,12 @@ export default {
type: type,
isSync: taskInfo.getDeviceInfoByRawID(selectID).info.isSync,
isStimulate: taskInfo.getDeviceInfoByRawID(selectID).info.isStimulate,
stimulation_last_time: taskInfo.getDeviceInfoByRawID(selectID).info.stimulation_last_time,
sdCardStatus: taskInfo.getDeviceInfoByRawID(selectID).info.sd_card_status,
// stopping: false,
}
this.deviceList.push(_device)
// console.log('sss', this.deviceList)
this.deviceSelect = ''
taskInfo.updateAllList()
this.$emit('add', _device.id)
@@ -354,6 +321,21 @@ export default {
taskInfo.updateAllList()
this.$emit('remove', device.id)
},
checkStiStatus: function () {
this.deviceList.forEach(device => {
if (device.stimulation_last_time > 0) {
const stiExTime = taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_INTERVAL_littleEndian * taskInfo.getDeviceInfo(device.id).parameterSet.REPEAT_TIME_littleEndian
const now = parseInt(Date.now() / 1000)
let stiExTimeOut = (stiExTime / 1000) - (now - parseInt(parseFloat(device.stimulation_last_time)))
stiExTimeOut = stiExTimeOut > 0 ? stiExTimeOut : 0
console.log(stiExTime, now, parseInt(parseFloat(device.stimulation_last_time)), stiExTimeOut)
clearTimeout(this.stiTimeOut)
this.stiTimeOut = setTimeout(() => {
this.stiStop(device)
}, (stiExTimeOut * 1000) + 3000)
}
})
},
clearDevice: async function () {
taskInfo.getTaskInfo().deviceAddrList.length = 0
taskInfo.getTaskInfo().taskDeviceID.length = 0
@@ -388,7 +370,7 @@ export default {
...mapActions('taskContent', [types.gimer.checkDeviceStatus]),
},
async mounted () {
console.log('sss', taskInfo.getDeviceList(), this.deviceList)
// console.log('sss', taskInfo.getDeviceList(), this.deviceList)
// this.pageMqttSub()
// for (const device in this.deviceOptions) {
// this.deviceSelect = this.deviceOptions[device]
@@ -122,6 +122,7 @@ export default {
},
data () {
return {
deviceList: [],
showFormulaModal: false,
formulaSelect: '',
formulaOptions: [
@@ -176,7 +177,7 @@ export default {
switch (formula.type) {
case 'Sheet Resistance':
formula.dataNow = 0
chartData.defaultChartGenerator(formula.id, null, 'formula')
chartData.defaultChartGenerator(this.deviceList, formula.id, null, 'formula')
break
}
this.pageToast('The ' + formula.name + 'has been applied.')
@@ -489,7 +489,7 @@ export default {
if (this.workingModeSelect.id !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE) {
this.deviceParameterChange(['MODE', this.workingModeSelect.id])
console.log(this.workingModeSelect.id, this.workingModeSelect.description)
// console.log(this.workingModeSelect.id, this.workingModeSelect.description)
}
},
instruParameterChange: function (e) {
@@ -381,8 +381,8 @@ import OppLevelButton from '../parameter/item/OppLevelButton'
import MicroAmpereRange from '../parameter/item/MicroAmpereRange'
import ScanRateRange from '../parameter/item/ScanRateRange'
import ResolutionRange from '../parameter/item/ResolutionRange'
import EliteParameterRecordingElitePulseSensing from './EliteParameterRecordingElitePulseSensing'
import EliteParameterRecordingEliteDPV from './EliteParameterRecordingEliteDPV'
import EliteParameterRecordingElitePulseSensing from '../parameter/item/PulseSensing/EliteParameterRecordingElitePulseSensing'
import EliteParameterRecordingEliteDPV from '../parameter/item/DPV/EliteParameterRecordingEliteDPV'
export default {
name: 'EliteParameterRecordingElitezm15',
@@ -629,7 +629,7 @@ export default {
},
// Array[String of Parameter Nmae, Value]
deviceParameterChange: function (e) {
console.log('e[0],e[1]', e[0], ',', e[1])
// console.log('e[0],e[1]', e[0], ',', e[1])
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
@@ -777,7 +777,7 @@ export default {
if (this.workingModeSelect.id !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.MODE) {
this.deviceParameterChange(['MODE', this.workingModeSelect.id])
console.log(this.workingModeSelect.id, this.workingModeSelect.description)
// console.log(this.workingModeSelect.id, this.workingModeSelect.description)
}
},
measureEoc () {
@@ -243,9 +243,11 @@ export default {
refresh () {
this.channelList.length = 0
const channelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH.toString(2).split('').reverse()
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 1
channelSet.forEach((element, index) => {
if (parseInt(element) > 0) {
this.channelList.push(index + 1)
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
}
})
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
@@ -13,7 +13,7 @@
:key="channel"
>
<va-button
class="mx-1 px-1"
class="ma-1 pa-0 circle-button"
v-if="channelList != null && channelList.indexOf(channel) >= 0"
@click="channelClickRemove(channel)"
small
@@ -21,7 +21,7 @@
{{channel}}
</va-button>
<va-button
class="mx-1 px-1"
class="ma-1 pa-0 circle-button"
v-if="channelList == null || channelList.indexOf(channel) < 0"
@click="channelClickAdd(channel)"
small outline
@@ -46,7 +46,7 @@
:key="axisChannel"
>
<va-button
class="mx-1 px-1"
class="ma-1 pa-0 circle-button"
v-if="axisChannelList != null && axisChannelList.indexOf(axisChannel) >= 0"
@click="axisChannelClickRemove(axisChannel)"
small
@@ -54,7 +54,7 @@
{{axisChannel}}
</va-button>
<va-button
class="mx-1 px-1"
class="ma-1 pa-0 circle-button"
v-if="axisChannelList == null || axisChannelList.indexOf(axisChannel) < 0"
@click="axisChannelClickAdd(axisChannel)"
small outline
@@ -160,12 +160,12 @@ export default {
description: '100',
},
{
id: 1,
description: '400',
id: 2,
description: '300',
},
{
id: 2,
description: '800',
id: 1,
description: '500',
},
],
sampleRateSelect: null,
@@ -285,18 +285,25 @@ export default {
this.channelList.length = 0
// todo RECORDING_CH to RECORDING_CH_H & L
const channelSetLow = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH_L.toString(2).split('').reverse()
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER = 0
channelSetLow.forEach((element, index) => {
if (parseInt(element) > 0) {
this.channelList.push(index + 1)
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
}
})
const channelSetHight = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH_H.toString(2).split('').reverse()
channelSetHight.forEach((element, index) => {
if (parseInt(element) > 0) {
this.channelList.push(index + 17)
taskInfo.getDeviceInfo(this.deviceID).parameterSet.CH_NUMBER += 1
}
})
this.ampGainOptions.forEach(option => {
if (option.id === taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) {
this.ampGainSelect = option
}
})
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
this.axisChannelList.length = 0
@@ -587,3 +594,11 @@ export default {
},
}
</script>
<style lang="scss">
.circle-button {
height: 25px;
width: 25px;
border-radius: '50%';
}
</style>
@@ -51,11 +51,11 @@
<div class="flex sm12 xl12 md12 xs12">
<div
style='display: inline-block;'
v-for="channel in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]"
v-for="channel in [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]"
:key="channel"
>
<va-button
class="mx-1 px-2"
class="ma-1 pa-0 circle-button"
color="success"
v-if="posChannelList.indexOf(channel) >= 0 && negChannelList.indexOf(channel) < 0"
@click="channelClick(channel)"
@@ -64,7 +64,7 @@
{{channel}}
</va-button>
<va-button
class="mx-1 px-2"
class="ma-1 pa-0 circle-button"
color="danger"
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) >= 0"
@click="channelClick(channel)"
@@ -73,7 +73,7 @@
{{channel}}
</va-button>
<va-button
class="mx-1 px-2"
class="ma-1 pa-0 circle-button"
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) < 0"
@click="channelClick(channel)"
small outline
@@ -116,20 +116,65 @@
Rounds
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="cycleNumberChange(256)">
256
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="cycleNumberChange(255)">
255
</va-button>
</div>
<va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="cycleNumberChange(cycleNumber)"
@mouseleave.native="cycleNumberChange(cycleNumber)"
@touchend.native="cycleNumberChange(cycleNumber)"
value-visible
v-model="cycleNumber"
:min="1"
:max="256"
/>
</div>
</div>
</div>
<div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">REPEAT NUMBER</p>
<va-button flat color="gray" icon="fa fa-info-circle" style="margin: 0.001rem; padding: 0.001rem;" @click.stop="toggleModal('REPEAT')"/>
</div>
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="repeatNumberChange(1)">
1
</va-button>
<va-input
@keyup.enter="repeatNumberChange(repeatNumberInput)"
v-model="repeatNumberInput"
class="mb-0"
>
<p slot="append" style="margin-right: 0;" small>
Rounds
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="repeatNumberChange(255)">
255
</va-button>
</div>
</div>
</div>
</div>
<div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">REPEAT INTERVAL = Ti = (Ts + Tr)</p>
<va-button flat color="gray" icon="fa fa-info-circle" style="margin: 0.001rem; padding: 0.001rem;" @click.stop="toggleModal('REPEAT')"/>
</div>
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-input
@keyup.enter="repeatIntervalChange(repeatIntervalInput)"
v-model="repeatIntervalInput"
class="mb-0"
:key="repeatIntervalErrorMsg.key"
:error="repeatIntervalErrorMsg.showError"
:error-messages="repeatIntervalErrorMsg.errorMsg"
>
<p slot="append" style="margin-right: 0;" small>
s
</p>
</va-input>
</div>
</div>
</div>
</div>
@@ -158,7 +203,7 @@
4000
</va-button>
</div>
<va-slider
<!-- <va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@@ -167,7 +212,7 @@
v-model="amplitudeNumber.PHASE1"
:min="5"
:max="4000"
/>
/> -->
</div>
</div>
</div>
@@ -196,7 +241,7 @@
4000
</va-button>
</div>
<va-slider
<!-- <va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@@ -205,7 +250,7 @@
v-model="amplitudeNumber.PHASE2"
:min="5"
:max="4000"
/>
/> -->
</div>
</div>
</div>
@@ -398,6 +443,14 @@
>
<img src='@/assets/img/sti_user_guide.png' class="sti_guideline">
</va-modal>
<va-modal
v-model="showGuideLineModal.REPEAT"
position="right"
cancelText=""
>
<img src='@/assets/img/repeat.jpg' class="sti_guideline">
</va-modal>
</div>
</template>
@@ -420,7 +473,7 @@ export default {
},
data () {
return {
showGuideLineModal: { ELECTRODE: false, PATTERN: false },
showGuideLineModal: { ELECTRODE: false, PATTERN: false, REPEAT: false },
stimulationOn: false,
posChannelList: [2],
negChannelList: [1],
@@ -449,6 +502,11 @@ export default {
],
cycleNumberInput: '1',
cycleNumber: 1,
repeatIntervalErrorMsg: { id: 1, key: 0, showError: false, errorMsg: [''] },
repeatNumberInput: '1',
repeatNumber: 1,
repeatIntervalInput: '65.54', // s
repeatInterval: 65535, // ms
// cycleNumberArray: Array(9).fill(1),
amplitudeNumberInput: {
PHASE1: '50',
@@ -518,6 +576,19 @@ export default {
return true
}
},
},
mqtt: {
},
methods: {
toggleModal (which) {
if (which === 'ELECTRODE') {
this.showGuideLineModal.ELECTRODE = true
} else if (which === 'PATTERN') {
this.showGuideLineModal.PATTERN = true
} else if (which === 'REPEAT') {
this.showGuideLineModal.REPEAT = true
}
},
TRangeStatusCheck () {
let flag = true
for (let i = 0; i < this.TRangeErrorMsgList.length; i++) {
@@ -532,23 +603,35 @@ export default {
return false
}
},
},
mqtt: {
},
methods: {
toggleModal (which) {
if (which === 'ELECTRODE') {
this.showGuideLineModal.ELECTRODE = true
} else if (which === 'PATTERN') {
this.showGuideLineModal.PATTERN = true
repeatIntervalCheck () {
// * 1000 -> ms to us
if (this.repeatInterval * 1e3 > this.periodNumber * this.cycleNumber + taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T5_CH1) {
return true
}
return false
},
mqttPub: function (topic, mes) {
this.$mqtt.publish(topic, mes)
},
deviceInstruction: function (id, instr) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(id),
instruction: instr,
}))
},
deviceParameterChange: async function (id, name, content) {
taskInfo.getDeviceInfo(id).parameterSet[name] = content
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(id),
parameter: name,
content: content,
}))
},
refreshPattern () {
this.patternModeSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_PATTERN ? 1 : 0
if (this.TRangeStatusCheck === true) {
if (this.TRangeStatusCheck() === true) {
// if t1~t4 is not valid input, not need to refresh
this.t1Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T1_CH0
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
@@ -584,9 +667,9 @@ export default {
stiChannelSet.forEach((element, index) => {
if (parseInt(element) > 0) {
if (parseInt(stiPolaritySet[index]) > 0) {
this.posChannelList.push(index + 1)
this.posChannelList.push(index + 17)
} else {
this.negChannelList.push(index + 1)
this.negChannelList.push(index + 17)
}
}
})
@@ -594,6 +677,10 @@ export default {
this.cycleNumberSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.CONTINUOUS_STI ? 1 : 0
this.cycleNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_CH0 + 1)
this.cycleNumberInput = String(this.cycleNumber)
this.repeatNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_TIME_littleEndian)
this.repeatNumberInput = String(this.repeatNumber)
this.repeatInterval = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_INTERVAL_littleEndian) // unit: ms
this.repeatIntervalInput = String(this.repeatInterval / 1e3)
// this.cycleNumberArray = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_LIST
this.amplitudeNumber.PHASE1 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L1 * 5
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1)
@@ -606,6 +693,7 @@ export default {
for (let i = 0; i <= 3; i++) {
this.TRangeErrorMsgList[i].key++
}
this.repeatIntervalErrorMsg.key++
},
transUnit () {
if (this.unitSelect === 0) { // s
@@ -704,39 +792,57 @@ export default {
}
}
},
repeatNumberChange (val) {
if (isNaN(val) || parseInt(val) > 256 || parseInt(val) < 1) {
this.repeatNumberInput = '1'
this.repeatNumber = 1
} else {
this.repeatNumberInput = String(val)
this.repeatNumber = parseInt(val)
}
if (this.repeatNumber !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_TIME_littleEndian) {
this.deviceParameterChange(this.deviceID, 'REPEAT_TIME_littleEndian', String(this.repeatNumber))
}
},
repeatIntervalChange (val) {
this.repeatIntervalInput = String(parseFloat(val).toFixed(2))
this.repeatInterval = parseFloat(this.repeatIntervalInput) * 1e3
if (this.repeatInterval !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_INTERVAL_littleEndian) {
if (this.repeatIntervalCheck()) {
this.deviceParameterChange(this.deviceID, 'REPEAT_INTERVAL_littleEndian', this.repeatInterval)
this.resetRepeatIntervalErrorMsg()
} else {
this.updateRepeatIntervalErrorMsg({ status: true, msg: `Ti < ${this.periodNumberInput}${this.unitOptions[this.unitSelect].label} (period) * 1 (cycle)` })
}
}
this.updateStiParamCheck()
},
updateRepeatIntervalErrorMsg (payload) {
this.repeatIntervalErrorMsg.showError = payload.status
this.repeatIntervalErrorMsg.errorMsg[0] = payload.msg
},
resetRepeatIntervalErrorMsg () {
this.updateRepeatIntervalErrorMsg({ status: false, msg: '' })
},
amplitudeNumberChange (val, type) {
if (this.amplitudeNumber[type] == null) {
return false
}
if (typeof (val) === 'string') {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = '50'
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber)) {
this.amplitudeNumber[type] = parseInt(val)
}
} else {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = 50
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber[type]) || this.amplitudeNumber[type] !== val) {
this.amplitudeNumberInput[type] = String(val)
this.amplitudeNumber[type] = val
}
val = parseInt(parseInt(val) / 5) * 5
}
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = 50
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
this.amplitudeNumberInput[type] = String(val)
this.amplitudeNumber[type] = val
if (parseInt(this.amplitudeNumber[type] / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet['STI_AMPLITUDE_' + this.amplitudeName[type][1]])) {
const content2 = parseInt(this.amplitudeNumber[type] / 5)
const content1 = parseInt(this.amplitudeNumber[type] / 5 / 2)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`,
content: `${content1}|${content2}`,
}))
const content1 = parseInt(this.amplitudeNumber[type] / 5)
this.deviceParameterChange(this.deviceID, `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`, `${content1}|${content2}`)
}
},
@@ -900,12 +1006,7 @@ export default {
},
updateStiParamCheck () {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'sti_trange_set_done',
content: this.TRangeStatusCheck,
}))
this.deviceParameterChange(this.deviceID, 'sti_trange_set_done', this.TRangeStatusCheck() && this.repeatIntervalCheck())
},
autoResetAllTRange () {
if (this.patternModeSelect === 0) { // Monophasic
@@ -1032,7 +1133,7 @@ export default {
let stiChannelSet = ''
let stiPolaritySet = ''
for (let i = 16; i >= 1; i--) {
for (let i = 32; i >= 17; i--) {
if (this.posChannelList.indexOf(i) >= 0) {
stiChannelSet += '1'
stiPolaritySet += '1'
@@ -1148,4 +1249,10 @@ export default {
justify-content: center;
position: relative;
}
.circle-button {
height: 25px;
width: 25px;
border-radius: '50%';
}
</style>
@@ -140,7 +140,7 @@ export default {
mounted () {
this.pageInit()
this.device = taskInfo.getDeviceInfo(this.deviceID)
console.log(taskInfo.getDeviceInfo(this.deviceID).info)
// console.log(taskInfo.getDeviceInfo(this.deviceID).info)
},
watch: {
deviceID: function (val) {
@@ -1,14 +1,14 @@
<template>
<div>
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'E_initial'" @parameterChange="deviceParameterChange($event)" />
<e-1 :ref="'E1'" :deviceID="deviceID" :parameterName="'E1'" @parameterChange="deviceParameterChange($event)" />
<e-2 :ref="'E2'" :deviceID="deviceID" :parameterName="'E1'" @parameterChange="deviceParameterChange($event)" />
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'E_final'" @parameterChange="deviceParameterChange($event)" />
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'Pulse_Amp'" @parameterChange="deviceParameterChange($event)" />
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'Pulse_Width'" @parameterChange="deviceParameterChange($event)" />
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'Increment'" @parameterChange="deviceParameterChange($event)" />
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'Step_time'" @parameterChange="deviceParameterChange($event)" />
<current-recording-period :ref="'CURR_REC'" :deviceID="deviceID" :parameterName="'CURR_REC_'" @parameterChange="deviceParameterChange($event)" />
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'DPV_e_init'" @parameterChange="deviceParameterChange($event)" />
<e-1 :ref="'E1'" :deviceID="deviceID" :parameterName="'DPV_e_1'" @parameterChange="deviceParameterChange($event)" />
<e-2 :ref="'E2'" :deviceID="deviceID" :parameterName="'DPV_e_2'" @parameterChange="deviceParameterChange($event)" />
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'DPV_e_final'" @parameterChange="deviceParameterChange($event)" />
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'DPV_amp'" @parameterChange="deviceParameterChange($event)" />
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'DPV_pul_width'" @parameterChange="deviceParameterChange($event)" />
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'DPV_increment'" @parameterChange="deviceParameterChange($event)" />
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'DPV_step_time'" @parameterChange="deviceParameterChange($event)" />
<current-recording-period :ref="'CURR_REC'" :deviceID="deviceID" :parameterName="'DPV_curr_rec'" @parameterChange="deviceParameterChange($event)" />
</div>
</template>
@@ -26,7 +26,7 @@ import StepTime from './StepTime'
import CurrentRecordingPeriod from './CurrentRecordingPeriod'
export default {
name: 'SegmentBlock',
name: 'AdvancedBlock',
components: {
EInitial,
E1,
@@ -85,6 +85,9 @@ export default {
if (this.$refs.StepTime != null) {
this.$refs.StepTime.refresh()
}
if (this.$refs.CURR_REC != null) {
this.$refs.CURR_REC.refresh()
}
},
},
mounted () {
@@ -1,11 +1,12 @@
<template>
<div>
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'E_initial'" @parameterChange="deviceParameterChange($event)" />
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'E_final'" @parameterChange="deviceParameterChange($event)" />
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'Pulse_Amp'" @parameterChange="deviceParameterChange($event)" />
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'Pulse_Width'" @parameterChange="deviceParameterChange($event)" />
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'Increment'" @parameterChange="deviceParameterChange($event)" />
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'Step_time'" @parameterChange="deviceParameterChange($event)" />
<e-initial :ref="'EInitial'" :deviceID="deviceID" :parameterName="'DPV_e_init'" @parameterChange="deviceParameterChange($event)" />
<e-final :ref="'EFinal'" :deviceID="deviceID" :parameterName="'DPV_e_final'" @parameterChange="deviceParameterChange($event)" />
<pulse-amp :ref="'PulseAmp'" :deviceID="deviceID" :parameterName="'DPV_amp'" @parameterChange="deviceParameterChange($event)" />
<pulse-width :ref="'PulseWidth'" :deviceID="deviceID" :parameterName="'DPV_pul_width'" @parameterChange="deviceParameterChange($event)" />
<increment :ref="'Increment'" :deviceID="deviceID" :parameterName="'DPV_increment'" @parameterChange="deviceParameterChange($event)" />
<step-time :ref="'StepTime'" :deviceID="deviceID" :parameterName="'DPV_step_time'" @parameterChange="deviceParameterChange($event)" />
<sample-rate :ref="'SampleRate'" :deviceID="deviceID" :parameterName="'DPV_notify_rate'" @parameterChange="deviceParameterChange($event)" />
</div>
</template>
@@ -18,9 +19,10 @@ import PulseAmp from './PulseAmp'
import PulseWidth from './PulseWidth'
import Increment from './Increment'
import StepTime from './StepTime'
import SampleRate from './SampleRate'
export default {
name: 'SegmentBlock',
name: 'AutoBlock',
components: {
EInitial,
EFinal,
@@ -28,6 +30,7 @@ export default {
PulseWidth,
Increment,
StepTime,
SampleRate,
},
props: {
deviceID: {
@@ -76,6 +79,9 @@ export default {
if (this.$refs.StepTime != null) {
this.$refs.StepTime.refresh()
}
if (this.$refs.SampleRate != null) {
this.$refs.SampleRate.refresh()
}
},
},
mounted () {
@@ -5,11 +5,12 @@
<p class="display-6">Current Recording Period<p/>
</div>
<div class="flex sm3 xl3 md3 xs3 px-0 mx-0">
<p small> {{ itemInput }} ~ 100% </p>
<p small> 25% ~ 100% </p>
<!-- <va-input
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0"
>
@@ -25,10 +26,10 @@
@mouseleave.native="itemChange(itemInput)"
@touchend.native="itemChange(itemInput)"
pins
:min="0"
:max="90"
:min="25"
:max="100"
value-visible
:step="10"
:step="25"
v-model="itemInput"
/>
</div>
@@ -59,35 +60,41 @@ export default {
return {
disableSlider: false,
inputeKey: 0,
itemInput: Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]),
// duration: Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet['t_pulse_' + String(this.segmentID)]) / 10,
itemInput: parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]),
}
},
mqtt: {
},
methods: {
itemChange (val) {
if (parseInt(val) === 100) {
val = 99
}
this.itemInput = val
this.$emit('parameterChange', [this.parameterName, val])
},
checkSliderRange (duration) {
if (duration <= 10) {
this.disableSlider = true
} else {
this.disableSlider = false
const percent = parseFloat((5 / duration) * 100)
if (percent > 5) {
this.itemChange([this.itemInputMin, this.itemInputMax])
} else if (percent >= 1.1 && percent <= 5) {
this.itemChange([this.itemInputMin, this.itemInputMax])
} else if (percent < 1.1) {
this.itemChange([this.itemInputMin, this.itemInputMax])
}
}
},
// checkSliderRange (duration) {
// if (duration <= 10) {
// this.disableSlider = true
// } else {
// this.disableSlider = false
// const percent = parseFloat((5 / duration) * 100)
// if (percent > 5) {
// this.itemChange([this.itemInputMin, this.itemInputMax])
// } else if (percent >= 1.1 && percent <= 5) {
// this.itemChange([this.itemInputMin, this.itemInputMax])
// } else if (percent < 1.1) {
// this.itemChange([this.itemInputMin, this.itemInputMax])
// }
// }
// },
refresh () {
// this.itemInput
// this.duration = Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet['t_pulse_' + String(this.segmentID)]) / 10
const percentage = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])
if (percentage === 99) {
this.itemInput = 100
} else {
this.itemInput = percentage
}
},
},
async mounted () {
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -21,9 +21,9 @@
<script>
import { taskInfo } from '../../../../data/task/TaskInfo'
import AutoBlock from '../parameter/item/DPV/AutoBlock'
import AdvancedBlock from '../parameter/item/DPV/AdvancedBlock'
import { taskInfo } from '@/data/task/TaskInfo'
import AutoBlock from './AutoBlock'
import AdvancedBlock from './AdvancedBlock'
export default {
name: 'EliteParameterRecordingEliteDPV',
@@ -56,7 +56,7 @@ export default {
},
// Array[String of Parameter Nmae, Value]
deviceParameterChange: function (e) {
console.log('e[0],e[1]', e[0], ',', e[1])
// console.log('e[0],e[1]', e[0], ',', e[1])
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)),
itemInput: String(parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)),
unitSelect: 'mV',
unitClickTime: 0,
showError: false,
@@ -62,13 +63,14 @@ export default {
if (this.unitSelect === 'V') {
val = parseFloat(val) * 1000
}
if (parseInt(val) < -5000 || parseInt(val) > 5000) {
val = parseInt(val) // each step: 1mV
if (val < -5000 || val > 5000) {
this.showError = true
this.errorMsg[0] = '-5 ~ 5V'
return
}
if (parseFloat(val) !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseFloat(val) * 5 + 25000])
if (val !== parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)) {
this.$emit('parameterChange', [this.parameterName, val * 5 + 25000])
}
},
unitChange () {
@@ -82,7 +84,7 @@ export default {
}
},
refresh () {
let volt = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] - 25000) / 5)
let volt = parseInt((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName] - 25000) / 5)
if (this.unitSelect === 'V') {
volt /= 1000
}
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)),
itemInput: String(parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])),
unitSelect: 'msec',
unitClickTime: 0,
showError: false,
@@ -60,22 +61,17 @@ export default {
this.showError = false
this.errorMsg[0] = ''
if (this.unitSelect === 'sec') {
val = parseInt(val) * 1000
val = parseFloat(val) * 1000
}
val = parseInt(val) // each step: 1ms
// 5 ms a step
const remainder = parseInt(val) % 5
if (remainder !== 0) {
val = parseInt(val) + (5 - remainder)
}
if (parseInt(val) < 1 || parseInt(val) > 100000) {
if (val < 0 || val > 1e6) {
this.showError = true
this.errorMsg[0] = '1ms ~ 100s'
this.errorMsg[0] = '0 ~ 1000s'
return
}
if (parseFloat(val) !== Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] / 10)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseInt(val) * 10])
this.$emit('checkCurrentRecording', val)
if (val !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])) {
this.$emit('parameterChange', [this.parameterName, val])
}
},
unitChange () {
@@ -90,7 +86,7 @@ export default {
},
refresh () {
if (this.showError === false) {
let duration = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)
let duration = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])
if (this.unitSelect === 'sec') {
duration /= 1000
}
@@ -0,0 +1,105 @@
<template>
<div class="flex-container">
<p class="display-6 flex-child">Sample Rate<p/>
<va-input
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
:error-messages="errorMsg"
>
</va-input>
<va-button
v-model="unitSelect"
class="px-2 py-0 mr-0 flex-child2"
>
{{ unitSelect }}
</va-button>
</div>
</template>
<script>
import { taskInfo } from '@/data/task/TaskInfo'
export default {
name: 'StepTime',
components: {
},
props: {
deviceID: {
type: Number,
required: true,
},
parameterName: {
type: String,
required: true,
},
},
created () {
},
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) / 10)),
unitSelect: 'sps',
showError: false,
errorMsg: [''],
}
},
mqtt: {
},
methods: {
itemChange (val) {
this.itemInput = String(val)
this.inputeKey++
this.showError = false
this.errorMsg[0] = ''
val = parseFloat(val).toFixed(1) // 0.1sps
if (val < 0.1 || val > 100) {
this.showError = true
this.errorMsg[0] = '0.1 ~ 100sps'
return
}
if (val !== Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) / 10)) {
this.$emit('parameterChange', [this.parameterName, val * 10])
}
},
refresh () {
this.itemInput = String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName]) / 10))
},
},
async mounted () {
},
destroyed () {
},
watch: {
},
}
</script>
<style lang="scss">
.flex-container {
display: flex;
}
.flex-child {
flex: 2;
}
.flex-child1 {
flex: 1;
}
.flex-child2 {
flex: 0;
}
.flex-child:first-child {
margin-right: 1px;
}
</style>
@@ -5,6 +5,7 @@
@mouseleave.native="itemChange(itemInput)"
@keyup.enter="itemChange(itemInput)"
@blur="itemChange(itemInput)"
:key="inputeKey"
v-model="itemInput"
class="mb-0 flex-child1"
:error="showError"
@@ -44,7 +45,7 @@ export default {
data () {
return {
inputeKey: 0,
itemInput: String(Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)),
itemInput: String(parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])),
unitSelect: 'msec',
unitClickTime: 0,
showError: false,
@@ -60,22 +61,17 @@ export default {
this.showError = false
this.errorMsg[0] = ''
if (this.unitSelect === 'sec') {
val = parseInt(val) * 1000
val = parseFloat(val) * 1000
}
val = parseInt(val) // each step: 1ms
// 5 ms a step
const remainder = parseInt(val) % 5
if (remainder !== 0) {
val = parseInt(val) + (5 - remainder)
}
if (parseInt(val) < 1 || parseInt(val) > 100000) {
if (val < 0 || val > 1e6) {
this.showError = true
this.errorMsg[0] = '1ms ~ 100s'
this.errorMsg[0] = '0 ~ 1000s'
return
}
if (parseFloat(val) !== Math.round(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)] / 10)) {
this.$emit('parameterChange', [this.parameterName + String(this.segmentID), parseInt(val) * 10])
this.$emit('checkCurrentRecording', val)
if (val !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])) {
this.$emit('parameterChange', [this.parameterName, val])
}
},
unitChange () {
@@ -90,7 +86,7 @@ export default {
},
refresh () {
if (this.showError === false) {
let duration = Math.round((taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName + String(this.segmentID)]) / 10)
let duration = parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet[this.parameterName])
if (this.unitSelect === 'sec') {
duration /= 1000
}
@@ -27,11 +27,11 @@
<script>
import { taskInfo } from '../../../../data/task/TaskInfo'
import SegmentBlock from '../parameter/item/PulseSensing/SegmentBlock'
// import DataNumber from '../parameter/item/PulseSensing/DataNumber'
import DataOutput from '../parameter/item/PulseSensing/DataOutput'
import CycleNumber from '../parameter/item/PulseSensing/CycleNumber'
import { taskInfo } from '@/data/task/TaskInfo'
import SegmentBlock from './SegmentBlock'
// import DataNumber from './DataNumber'
import DataOutput from './DataOutput'
import CycleNumber from './CycleNumber'
import { SlickList, SlickItem } from 'vue-slicksort'
import _ from 'lodash'
@@ -71,7 +71,7 @@ export default {
},
// Array[String of Parameter Nmae, Value]
deviceParameterChange: function (e) {
console.log('e[0],e[1]', e[0], ',', e[1])
// console.log('e[0],e[1]', e[0], ',', e[1])
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
@@ -99,11 +99,19 @@
<script>
import { taskInfo } from '@/data/task/TaskInfo'
import { chartData } from '@/data/task/ChartsManagement'
import { mapActions } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/task/content/types'
export default {
name: 'NeuliveParameterRecording',
components: {
},
computed: {
...mapFields('taskContent', [
'deviceList',
]),
},
props: {
deviceID: {
type: Number,
@@ -119,10 +127,6 @@ export default {
channelList: [],
ampGainSelect: null,
ampGainOptions: [
// {
// id: 0,
// description: '25',
// },
{
id: 0,
description: '100',
@@ -249,8 +253,39 @@ export default {
mqttPub: function (topic, mes) {
this.$mqtt.publish(topic, mes)
},
deviceInstruction: function (id, instr) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(id),
instruction: instr,
}))
},
deviceParameterChange: async function (id, name, content) {
// const test = await this.taskGimerCheckDeviceStatus({
// deviceList: this.deviceList,
// type: 'allFree',
// libraryNameREC: 'Neulive3.5-REC',
// libraryNameSTI: 'Neulive3.5-STI',
// })
// if (!test) {
// this.pageToast('Please close recording and stimulation.')
// this.refresh()
// return false
// }
taskInfo.getDeviceInfo(id).parameterSet[name] = content
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(id),
parameter: name,
content: content,
}))
},
refresh () {
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
this.ampGainOptions.forEach(option => {
if (option.id === taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) {
this.ampGainSelect = option
}
})
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
this.axisChannelList.length = 0
@@ -286,17 +321,11 @@ export default {
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_L) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH_L',
content: channelValue,
}))
this.deviceParameterChange(this.deviceID, 'RECORDING_CH_L', channelValue)
}
this.recordingChannelReset(this.channelList)
} else if (this.channelList.indexOf(val) < 0 && val <= 32 && val > 16) {
this.channelList.push(val)
let channelSet = ''
for (let i = 32; i >= 17; i--) {
if (this.channelList.indexOf(i) >= 0) {
@@ -308,12 +337,7 @@ export default {
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_H) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH_H',
content: channelValue,
}))
this.deviceParameterChange(this.deviceID, 'RECORDING_CH_H', channelValue)
}
this.recordingChannelReset(this.channelList)
} else {
@@ -333,12 +357,7 @@ export default {
}
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_L) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH_L',
content: channelValue,
}))
this.deviceParameterChange(this.deviceID, 'RECORDING_CH_L', channelValue)
}
this.recordingChannelReset(this.channelList)
} else if (this.channelList.indexOf(val) >= 0 && val <= 32 && val > 16) {
@@ -353,12 +372,7 @@ export default {
}
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH_H) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH_H',
content: channelValue,
}))
this.deviceParameterChange(this.deviceID, 'RECORDING_CH_H', channelValue)
}
this.recordingChannelReset(this.channelList)
}
@@ -374,62 +388,25 @@ export default {
}
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH',
content: channelValue,
}))
this.deviceParameterChange(this.deviceID, 'RECORDING_CH', channelValue)
}
},
ampGainSelectChange () {
if (this.ampGainSelect != null && this.ampGainSelect.id !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4)) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'AMP_GAIN',
content: ((this.ampGainSelect.id) % 4),
}))
this.deviceParameterChange(this.deviceID, 'AMP_GAIN', this.ampGainSelect.id)
}
},
sampleRateSelectChange () {
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE))) {
const adcClock = 8e6 / this.sampleRateSelect.value
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'SAMPLE_RATE|ADC_CLOCK',
content: `${this.sampleRateSelect.value}|${String(adcClock)}`,
}))
this.deviceParameterChange(this.deviceID, 'SAMPLE_RATE|ADC_CLOCK', `${this.sampleRateSelect.value}|${String(adcClock)}`)
}
},
acceleratorSensitivitySelectChange () {
if (this.acceleratorSensitivitySelect != null && this.acceleratorSensitivitySelect.id !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.ACCELERATOR_S))) {
let scaleRange
switch (this.acceleratorSensitivitySelect.id) {
case 0:
scaleRange = 200
break
case 1:
scaleRange = 400
break
case 2:
scaleRange = 800
break
case 3:
scaleRange = 1600
break
default:
scaleRange = 0
break
}
const scaleRange = Math.pow(2, this.acceleratorSensitivitySelect.id + 1) * 100
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'ACCELERATOR_S',
content: this.acceleratorSensitivitySelect.id,
}))
this.deviceParameterChange(this.deviceID, 'ACCELERATOR_S', this.acceleratorSensitivitySelect.id)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_update_accelerator_sensitivity/0',
device: taskInfo.getRawDeviceID(this.deviceID),
@@ -451,30 +428,6 @@ export default {
}
}
},
recordClick () {
this.recordOn = !this.recordOn
if (this.recordOn) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(this.deviceID),
instruction: 'record',
}))
this.$emit('record')
} else {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(this.deviceID),
instruction: 'stop_record',
}))
this.$emit('record_stop')
}
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING',
content: this.recordOn,
}))
},
axisChannelClickAdd (val) {
if (this.axisChannelList.indexOf(val) < 0) {
const axisChannel = ['m', 'z', 'y', 'x']
@@ -489,12 +442,7 @@ export default {
}
const axisChannelValue = parseInt(axisChannelSet, 2)
if (axisChannelValue !== taskInfo.getDeviceInfo(this.deviceID).AXIS_CH) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'AXIS_CH',
content: axisChannelValue,
}))
this.deviceParameterChange(this.deviceID, 'AXIS_CH', axisChannelValue)
}
}
},
@@ -512,12 +460,7 @@ export default {
}
const axisChannelValue = parseInt(axisChannelSet, 2)
if (axisChannelValue !== taskInfo.getDeviceInfo(this.deviceID).AXIS_CH) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'AXIS_CH',
content: axisChannelValue,
}))
this.deviceParameterChange(this.deviceID, 'AXIS_CH', axisChannelValue)
}
}
},
@@ -531,6 +474,8 @@ export default {
},
)
},
...mapActions('taskContent', [types.gimer.checkDeviceStatus]),
},
mounted () {
this.refresh()
@@ -20,48 +20,6 @@
</div>
</div>
<!-- <div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">CHANNELS</p>
</div>
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div
style='display: inline-block;'
v-for="channel in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]"
:key="channel"
>
<va-button
class="mx-1 px-2"
color="success"
v-if="posChannelList.indexOf(channel) >= 0 && negChannelList.indexOf(channel) < 0"
@click="channelClick(channel)"
small
>
{{channel}}
</va-button>
<va-button
class="mx-1 px-2"
color="danger"
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) >= 0"
@click="channelClick(channel)"
small
>
{{channel}}
</va-button>
<va-button
class="mx-1 px-2"
v-if="posChannelList.indexOf(channel) < 0 && negChannelList.indexOf(channel) < 0"
@click="channelClick(channel)"
small outline
>
{{channel}}
</va-button>
</div>
</div>
</div>
</div> -->
<div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">CYCLE NUMBER = 1</p>
@@ -93,16 +51,6 @@
255
</va-button>
</div>
<!-- <va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="repeatNumberChange(repeatNumber)"
@mouseleave.native="repeatNumberChange(repeatNumber)"
@touchend.native="repeatNumberChange(repeatNumber)"
value-visible
v-model="repeatNumber"
:min="1"
:max="256"
/> -->
</div>
</div>
</div>
@@ -142,7 +90,7 @@
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'PHASE1')">
5
50
</va-button>
<va-input
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.PHASE1, 'PHASE1')"
@@ -154,10 +102,10 @@
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'PHASE1')">
4000
40000
</va-button>
</div>
<va-slider
<!-- <va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@@ -166,7 +114,7 @@
v-model="amplitudeNumber.PHASE1"
:min="5"
:max="4000"
/>
/> -->
</div>
</div>
</div>
@@ -180,7 +128,7 @@
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'PHASE2')">
5
50
</va-button>
<va-input
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.PHASE2, 'PHASE2')"
@@ -192,10 +140,10 @@
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'PHASE2')">
4000
40000
</va-button>
</div>
<va-slider
<!-- <va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@@ -204,7 +152,7 @@
v-model="amplitudeNumber.PHASE2"
:min="5"
:max="4000"
/>
/> -->
</div>
</div>
</div>
@@ -278,9 +226,6 @@
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(1, 0.1)">
0.1
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(1, t1RangeInput)"
v-model="t1RangeInput"
@@ -294,9 +239,6 @@
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(1, 10.23)">
10.23
</va-button> -->
</div>
</div>
</div>
@@ -304,9 +246,6 @@
<div class="row" v-if="patternModeSelect==1">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(2, 0)">
0
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(2, t2RangeInput)"
v-model="t2RangeInput"
@@ -320,9 +259,6 @@
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(2, 10.23)">
10.23
</va-button> -->
</div>
</div>
</div>
@@ -330,9 +266,6 @@
<div class="row" v-if="patternModeSelect==1">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(3, 0.1)">
0.1
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(3, t3RangeInput)"
v-model="t3RangeInput"
@@ -346,9 +279,6 @@
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(3, 10.23)">
10.23
</va-button> -->
</div>
</div>
</div>
@@ -356,9 +286,6 @@
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<!-- <va-button slot="append" class="mr-2 pa-1 shrink" small @click="timeRangeChange(4, 0)">
0
</va-button> -->
<va-input
@keyup.enter="timeRangeChange(4, t4RangeInput)"
readonly
@@ -373,9 +300,6 @@
{{unitOptions[unitSelect].label}}
</p>
</va-input>
<!-- <va-button slot="append" class="ml-2 pa-1 shrink" small @click="timeRangeChange(4, 1310.71)">
1310.71
</va-button> -->
</div>
</div>
</div>
@@ -409,6 +333,9 @@
<script>
import { taskInfo } from '@/data/task/TaskInfo'
import { mapActions } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import types from '@/store/modules/task/content/types'
export default {
name: 'NeuliveParameterStimulation',
@@ -449,8 +376,8 @@ export default {
repeatInterval: 65535, // ms
// repeatNumberArray: Array(9).fill(1),
amplitudeNumberInput: {
PHASE1: '50',
PHASE2: '50',
PHASE1: '500',
PHASE2: '500',
},
amplitudeNumber: {
PHASE1: 50,
@@ -494,28 +421,22 @@ export default {
periodNumber: 0,
t1RangeInput: '0',
t1Range: 0,
// t1RangeArray: Array(9).fill(0),
t2RangeInput: '0',
t2Range: 0,
// t2RangeArray: Array(9).fill(0),
t3RangeInput: '0',
t3Range: 0,
// t3RangeArray: Array(9).fill(0),
t4RangeInput: '0',
t4Range: 0,
// t4RangeArray: Array(9).fill(0),
}
},
computed: {
stimulateDisable () {
// posChannel and negChannel at least one && t1 ~ t4 > 0
const totalStiTime = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10
if (this.t1Range >= 0 && this.t2Range >= 0 && this.t3Range >= 0 && this.t4Range >= 0 && this.periodNumber === totalStiTime) {
return this.stimulateElectrodeSelect ? !(this.posChannelList.length > 0 && this.negChannelList.length > 0) : !(this.posChannelList.length > 0 || this.negChannelList.length > 0)
} else {
return true
}
},
...mapFields('taskContent', [
'deviceList',
]),
},
mqtt: {
},
methods: {
TRangeStatusCheck () {
let flag = true
for (let i = 0; i < this.TRangeErrorMsgList.length; i++) {
@@ -538,10 +459,6 @@ export default {
}
return false
},
},
mqtt: {
},
methods: {
toggleModal (which) {
if (which === 'ELECTRODE') {
this.showGuideLineModal.ELECTRODE = true
@@ -554,22 +471,45 @@ export default {
mqttPub: function (topic, mes) {
this.$mqtt.publish(topic, mes)
},
deviceInstruction: function (id, instr) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(id),
instruction: instr,
}))
},
deviceParameterChange: async function (id, name, content) {
// const test = await this.taskGimerCheckDeviceStatus({
// deviceList: this.deviceList,
// type: 'allFree',
// libraryNameREC: 'Neulive3.5-REC',
// libraryNameSTI: 'Neulive3.5-STI',
// })
// if (!test) {
// this.pageToast('Please close recording and stimulation.')
// this.refresh()
// return false
// }
taskInfo.getDeviceInfo(id).parameterSet[name] = content
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(id),
parameter: name,
content: content,
}))
},
refreshPattern () {
this.patternModeSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_PATTERN ? 1 : 0
if (this.TRangeStatusCheck === true) {
if (this.TRangeStatusCheck()) {
// if t1~t4 is not valid input, not need to refresh
this.t1Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T1_CH1
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
// this.t1RangeArray.fill(this.t1Range, 0)
this.t2Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T2_CH1
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
// this.t2RangeArray.fill(this.t2Range, 0)
this.t3Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T3_CH1
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
// this.t3RangeArray.fill(this.t3Range, 0)
this.t4Range = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_T4_CH1
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
// this.t4RangeArray.fill(this.t4Range, 0)
}
this.periodNumber = (this.t1Range + this.t2Range + this.t3Range + this.t4Range) * 10
this.periodNumberInput = String((this.periodNumber) / this.unitMultiply)
@@ -581,39 +521,16 @@ export default {
},
refresh () {
this.stimulationOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STIMULATING
// stichannel (+,-), stiPolarity (+)
// const stiChannelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CHANNEL.toString(2).split('').reverse()
// const stiPolaritySet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_POLARITY.toString(2).split('').reverse()
// if (stiPolaritySet.length >= stiChannelSet.length) {
// this.posChannelList.length = 0
// this.negChannelList.length = 0
// stiChannelSet.forEach((element, index) => {
// if (parseInt(element) > 0) {
// if (parseInt(stiPolaritySet[index]) > 0) {
// this.posChannelList.push(index + 1)
// } else {
// this.negChannelList.push(index + 1)
// }
// }
// })
this.stimulateElectrodeSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_H_BRIDGE ? 1 : 0
this.repeatNumberSelect = taskInfo.getDeviceInfo(this.deviceID).parameterSet.CONTINUOUS_STI ? 1 : 0
this.repeatNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_TIME_littleEndian)
this.repeatNumberInput = String(this.repeatNumber)
if (this.repeatIntervalCheck) {
// if not valid input, not need to refresh
this.repeatInterval = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_INTERVAL_littleEndian) // unit: ms
this.repeatIntervalInput = String(this.repeatInterval / 1e3)
} else {
this.updateRepeatIntervalErrorMsg({ status: true, msg: `Ti < ${this.periodNumberInput}${this.unitOptions[this.unitSelect].label} (period) * 1 (cycle)` })
}
this.repeatInterval = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.REPEAT_INTERVAL_littleEndian) // unit: ms
this.repeatIntervalInput = String(this.repeatInterval / 1e3)
// this.repeatNumberArray = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_LIST
this.amplitudeNumber.PHASE1 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L1 * 5
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1)
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1) + '0'
this.amplitudeNumber.PHASE2 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_H3 * 5
this.amplitudeNumberInput.PHASE2 = String(this.amplitudeNumber.PHASE2)
this.amplitudeNumberInput.PHASE2 = String(this.amplitudeNumber.PHASE2) + '0'
this.refreshPattern()
@@ -624,52 +541,19 @@ export default {
this.repeatIntervalErrorMsg.key++
},
transUnit () {
if (this.unitSelect === 0) { // s
this.unitMultiply = 1000000
} else if (this.unitSelect === 1) { // ms
this.unitMultiply = 1000
} else { // us
this.unitMultiply = 1
}
this.unitMultiply = 1e6 / Math.pow(1e3, this.unitSelect)
this.t1RangeInput = String((this.t1Range * 10) / this.unitMultiply)
this.t2RangeInput = String((this.t2Range * 10) / this.unitMultiply)
this.t3RangeInput = String((this.t3Range * 10) / this.unitMultiply)
this.t4RangeInput = String((this.t4Range * 10) / this.unitMultiply)
this.periodNumberInput = String((this.periodNumber) / this.unitMultiply)
},
stimulateClick () {
this.stimulationOn = !this.stimulationOn
if (this.stimulationOn) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(this.deviceID),
instruction: 'stimulate',
}))
} else {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(this.deviceID),
instruction: 'stop_stimulate',
}))
}
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STIMULATING',
content: this.stimulationOn,
}))
},
stimulateElectrodeSelectChange () {
if (this.stimulateElectrodeSelect == null) {
return false
}
if (this.stimulateElectrodeSelect !== taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_H_BRIDGE) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_H_BRIDGE',
content: this.stimulateElectrodeSelect,
}))
this.deviceParameterChange(this.deviceID, 'STI_H_BRIDGE', this.stimulateElectrodeSelect)
}
},
channelClick (val) {
@@ -693,25 +577,15 @@ export default {
}
if (this.repeatNumber !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_TIME_littleEndian) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'REPEAT_TIME_littleEndian',
content: String(this.repeatNumber),
}))
this.deviceParameterChange(this.deviceID, 'REPEAT_TIME_littleEndian', String(this.repeatNumber))
}
},
repeatIntervalChange (val) {
this.repeatIntervalInput = String(parseFloat(val).toFixed(2))
this.repeatInterval = parseFloat(this.repeatIntervalInput) * 1e3
if (this.repeatInterval !== taskInfo.getDeviceInfo(this.deviceID).REPEAT_INTERVAL_littleEndian) {
if (this.repeatIntervalCheck) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'REPEAT_INTERVAL_littleEndian',
content: this.repeatInterval,
}))
if (this.repeatIntervalCheck()) {
this.deviceParameterChange(this.deviceID, 'REPEAT_INTERVAL_littleEndian', this.repeatInterval)
this.resetRepeatIntervalErrorMsg()
} else {
this.updateRepeatIntervalErrorMsg({ status: true, msg: `Ti < ${this.periodNumberInput}${this.unitOptions[this.unitSelect].label} (period) * 1 (cycle)` })
@@ -724,50 +598,27 @@ export default {
return false
}
if (typeof (val) === 'string') {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = '50'
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber)) {
this.amplitudeNumber[type] = parseInt(val)
}
} else {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = 50
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
if (parseInt(this.amplitudeNumberInput[type]) !== parseInt(this.amplitudeNumber[type]) || this.amplitudeNumber[type] !== val) {
this.amplitudeNumberInput[type] = String(val)
this.amplitudeNumber[type] = val
}
val = parseInt(parseInt(val / 10) / 5) * 5
}
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = 50
this.amplitudeNumberInput[type] = '500'
this.amplitudeNumber[type] = 50
}
this.amplitudeNumberInput[type] = String(val) + '0'
this.amplitudeNumber[type] = val
if (parseInt(this.amplitudeNumber[type] / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet['STI_AMPLITUDE_' + this.amplitudeName[type][1]])) {
const content2 = parseInt(this.amplitudeNumber[type] / 5)
const content1 = parseInt(this.amplitudeNumber[type] / 5 / 2)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`,
content: `${content1}|${content2}`,
}))
this.deviceParameterChange(this.deviceID, `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`, `${content1}|${content2}`)
}
},
// [Region] Neulive sti pattern block
patternModeSelectChange () {
if (this.patternModeSelect == null) {
return false
}
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_PATTERN',
content: this.patternModeSelect,
}))
this.deviceParameterChange(this.deviceID, 'STI_PATTERN', this.patternModeSelect)
if (this.patternModeSelect === 0) {
this.t2Range = 0
this.t3Range = 0
@@ -913,14 +764,8 @@ export default {
}
this.updateStiParamCheck()
},
updateStiParamCheck () {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'sti_trange_set_done',
content: this.TRangeStatusCheck && this.repeatIntervalCheck,
}))
this.deviceParameterChange(this.deviceID, 'sti_trange_set_done', this.TRangeStatusCheck() && this.repeatIntervalCheck())
},
autoResetAllTRange () {
if (this.patternModeSelect === 0) { // Monophasic
@@ -1086,12 +931,7 @@ export default {
const stiPolarityValue = parseInt(stiPolaritySet, 2)
if (stiChannelValue !== taskInfo.getDeviceInfo(this.deviceID).STI_CHANNEL || stiPolarityValue !== taskInfo.getDeviceInfo(this.deviceID).STI_POLARITY) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_CHANNEL|STI_POLARITY',
content: `${stiChannelValue}|${stiPolarityValue}`,
}))
this.deviceParameterChange(this.deviceID, 'STI_CHANNEL|STI_POLARITY', `${stiChannelValue}|${stiPolarityValue}`)
}
},
updateTimeRange () {
@@ -1124,19 +964,14 @@ export default {
parameter += 'T3_COUNTER|'
content += String(parseInt((this.t1Range + this.t2Range + this.t3Range) * 10 + 10)) + '|'
console.log(content)
// console.log(content)
parameter += 'T4_COUNTER|'
content += String(parseInt((this.t4Range) * 10)) + '|'
if (parameter.length > 0) {
parameter = parameter.slice(0, -1)
content = content.slice(0, -1)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: parameter,
content: content,
}))
this.deviceParameterChange(this.deviceID, parameter, content)
}
},
pageToast: function (mes) {
@@ -1149,6 +984,8 @@ export default {
},
)
},
...mapActions('taskContent', [types.gimer.checkDeviceStatus]),
},
mounted () {
this.refresh()
@@ -117,7 +117,7 @@ export default {
mounted () {
this.pageInit()
this.device = taskInfo.getDeviceInfo(this.deviceID)
console.log(taskInfo.getDeviceInfo(this.deviceID).info)
// console.log(taskInfo.getDeviceInfo(this.deviceID).info)
},
watch: {
deviceID: function (val) {
@@ -181,15 +181,18 @@ export default {
content: content,
}))
},
deviceInstruction: function (id, instr) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(id),
instruction: instr,
}))
},
savePowerChange () {
this.deviceList.forEach(device => {
if (device.library_name === this.libraryNameSTI) {
this.deviceParameterChange(device.id, 'SAVE_POWER_MODE', this.savePower.sti + 0)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_instruction/0',
device: taskInfo.getRawDeviceID(device.id),
instruction: 'SET_POWER_SAVE',
}))
this.deviceInstruction(device.id, 'SET_POWER_SAVE')
}
})
},
@@ -286,7 +289,7 @@ export default {
this.paraSend()
},
setColor () {
console.log(this.channelList)
// console.log(this.channelList)
for (let i = 0; i < this.channelList.rec.length; i++) {
if (this.channelList.rec[i] > 0 && this.channelList.stiPos[i] > 0) {
this.channelList.color[i] = 'b-rec-sti-pos'
@@ -409,9 +412,11 @@ export default {
this.selectProtectRec = taskInfo.getDeviceInfo(deviceID.REC).parameterSet.BLOCK_CH === 65535 ? 'all channels' : 'only sti channels'
this.channelList.ref[taskInfo.getDeviceInfo(deviceID.REC).parameterSet.REF_CH] = 1
const _recCH = taskInfo.getDeviceInfo(deviceID.REC).parameterSet.RECORDING_CH.toString(2).split('').reverse()
taskInfo.getDeviceInfo(deviceID.REC).parameterSet.CH_NUMBER = 0
for (let i = 0; i < _recCH.length; i++) {
if (_recCH[i] > 0) {
this.channelList.rec[i] = 1
taskInfo.getDeviceInfo(deviceID.REC).parameterSet.CH_NUMBER += 1
}
}
}
+12 -3
View File
@@ -7,6 +7,8 @@ import { dataStreamBuffer } from './DataStreamBuffer'
import { taskInfo } from './TaskInfo'
import global_ from '@/data/global/global'
import { IIRFilter } from './filter/IIRFilter.js'
function getIndexArrayForBalenceSampleRate (indexArray, dis, l) {
if (indexArray.length >= 3 || dis <= 0) {
return indexArray
@@ -461,7 +463,14 @@ export const chartData = {
}
popData.forEach(data => {
const _popData = data.data
// const _popData = data.data
let _popData = Number(data.data)
series.filter.forEach(filter => {
if (filter.filter != null) {
_popData = IIRFilter.filter(filter.filter, _popData)
}
})
// const _popData = series.filter.filter == null ? data.data : IIRFilter.filter(series.filter.filter, Number(data.data))
const _popTime = data.time
// series data is empty or popdata time > last series data time
if (series.xAxisSource[0] === -1) {
@@ -704,9 +713,9 @@ export const chartData = {
// console.log(_chartData[chartID])
},
defaultChartGenerator: (_itemID, _chartID, _type) => {
defaultChartGenerator: (_deviceList, _itemID, _chartID, _type) => {
let item
taskInfo.getDeviceListRegister().forEach(_device => {
_deviceList.forEach(_device => {
if (_itemID === _device.id) {
item = _device
}
+3 -4
View File
@@ -1,9 +1,8 @@
// import _global from '../global/global'
// import { chartData } from './ChartsManagement'
// import { taskInfo } from './TaskInfo'
import { sos2, IIRFilter } from './filter/IIRFilter.js'
const IIRFilter2 = IIRFilter.init(sos2)
// const IIRFilter2 = IIRFilter.init(sos2)
const _dataStreamBuffer = {}
const _dataStreamBufferSize = 1000
@@ -78,8 +77,8 @@ export const dataStreamBuffer = {
const tmpData = {
// time: parseInt(currentData[i]),
time: timeStart + ((i - 1) * timeSpare),
// data: currentData[i],
data: IIRFilter.filter(IIRFilter2, Number(currentData[i])),
data: currentData[i],
// data: IIRFilter.filter(IIRFilter2, Number(currentData[i])),
}
// const tmpData = [parseInt(dataSplit[0]), dataSplit[1]]
dataBatch.push(tmpData)
+12 -19
View File
@@ -18,7 +18,7 @@ const _deviceListAll = []
// show the all item can be mapping
const _mappingList = []
export const deviceListRegister = []
// export const deviceListRegister = []
const formulaIDStart = 4
@@ -82,7 +82,6 @@ const updateAllList = async () => {
export const taskInfo = {
updateTaskInfo: async (taskID) => {
let deviceList
const update = async () => {
let contID = 0
const cont = await api.controller.getAll()
@@ -96,14 +95,12 @@ export const taskInfo = {
await api.task.create({
controller_id: contID,
})
} else {
deviceList = task.data[0].device_config
}
}
// _taskInfo.deviceAddrList = [[128, 111, 176, 237, 124, 140], [164, 218, 50, 212, 231, 58], [24, 4, 237, 55, 198, 53]]
// _taskInfo.chartNumber = _taskInfo.deviceAddrList.length
await update()
return deviceList
// return deviceList
},
updateSdCardStatus: async (mes) => {
@@ -121,14 +118,14 @@ export const taskInfo = {
return true
},
destroyed: () => {
destroyed: (deviceListState) => {
_taskInfo = newTask()
_deviceList.length = 0
_deviceListNoTime.length = 0
_deviceListNotRegister.length = 0
_deviceListAll.length = 0
_mappingList.length = 0
deviceListRegister.length = 0
deviceListState.length = 0
// _taskInfo.controllerID = ''
// _taskInfo.deviceAddrList.length = 0
// _taskInfo.taskDeviceID.length = 0
@@ -142,7 +139,7 @@ export const taskInfo = {
// _taskInfo.formulaList.length = 0
},
deviceInfo: async (mes) => {
deviceInfo: async (mes, deviceListState) => {
const mesObj = JSON.parse(mes)
const update = async () => {
try {
@@ -172,7 +169,7 @@ export const taskInfo = {
if (mesObj.data[item][parameter] === 1) {
// temp update stimulate stauts way
_taskInfo.deviceList[mesObj.data.device_id].info.isStimulate = true
deviceListRegister.forEach(device => {
deviceListState.forEach(device => {
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(mesObj.data.device_id))) {
device.isStimulate = true
}
@@ -253,7 +250,7 @@ export const taskInfo = {
// await updateAllList()
},
controllerShutdown: async () => {
controllerShutdown: async (deviceListState) => {
const update = async () => {
for (const device in _taskInfo.deviceList) {
_taskInfo.deviceList[device].info.status = 'disconnected'
@@ -261,16 +258,16 @@ export const taskInfo = {
for (const chart in _taskInfo.chartList) {
_taskInfo.chartList[chart].run = false
}
deviceListRegister.length = 0
deviceListState.length = 0
}
await update()
await updateAllList()
},
deviceStart: async (deviceID) => {
deviceStart: async (deviceID, deviceListState) => {
const update = async () => {
_taskInfo.deviceList[deviceID].info.isSync = true
deviceListRegister.forEach(device => {
deviceListState.forEach(device => {
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
device.isSync = true
}
@@ -279,11 +276,11 @@ export const taskInfo = {
await update()
},
deviceStop: async (deviceID) => {
deviceStop: async (deviceID, deviceListState) => {
const update = async () => {
await dataStreamBuffer.removeByDevice(taskInfo.getRawDeviceID(deviceID))
_taskInfo.deviceList[deviceID].info.isSync = false
deviceListRegister.forEach(device => {
deviceListState.forEach(device => {
if (device.id === _taskInfo.taskDeviceID.indexOf(parseInt(deviceID))) {
device.isSync = false
}
@@ -376,10 +373,6 @@ export const taskInfo = {
return _deviceListAll
},
getDeviceListRegister: () => {
return deviceListRegister
},
getMappingList: () => {
return _mappingList
},
+3
View File
@@ -22,6 +22,9 @@ export const IIRFilter = {
// IIR filter
init: (sos) => {
if (sos.length === 0) {
return null
}
return newIIR1(sos)
},
-8
View File
@@ -11,14 +11,6 @@ function newChart (chartID) {
cardName: 'chart' + String(chartID),
cardHeight: '500px',
cardWidth: 'auto',
filter: {
type: 'none',
order: 15,
fs: 1000,
f0: 10,
f1: 20,
f2: 50,
},
mappingID: -1,
run: false,
timer: 0,
+30
View File
@@ -2,6 +2,36 @@ function newSeries (type, legendName, xAxisIndex, yAxisIndex, xAxisSource, yAxis
return {
name: legendName,
type: type,
filter: [{
type: 'none',
order: 4,
fs: 1000,
f0: 10,
f1: 20,
f2: 50,
sos: [],
filter: null,
},
{
type: 'none',
order: 4,
fs: 1000,
f0: 10,
f1: 20,
f2: 50,
sos: [],
filter: null,
},
{
type: 'none',
order: 4,
fs: 1000,
f0: 10,
f1: 20,
f2: 50,
sos: [],
filter: null,
}],
// symbol: 'circle',
showSymbol: false,
showAllSymbol: false,
+36
View File
@@ -1,6 +1,7 @@
function newParameterSet () {
return {
// Neulive
CH_NUMBER: 0,
ADC_CLOCK: 0,
ADDRESS: 0,
AMP_GAIN: 0,
@@ -186,6 +187,41 @@ function newParameterSet () {
ADC_DAC_CHANNEL_15: 0,
BLE_READ: 0,
BLE_WRITE: [],
V_initial_0: 50000,
V_initial_1: 25000,
V_initial_2: 25000,
V_initial_3: 25000,
t_pulse_0: 750,
t_pulse_1: 9250,
t_pulse_2: 1000,
t_pulse_3: 1000,
CURR_REC_START_0: 35,
CURR_REC_START_1: 35,
CURR_REC_START_2: 35,
CURR_REC_START_3: 35,
CURR_REC_END_0: 90,
CURR_REC_END_1: 99,
CURR_REC_END_2: 95,
CURR_REC_END_3: 95,
segment_ui_order_0: 1,
segment_ui_order_1: 2,
segment_ui_order_2: 0,
segment_ui_order_3: 0,
segment_order_0: 1,
segment_order_1: 2,
segment_order_2: 0,
segment_order_3: 0,
DATA_OUTPUT: 0,
DPV_e_init: 20000,
DPV_e_final: 30000,
DPV_e_1: 35000,
DPV_e_2: 15000,
DPV_amp: 25125,
DPV_pul_width: 50,
DPV_increment: 25025,
DPV_step_time: 500,
DPV_notify_rate: 1000,
DPV_curr_rec: 25,
// Elite EIS
FREQ_START: 0,
FREQ_STOP: 0,
+5 -5
View File
@@ -117,11 +117,11 @@ export default new Router({
path: 'task-content/:taskID?',
component: () => import('../components/task/content/TaskContent.vue'),
},
{
name: 'task-content-g-m',
path: 'task-content-g-m/',
component: () => import('../components/task/content/TaskContentGM.vue'),
},
// {
// name: 'task-content-g-m',
// path: 'task-content-g-m/',
// component: () => import('../components/task/content/TaskContentGM.vue'),
// },
{
name: 'file',
path: 'file',
@@ -541,7 +541,7 @@ const actions = {
// // remove legend
// const _legendIndex = chartData.legend.data.indexOf(payload.legendName)
// console.log(_legendIndex)
// // console.log(_legendIndex)
// if (_legendIndex >= 0) {
// chartData.legend.data.splice(chartData.legend.data.indexOf(payload.legendName), 1)
// } else {
@@ -601,7 +601,7 @@ const actions = {
// chartData.dataZoom[2].yAxisIndex.pop()
// }
// console.log(chartData)
// // console.log(chartData)
// return true
// },
@@ -6,7 +6,10 @@ const typePathDownload = types.download
const typePathDownloadStream = types.downloadStream
const NeuliveParameterOrder = ['RECORDING_CH', 'AXIS_CH', 'AMP_GAIN', 'SAMPLE_RATE']
const NeuliveAmpGain = [100, 400, 800]
const Neulive30NameList = ['Neulive3.0', 'Neulive3.1']
const Neulive35NameList = ['Neulive3.5', 'Neulive3.5-REC', 'Neulive3.5-STI']
const Neulive30AmpGain = [100, 400, 800]
const Neulive35AmpGain = [100, 500, 300]
const exportActs = {
[typePath.setHeader]: function ({ state, getters, commit, dispatch }, payload) {
@@ -50,7 +53,11 @@ const exportActs = {
}
parameter.push(['Accelrator channels', result])
} else if (p === 'AMP_GAIN') {
parameter.push(['Amp gain', NeuliveAmpGain[value]])
if (Neulive30NameList.includes(meta.device.library_name)) {
parameter.push(['Amp gain', Neulive30AmpGain[value]])
} else if (Neulive35NameList.includes(meta.device.library_name)) {
parameter.push(['Amp gain', Neulive35AmpGain[value]])
}
} else if (p === 'SAMPLE_RATE') {
const recordChannel = JSON.parse(meta.channels).filter(ch => parseInt(ch) < 256)
parameter.push(['Sample Rate', parseInt(value / recordChannel.length)])
@@ -70,7 +77,7 @@ const exportActs = {
headersArray.forEach(header => {
headersString += header.join(',') + '\r\n'
})
console.log(headersString)
// console.log(headersString)
dispatch(typePathDownloadStream.writeData, { data: headersString })
},
@@ -171,7 +178,7 @@ const exportActs = {
titleString = titleString.slice(0, -1) + '\r\n'
dispatch(typePathDownloadStream.writeData, { data: titleString })
}
console.log(channelString, titleString)
// console.log(channelString, titleString)
},
[typePath.setData]: function ({ state, getters, commit, dispatch }, payload) {
const downloadInfo = state.downloadInfo
@@ -26,8 +26,8 @@ const paramActs = {
case 'allRun':
return (recStatus === 2 && stiStatus === 2)
case 'allFree':
console.log('stiRun', stiStatus, 'recRun', recStatus)
console.log(recStatus === 1 && stiStatus === 1)
// console.log('stiRun', stiStatus, 'recRun', recStatus)
// console.log(recStatus === 1 && stiStatus === 1)
return (recStatus === 1 && stiStatus === 1)
case 'recRun':
return (recStatus === 2)
+1
View File
@@ -1,5 +1,6 @@
function newState () {
return {
deviceList: [],
filter: {},
showTaskModal: false,
taskModalText: '[Recording] At least one channel is opened.',