mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-22 17:43:44 +00:00
Get/SetWindowSize
This commit is contained in:
parent
98fc82927c
commit
556e787488
Software/waveview
@ -41,7 +41,7 @@ Cmd | DataSize | Name | Description
|
||||
0x23 | 2 (useless) | GetLevel |
|
||||
0x24 | 2 (useless) | GetTriggerCh |
|
||||
0x25 | 2 (useless) | GetEdgeType |
|
||||
0x31 | 4 | SetWindowSize | Data has new window size
|
||||
0x31 | 4 | SetWindowSize | Data has new window size as uint32
|
||||
0x32 | 2 | SetCh | Data has ch 1, 2 or 4
|
||||
0x33 | 2 | SetLevel | Data has new level
|
||||
0x34 | 2 | SetTriggerCh | Data has channel 1,2,3,4
|
||||
@ -63,7 +63,7 @@ Cmd | DataSize | Name | Description
|
||||
0x01 | ch * windowSize | GetData1 | Data for all ch
|
||||
0x11 | 0 | SetFile | Set testdata filename
|
||||
0x1F | 4096 | RampDemo | 4 ch, simple waves
|
||||
0x21 | 4 | GetWindowSize | Data has window size
|
||||
0x21 | 4 | GetWindowSize | Data has window size as uint32
|
||||
0x22 | 2 | GetCh | Data has ch 1, 2, or 4
|
||||
0x23 | 2 | GetLevel | Data has new level
|
||||
0x24 | 2 | GetTriggerCh | Data has channel 1,2,3 or 4
|
||||
@ -94,8 +94,8 @@ Cmd | DataSize | Name | Description
|
||||
0x02 | windowSize | Reserved | If we need 1 command/ch
|
||||
0x03 | windowSize | Reserved | If we need 1 command/ch
|
||||
0x04 | windowSize | Reserved | If we need 1 command/ch
|
||||
0x05 | 4 | GetMin | Data has ch 1,2,3 or 4
|
||||
0x06 | 4 | GetMax | Data has ch 1,2,3 or 4
|
||||
0x05 | 16 | GetMin | Data has x and y as uint64
|
||||
0x06 | 16 | GetMax | Data has x and y as uint64
|
||||
|
||||
## Proposed But Not Allocated
|
||||
|
||||
|
@ -135,19 +135,15 @@ void controller::controllerLoop()
|
||||
break;
|
||||
case CMD_GetWindowSize: {
|
||||
INFO << "Packet command: GetWindowSize";
|
||||
const int packetSize = 4;
|
||||
|
||||
EVPacket* tempPacket = (EVPacket*) malloc(sizeof(EVPacket));
|
||||
tempPacket->data = (int8_t*) malloc(packetSize);
|
||||
const int packetSize = sizeof(uint32_t);
|
||||
uint32_t* windata = (uint32_t*) malloc(packetSize);
|
||||
windata[0] = getWindowSize();
|
||||
tempPacket->data = (int8_t*) windata;
|
||||
tempPacket->dataSize = packetSize;
|
||||
tempPacket->packetID = 0;
|
||||
tempPacket->command = CMD_GetWindowSize;
|
||||
|
||||
int32_t windowSize = getWindowSize();
|
||||
tempPacket->data[0] = (windowSize >> 24) & 0xFF;
|
||||
tempPacket->data[1] = (windowSize >> 16) & 0xFF;
|
||||
tempPacket->data[2] = (windowSize >> 8) & 0xFF;
|
||||
tempPacket->data[3] = windowSize & 0xFF;
|
||||
controllerQueue_tx.push(tempPacket);
|
||||
}
|
||||
break;
|
||||
@ -210,12 +206,8 @@ void controller::controllerLoop()
|
||||
ERROR << "Unexpected size for SetWindowSize packet";
|
||||
}
|
||||
else {
|
||||
int32_t windowSize = 0;
|
||||
windowSize |= currentPacket->data[0] << 24;
|
||||
windowSize |= currentPacket->data[1] << 16;
|
||||
windowSize |= currentPacket->data[2] << 8;
|
||||
windowSize |= currentPacket->data[3];
|
||||
setWindowSize(windowSize);
|
||||
uint32_t* windowSize = (uint32_t*)currentPacket->data;
|
||||
setWindowSize(windowSize[0]);
|
||||
}
|
||||
EVPacket* tempPacket = (EVPacket*) malloc(sizeof(EVPacket));
|
||||
tempPacket->data = NULL;
|
||||
|
@ -52,7 +52,8 @@ class App extends React.Component {
|
||||
let tickCount = this.state.tickCount + 1;
|
||||
this.generator.update();
|
||||
if(tickCount % 100 === 0) {
|
||||
//this.conf.update(tickCount % 1000 !== 0);
|
||||
console.log(tickCount);
|
||||
this.conf.update(tickCount % 500 !== 0);
|
||||
//this.conf.mathUpdate();
|
||||
}
|
||||
this.setState({tickCount: tickCount});
|
||||
|
@ -38,7 +38,7 @@ export interface PlumberArgs {
|
||||
bodyCheck: (args: PlumberArgs, bytesRead: number, body: Int8Array) => boolean;
|
||||
cmd: CMD;
|
||||
id: number;
|
||||
writeData: number[];
|
||||
writeData: number[] | Int8Array;
|
||||
}
|
||||
|
||||
export class Plumber {
|
||||
|
@ -1,31 +1,12 @@
|
||||
import { CMD, PlumberArgs, Plumber, SetMathOp } from './plumber';
|
||||
|
||||
class TestConf {
|
||||
getChArgs: PlumberArgs;
|
||||
setChArgs: PlumberArgs;
|
||||
setMathArgs: PlumberArgs;
|
||||
getEdgeArgs: PlumberArgs;
|
||||
setEdgeArgs: PlumberArgs;
|
||||
getWinArgs: PlumberArgs;
|
||||
setWinArgs: PlumberArgs;
|
||||
|
||||
constructor() {
|
||||
this.getChArgs = {
|
||||
headCheck: (a, head) => true,
|
||||
bodyCheck: (a, bytesRead, body) => {
|
||||
console.log("C++ channel count: " + body[0]);
|
||||
return true;
|
||||
},
|
||||
cmd: CMD.CMD_GetCh,
|
||||
id: 0,
|
||||
writeData: [0, 0]
|
||||
}
|
||||
|
||||
this.setChArgs = {
|
||||
headCheck: () => true,
|
||||
bodyCheck: () => true,
|
||||
cmd: CMD.CMD_SetCh,
|
||||
id: 0,
|
||||
writeData: [4, 0]
|
||||
}
|
||||
|
||||
this.getEdgeArgs = {
|
||||
headCheck: (a, head) => true,
|
||||
@ -46,29 +27,39 @@ class TestConf {
|
||||
writeData: [2, 0]
|
||||
}
|
||||
|
||||
this.setMathArgs = {
|
||||
this.getWinArgs = {
|
||||
headCheck: () => true,
|
||||
bodyCheck: () => {
|
||||
console.log("I did it, I set the math");
|
||||
bodyCheck: (args, bytesRead, body) => {
|
||||
var body32 = new Uint32Array(body.buffer);
|
||||
console.log(body32);
|
||||
return true;
|
||||
},
|
||||
cmd: CMD.CMD_SetMath,
|
||||
cmd: CMD.CMD_GetWindowSize,
|
||||
id: 0,
|
||||
writeData: Plumber.getInstance().makeSetMathData(0, 2, SetMathOp.SetMath_Plus)
|
||||
writeData: [0, 0]
|
||||
}
|
||||
|
||||
this.setWinArgs = {
|
||||
headCheck: () => {
|
||||
console.log("I set win");
|
||||
return true;
|
||||
},
|
||||
bodyCheck: () => true,
|
||||
cmd: CMD.CMD_SetWindowSize,
|
||||
id: 0,
|
||||
writeData: new Int8Array((new Uint32Array([20])).buffer)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update(get: boolean) {
|
||||
if(get) {
|
||||
Plumber.getInstance().cycle(this.getChArgs);
|
||||
Plumber.getInstance().cycle(this.getWinArgs);
|
||||
}
|
||||
else {
|
||||
Plumber.getInstance().cycle(this.setChArgs);
|
||||
Plumber.getInstance().cycle(this.setWinArgs);
|
||||
}
|
||||
}
|
||||
|
||||
mathUpdate() {
|
||||
Plumber.getInstance().cycle(this.setMathArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user