mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-11 23:19:16 +00:00
UI->Plumber: setLevel
This commit is contained in:
parent
16fad163d9
commit
b469f9e852
Software/waveview/src
@ -44,21 +44,30 @@ class TriggerWidget extends React.Component<any, any> {
|
||||
|
||||
// Trigger Level
|
||||
increaseTriggerLevel = () => {
|
||||
//TODO: Plumber call
|
||||
//(TRIGGER LEVEL (V))/((VOLTAGE RANGExDIVISIONS)/256)
|
||||
let tw = this.props.triggerWidget;
|
||||
let lvl = tw.triggerLevel[tw.triggerChannel-1];
|
||||
let vw = this.props.verticalWidget;
|
||||
let div = vw.timePerDivision[tw.triggerChannel-1].course;
|
||||
Plumber.getInstance().handleSetLevel(lvl.value+0.1, lvl.unit, div.value, div.unit);
|
||||
this.props.dispatch({type: 'trigger/increaseTriggerLevelValue'});
|
||||
}
|
||||
|
||||
decreaseTriggerLevel = () => {
|
||||
//TODO: Plumber call
|
||||
//(TRIGGER LEVEL (V))/((VOLTAGE RANGExDIVISIONS)/256)
|
||||
let tw = this.props.triggerWidget;
|
||||
let lvl = tw.triggerLevel[tw.triggerChannel-1];
|
||||
let vw = this.props.verticalWidget;
|
||||
let div = vw.timePerDivision[tw.triggerChannel-1].course;
|
||||
Plumber.getInstance().handleSetLevel(lvl.value-0.1, lvl.unit, div.value, div.unit);
|
||||
this.props.dispatch({type: 'trigger/decreaseTriggerLevelValue'});
|
||||
}
|
||||
|
||||
// Trigger Level Unit
|
||||
changeTriggerLevelUnit = (voltageUnit: VoltageUnit) => {
|
||||
//TODO: unit analysis, plumber call
|
||||
//(TRIGGER LEVEL (V))/((VOLTAGE RANGExDIVISIONS)/256)
|
||||
let tw = this.props.triggerWidget;
|
||||
let lvl = tw.triggerLevel[tw.triggerChannel-1];
|
||||
let vw = this.props.verticalWidget;
|
||||
let div = vw.timePerDivision[tw.triggerChannel-1].course;
|
||||
Plumber.getInstance().handleSetLevel(lvl.value, voltageUnit, div.value, div.unit);
|
||||
this.props.dispatch({type: 'trigger/changeTriggerLevelUnit', payload: voltageUnit});
|
||||
}
|
||||
|
||||
|
@ -178,6 +178,19 @@ export class Plumber {
|
||||
this.cycle(args);
|
||||
}
|
||||
|
||||
public handleSetLevel(lvl: number, lvlUnit: VoltageUnit, div: number, divUnit: VoltageUnit) {
|
||||
let convertedLvl = convertVoltage(lvl, lvlUnit, divUnit);
|
||||
let normLvl = 256 * convertedLvl/(div*DefaultValues.divisions.voltage);
|
||||
let args = {
|
||||
headCheck: () => true,
|
||||
bodyCheck: () => true,
|
||||
cmd: CMD.CMD_SetLevel,
|
||||
id: 0,
|
||||
writeData: new Int8Array([normLvl, 0])
|
||||
}
|
||||
this.cycle(args);
|
||||
}
|
||||
|
||||
public decodeGetMinMax(args: PlumberArgs, a: Int8Array) {
|
||||
let maxCh = 4;
|
||||
let a64u = new BigUint64Array(a.buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user