Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 279a1056f4 | |||
| 35c436ee67 |
@@ -126,6 +126,10 @@ export default {
|
||||
|
||||
const downloadingFile = this.getDownloading
|
||||
downloadingFile.recoverData = recoverData
|
||||
if (rawData === 'acc') {
|
||||
downloadingFile.name += '-axis'
|
||||
}
|
||||
|
||||
let spliceDataNums = 0
|
||||
// console.log(this.getRemainIDLength(0))
|
||||
|
||||
@@ -133,7 +137,7 @@ export default {
|
||||
const filterChannelArray = (rawData === 'acc') ? channelArray.filter(ch => parseInt(ch) >= 256) : channelArray.filter(ch => parseInt(ch) < 256)
|
||||
|
||||
// create headers and title
|
||||
this.createHeadersStringExport()
|
||||
this.createHeadersStringExport({ rawData: rawData })
|
||||
this.createTitlesStringExport({ rawData: rawData })
|
||||
// loop until each channel's rawID List empty
|
||||
while (this.getRemainIDLength(0, filterChannelArray)) {
|
||||
|
||||
@@ -658,7 +658,9 @@ export default {
|
||||
} else if (meta.device.library_name.indexOf('Neulive') >= 0) {
|
||||
window.open('http://' + href + '/#/download/neulive/csv/' + meta.id + '/raw', 'raw')
|
||||
if (JSON.parse(meta.channels).some(el => el >= 256)) {
|
||||
window.open('http://' + href + '/#/download/neulive/csv/' + meta.id + '/acc', 'acc')
|
||||
setTimeout(() => {
|
||||
window.open('http://' + href + '/#/download/neulive/csv/' + meta.id + '/acc', 'acc')
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,6 +2,9 @@ function newDownload () {
|
||||
return {
|
||||
_downloadIDList: [],
|
||||
_downloadBuffer: [],
|
||||
downloadData: {},
|
||||
downloadTimer: {},
|
||||
downloadStartTime: {},
|
||||
downloadIDList: {},
|
||||
downloadBuffer: {},
|
||||
progress: 0,
|
||||
|
||||
@@ -44,6 +44,9 @@ const downloadActs = {
|
||||
const downloadInfo = Object.assign(newDownload(), metaRes.data[0])
|
||||
for (const channel of JSON.parse(downloadInfo.channels)) {
|
||||
downloadInfo.downloadBuffer[channel] = []
|
||||
downloadInfo.downloadTimer[channel] = -1
|
||||
downloadInfo.downloadData[channel] = -1
|
||||
downloadInfo.downloadStartTime[channel] = -1
|
||||
}
|
||||
// downloadInfo.downloadIDList = JSON.parse(JSON.stringify(downloadInfo.raw_data))
|
||||
// getExcleNeedColumns(downloadInfo, true)
|
||||
@@ -99,22 +102,23 @@ const downloadActs = {
|
||||
|
||||
[typePath.parseEachData]: function ({ state, getters, commit }, payload) {
|
||||
const { channel, rawData } = payload
|
||||
|
||||
const meta = state.downloadingFile
|
||||
const sampleRate = 800000 / meta.configuration.ADC_CLOCK
|
||||
const averageSampleRate = sampleRate / JSON.parse(meta.channels).length
|
||||
const timeInterval = parseInt((1 / averageSampleRate) * 1e6)
|
||||
let prevTime = -1
|
||||
let prevData = 0
|
||||
|
||||
if (state.downloadingFile.downloadStartTime[channel] === -1) {
|
||||
state.downloadingFile.downloadStartTime[channel] = parseInt(rawData[0])
|
||||
}
|
||||
|
||||
for (let i = 0; i <= rawData.length - 1; i += 2) {
|
||||
if (rawData[i].length !== 0) {
|
||||
const time = parseInt(rawData[i])
|
||||
const time = (Math.floor(parseInt(rawData[i]) / timeInterval) * timeInterval) + state.downloadingFile.downloadStartTime[channel]
|
||||
const data = rawData[i + 1]
|
||||
if (state.downloadingFile.recoverData) {
|
||||
let timeDiff = time - prevTime
|
||||
if (state.downloadingFile.recoverData && state.downloadingFile.downloadData[channel] !== -1 && state.downloadingFile.downloadTimer[channel] !== -1) {
|
||||
let timeDiff = time - state.downloadingFile.downloadTimer[channel]
|
||||
const timeDiffOrigin = timeDiff
|
||||
if (timeDiff >= 1.8 * timeInterval && prevTime !== -1) {
|
||||
if (timeDiff >= 1.5 * timeInterval && state.downloadingFile.downloadTimer[channel] !== -1) {
|
||||
console.log('data-recover', timeDiff)
|
||||
let timeCorrection = 0
|
||||
let dataIndex = 1
|
||||
@@ -123,8 +127,8 @@ const downloadActs = {
|
||||
timeCorrection += timeInterval
|
||||
timeDiff -= timeInterval
|
||||
if (timeDiff > 0) {
|
||||
const _time = parseInt(prevTime) + parseInt(timeCorrection)
|
||||
const _data = parseInt(prevData) + (timeCorrection / timeDiffOrigin) * (parseInt(data) - parseInt(prevData))
|
||||
const _time = parseInt(state.downloadingFile.downloadTimer[channel]) + parseInt(timeCorrection)
|
||||
const _data = parseInt(state.downloadingFile.downloadData[channel]) + (timeCorrection / timeDiffOrigin) * (parseInt(data) - parseInt(state.downloadingFile.downloadData[channel]))
|
||||
const tmpData = [_time, _data]
|
||||
state.downloadingFile.downloadBuffer[channel].push(tmpData)
|
||||
dataIndex = dataIndex + 1
|
||||
@@ -132,12 +136,12 @@ const downloadActs = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (time <= parseInt(meta.time_duration)) {
|
||||
if (time <= parseInt(meta.time_duration) && time !== state.downloadingFile.downloadTimer[channel]) {
|
||||
const tmpData = [time, data]
|
||||
state.downloadingFile.downloadBuffer[channel].push(tmpData)
|
||||
}
|
||||
prevTime = time
|
||||
prevData = data
|
||||
state.downloadingFile.downloadTimer[channel] = time
|
||||
state.downloadingFile.downloadData[channel] = data
|
||||
}
|
||||
}
|
||||
delete payload.rawData
|
||||
|
||||
@@ -28,6 +28,26 @@ function intoFileStream (data, filename, size, close) {
|
||||
data && writer.write(data)
|
||||
}
|
||||
|
||||
// async function intoFileStream (data, filename, size, close) {
|
||||
// if (!fileStream) {
|
||||
// if (filename !== undefined) {
|
||||
// handle = await window.showSaveFilePicker()
|
||||
// fileStream = await handle.createWritable()
|
||||
// writer = await fileStream.getWriter()
|
||||
// // fileStream = streamSaver.createWriteStream(filename + '.csv', {
|
||||
// // size: size,
|
||||
// // })
|
||||
// // writer = fileStream.getWriter()
|
||||
// window.isSecureContext && window.addEventListener('beforeunload', evt => {
|
||||
// writer.close()
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
// data = encode(data)
|
||||
// data && writer.write(data)
|
||||
// }
|
||||
|
||||
function closeWriter () {
|
||||
writer.close()
|
||||
}
|
||||
@@ -84,7 +104,10 @@ const exportActs = {
|
||||
}
|
||||
}
|
||||
})
|
||||
result = result.slice(0, -1) + '"'
|
||||
if (result.length !== 1) {
|
||||
result = result.slice(0, -1)
|
||||
}
|
||||
result += '"'
|
||||
parameter.push(['Accelrator channels', result])
|
||||
} else if (p === 'AMP_GAIN') {
|
||||
parameter.push(['Amp gain', NeuliveAmpGain[value]])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
function newState () {
|
||||
return {
|
||||
downloadList: [],
|
||||
downloadingTime: [],
|
||||
downloadingFile: null,
|
||||
exportingFile: null,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user