mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-22 17:43:44 +00:00
Electron side of waveform math
This commit is contained in:
parent
fefebb0e6b
commit
a294f1e1c8
Software/waveview
@ -333,6 +333,9 @@ void controller::controllerLoop()
|
||||
rhsChan = -1;
|
||||
}
|
||||
//Do something with these.
|
||||
setMathCh_1(lhsChan);
|
||||
setMathCh_2(rhsChan);
|
||||
setMathSign(op == 1);
|
||||
}
|
||||
EVPacket* tempPacket = (EVPacket*) malloc(sizeof(EVPacket));
|
||||
tempPacket->data = NULL;
|
||||
|
@ -25,13 +25,14 @@ class App extends React.Component {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = initialState;
|
||||
this.generator = new TestPoints(50, 30);
|
||||
this.generator = new TestPoints(50, 50);
|
||||
this.conf = new TestConf();
|
||||
this.channelList = [
|
||||
{color: "#EBFF00", className: "Channel1"},
|
||||
{color: "#00FF19", className: "Channel2"},
|
||||
{color: "#0075FF", className: "Channel3"},
|
||||
{color: "#FF0000", className: "Channel4"}
|
||||
{color: "#FF0000", className: "Channel4"},
|
||||
{color: "#FF00FF", className: "Math"}
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { CMD, PlumberArgs, Plumber } from './plumber';
|
||||
import { CMD, PlumberArgs, Plumber, SetMathOp } from './plumber';
|
||||
|
||||
class Range {
|
||||
dataMin: number = 0;
|
||||
@ -17,21 +17,27 @@ class Range {
|
||||
class TestPoints {
|
||||
x: Range;
|
||||
y: Range;
|
||||
ready: Boolean = true;
|
||||
scope_data: any[][] = [];
|
||||
scope_data: any[][] = []; //[ch-1] for channel, [5] for math
|
||||
scope_data_max_idx = 5;
|
||||
|
||||
chCount: number = 4;
|
||||
doMath: Boolean = true;
|
||||
|
||||
rampArgs: PlumberArgs;
|
||||
setChArgs: PlumberArgs;
|
||||
setFileArgs: PlumberArgs;
|
||||
setMathArgs: PlumberArgs;
|
||||
setChDone: Boolean = false;
|
||||
setFileDone: Boolean = false;
|
||||
setMathDone: Boolean = false;
|
||||
|
||||
constructor(xRange: number, yRange: number) {
|
||||
this.x = new Range(0, xRange);
|
||||
this.y = new Range(-yRange, yRange);
|
||||
|
||||
for(var j = 0; j < 4; j++) {
|
||||
for(var j = 0; j < this.scope_data_max_idx; j++) {
|
||||
this.scope_data[j] = [];
|
||||
for(var i = 0; i < 1024; i++) {
|
||||
for(var i = 0; i < 1; i++) {
|
||||
this.scope_data[j][i] = {x: i, y: 0};
|
||||
}
|
||||
}
|
||||
@ -39,8 +45,9 @@ class TestPoints {
|
||||
this.rampArgs = {
|
||||
headCheck: () => true,
|
||||
bodyCheck: (a, bytesRead, body) => {
|
||||
var perChannel = body.length/4;
|
||||
for(var channel = 0; channel < 4; channel++) {
|
||||
var chMax = this.effectiveChCount();
|
||||
var perChannel = Math.floor(body.length/chMax);
|
||||
for(var channel = 0; channel < chMax; channel++) {
|
||||
for(var i = 0; i < perChannel; i++) {
|
||||
this.scope_data[channel][i] = {x: i, y: body[channel*perChannel + i]};
|
||||
}
|
||||
@ -60,7 +67,7 @@ class TestPoints {
|
||||
bodyCheck: () => true,
|
||||
cmd: CMD.CMD_SetCh,
|
||||
id: 0,
|
||||
writeData: [4, 0]
|
||||
writeData: [this.chCount, 0]
|
||||
}
|
||||
|
||||
this.setFileArgs = {
|
||||
@ -73,21 +80,38 @@ class TestPoints {
|
||||
id: 0,
|
||||
writeData: [74, 0]
|
||||
}
|
||||
|
||||
this.setMathArgs = {
|
||||
headCheck: () => {
|
||||
this.setMathDone = true;
|
||||
return true;
|
||||
},
|
||||
bodyCheck: () => true,
|
||||
cmd: CMD.CMD_SetMath,
|
||||
id: 0,
|
||||
writeData: Plumber.getInstance().makeSetMathData(2, 4, SetMathOp.SetMath_Plus)
|
||||
}
|
||||
}
|
||||
|
||||
mountCalls() {
|
||||
Plumber.getInstance().cycle(this.setChArgs);
|
||||
Plumber.getInstance().cycle(this.setFileArgs);
|
||||
Plumber.getInstance().cycle(this.setMathArgs);
|
||||
}
|
||||
|
||||
update() {
|
||||
if(this.setChDone && this.setFileDone) {
|
||||
if(this.setChDone && this.setFileDone && this.setMathDone) {
|
||||
Plumber.getInstance().cycle(this.rampArgs);
|
||||
}
|
||||
}
|
||||
|
||||
effectiveChCount() {
|
||||
return (this.doMath) ? this.chCount + 1: this.chCount;
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.scope_data;
|
||||
var chMax = this.effectiveChCount();
|
||||
return this.scope_data.slice(0, chMax);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user