7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-04-22 17:43:44 +00:00

Merge pull request from EEVengers/features/cleanup-measurements-widget

Features/cleanup measurements widget
This commit is contained in:
Jason Bonnell 2021-03-20 16:52:49 -04:00 committed by GitHub
commit f91f59adbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 887 additions and 1565 deletions

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,7 @@
"cmake-js": "^6.1.0",
"concurrently": "^5.3.0",
"electron": "^11.2.0",
"electron-builder": "^22.10.5",
"electron-builder": "^22.9.1",
"wait-on": "^5.2.1"
},
"build": {

View File

@ -50,8 +50,8 @@ class App extends React.Component {
tick() {
let tickCount = this.state.tickCount + 1;
this.generator.update();
if(tickCount % 100 == 0) {
//this.conf.update(tickCount % 1000 != 0);
if(tickCount % 100 === 0) {
//this.conf.update(tickCount % 1000 !== 0);
//this.conf.mathUpdate();
}
this.setState({tickCount: tickCount});

View File

@ -1,6 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import DefaultValues from '../../../configuration/defaultValues';
import ControlMode from '../../../configuration/enums/controlMode';
import ProbeMode from '../../../configuration/enums/probeMode';
import './../../../css/bottombar/subcomponents/channel.css';
@ -12,14 +11,14 @@ class Channel extends React.Component<any, any> {
<label>
CH{this.props.channelNumber}:
{" "}
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode == ControlMode.Course
&& this.props.verticalWidget.settings[this.props.channelNumber-1].probeMode == ProbeMode.x1
&& DefaultValues.x1ProbeValues[this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].index]}
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode == ControlMode.Course
&& this.props.verticalWidget.settings[this.props.channelNumber-1].probeMode == ProbeMode.x10
&& DefaultValues.x10ProbeValues[this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].index]}
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode == ControlMode.Fine && this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].fineValue.toString()}
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode == ControlMode.Fine && this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].fineUnit.toString() + "/div"},
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].course.value.toString()
+ this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].course.unit.toString() + "/div"}
{this.props.verticalWidget.settings[this.props.channelNumber-1].controlMode === ControlMode.Fine
&& (this.props.verticalWidget.settings[this.props.channelNumber-1].probeMode === ProbeMode.x1
? this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].fine.value.toString()
: this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].fine.x10value.toString())
+ this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].fine.unit.toString() + "/div"},
{" "}
{this.props.verticalWidget.verticalOffset[this.props.channelNumber-1].value}
{this.props.verticalWidget.verticalOffset[this.props.channelNumber-1].unit},

View File

@ -7,9 +7,10 @@ class TimePerDivision extends React.Component<any, any> {
render() {
return(
<div className="TimePerDivisionComponent">
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fineValue.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fineUnit.toString() + "/div"}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.course.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.course.unit.toString() + "/div"}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fine.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fine.unit.toString() + "/div"}
</div>
)
}

View File

@ -57,7 +57,7 @@ class HorizontalWidget extends React.Component<any, any> {
onClick={() => this.changeTimeBaseMode(ControlMode.Course)}>
<label
className=""
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Course ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course ? "bold" : "normal"}}>
Course
</label>
</button>
@ -66,7 +66,7 @@ class HorizontalWidget extends React.Component<any, any> {
onClick={() => this.changeTimeBaseMode(ControlMode.Fine)}>
<label
className=""
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine ? "bold" : "normal"}}>
Fine
</label>
</button>
@ -75,32 +75,33 @@ class HorizontalWidget extends React.Component<any, any> {
<div className="HorizontalWidgetAdjustBlock-HorizontalTimeBase">
<button
className="MinusButton"
onClick={() => this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Course ? this.decrementTimeBase() : this.decrementTimeBaseFine()}>
onClick={() => this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course ? this.decrementTimeBase() : this.decrementTimeBaseFine()}>
-
</button>
<label
className="AdjustValueBlockHorizontalTimeBase"
style={{color: "white"}}
>
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fineValue.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fineUnit.toString() + "/div"}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.course.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course && this.props.horizontalWidget.horizontalTimeBase.course.unit.toString() + "/div"}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fine.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine && this.props.horizontalWidget.horizontalTimeBase.fine.unit.toString() + "/div"}
</label>
<button
className="PlusButton"
onClick={() => this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Course ? this.incrementTimeBase() : this.incrementTimeBaseFine()}>
onClick={() => this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course ? this.incrementTimeBase() : this.incrementTimeBaseFine()}>
+
</button>
</div>
{this.props.horizontalWidget.horizontalTimeBase.mode == ControlMode.Fine &&
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Fine &&
<div className="FineModeUnitButtons">
<button
className="NanoSecondButton"
onClick={() => this.changeTimeBaseUnit(TimeUnit.NanoSecond)}>
<label
className={"NanoSecondButtonText"}
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fineUnit == TimeUnit.NanoSecond ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fine.unit === TimeUnit.NanoSecond ? "bold" : "normal"}}>
{TimeUnit.NanoSecond}
</label>
</button>
@ -109,7 +110,7 @@ class HorizontalWidget extends React.Component<any, any> {
onClick={() => this.changeTimeBaseUnit(TimeUnit.MicroSecond)}>
<label
className={"MicroSecondButtonText"}
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fineUnit == TimeUnit.MicroSecond ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fine.unit === TimeUnit.MicroSecond ? "bold" : "normal"}}>
{TimeUnit.MicroSecond}
</label>
</button>
@ -118,7 +119,7 @@ class HorizontalWidget extends React.Component<any, any> {
onClick={() => this.changeTimeBaseUnit(TimeUnit.MilliSecond)}>
<label
className={"MilliSecondButtonText"}
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fineUnit == TimeUnit.MilliSecond ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fine.unit === TimeUnit.MilliSecond ? "bold" : "normal"}}>
{TimeUnit.MilliSecond}
</label>
</button>
@ -127,7 +128,7 @@ class HorizontalWidget extends React.Component<any, any> {
onClick={() => this.changeTimeBaseUnit(TimeUnit.Second)}>
<label
className={"SecondButtonText"}
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fineUnit == TimeUnit.Second ? "bold" : "normal"}}>
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.fine.unit === TimeUnit.Second ? "bold" : "normal"}}>
{TimeUnit.Second}
</label>
</button>
@ -136,7 +137,7 @@ class HorizontalWidget extends React.Component<any, any> {
<div className="HorizontalOffsetTitle">
Horizontal Offset
Offset
</div>
<div className="HorizontalWidgetAdjustBlock-HorizontalOffset">
<button

View File

@ -11,30 +11,32 @@ class MeasurementsWidget extends React.Component<any, any> {
Measurements
</div>
<div className="MeasurementsWidgetDisplayValueBlock-Value1">
<div className="MeasurementsWidget-Max">
<label
className="DisplayValueBlockLeftValue1"
className="DisplayValue-MaxLabel"
>
{this.props.measurementsWidget.leftValue1}
{this.props.measurementsWidget.measurement[0].mathType}
</label>
<label
className="DisplayValueBlockRightValue1"
className="DisplayValue-MaxValue"
>
{this.props.measurementsWidget.rightValue1}
{this.props.measurementsWidget.measurement[0].value}
{this.props.measurementsWidget.measurement[0].unit}
</label>
<div className="ClearBlock"></div>
</div>
<div className="MeasurementsWidgetDisplayValueBlock-Value2">
<div className="MeasurementsWidget-Min">
<label
className="DisplayValueBlockLeftValue2"
className="DisplayValue-MinLabel"
>
{this.props.measurementsWidget.leftValue2}
{this.props.measurementsWidget.measurement[1].mathType}
</label>
<label
className="DisplayValueBlockRightValue2"
className="DisplayValue-MinValue"
>
{this.props.measurementsWidget.rightValue2}
{this.props.measurementsWidget.measurement[1].value}
{this.props.measurementsWidget.measurement[1].unit}
</label>
<div className="ClearBlock"></div>
</div>

View File

@ -54,7 +54,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeChannel(1)}>
<label
className={"Channel1ButtonText"}
style={{color: this.props.triggerWidget.triggerChannel == 1 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
style={{color: this.props.triggerWidget.triggerChannel === 1 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
CH1
</label>
</button>
@ -63,7 +63,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeChannel(2)}>
<label
className={"Channel2ButtonText"}
style={{color: this.props.triggerWidget.triggerChannel == 2 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
style={{color: this.props.triggerWidget.triggerChannel === 2 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
CH2
</label>
</button>
@ -72,7 +72,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeChannel(3)}>
<label
className={"Channel3ButtonText"}
style={{color: this.props.triggerWidget.triggerChannel == 3 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
style={{color: this.props.triggerWidget.triggerChannel === 3 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
CH3
</label>
</button>
@ -81,7 +81,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeChannel(4)}>
<label
className={"Channel4ButtonText"}
style={{color: this.props.triggerWidget.triggerChannel == 4 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
style={{color: this.props.triggerWidget.triggerChannel === 4 ? this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1] : "black"}}>
CH4
</label>
</button>
@ -96,7 +96,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerType(TriggerType.FallingEdge)}>
<label
className="FallingEdgeButtonText"
style={{fontWeight: this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1] == TriggerType.FallingEdge ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1] === TriggerType.FallingEdge ? "bold" : "normal"}}>
Falling Edge
</label>
</button>
@ -105,7 +105,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerType(TriggerType.RisingEdge)}>
<label
className="RisingEdgeButtonText"
style={{fontWeight: this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1] == TriggerType.RisingEdge ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1] === TriggerType.RisingEdge ? "bold" : "normal"}}>
Rising Edge
</label>
</button>
@ -140,7 +140,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.NanoVolt)}>
<label
className={"NanoVoltButtonText"}
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.NanoVolt ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit === VoltageUnit.NanoVolt ? "bold" : "normal"}}>
{VoltageUnit.NanoVolt}
</label>
</button>
@ -149,7 +149,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.MicroVolt)}>
<label
className={"MicroVoltButtonText"}
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.MicroVolt ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit === VoltageUnit.MicroVolt ? "bold" : "normal"}}>
{VoltageUnit.MicroVolt}
</label>
</button>
@ -158,7 +158,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.MilliVolt)}>
<label
className={"MilliVoltButtonText"}
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.MilliVolt ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit === VoltageUnit.MilliVolt ? "bold" : "normal"}}>
{VoltageUnit.MilliVolt}
</label>
</button>
@ -167,7 +167,7 @@ class TriggerWidget extends React.Component<any, any> {
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.Volt)}>
<label
className={"VoltButtonText"}
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.Volt ? "bold" : "normal"}}>
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit === VoltageUnit.Volt ? "bold" : "normal"}}>
{VoltageUnit.Volt}
</label>
</button>

View File

@ -1,6 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import DefaultValues from '../../../configuration/defaultValues';
import ControlMode from '../../../configuration/enums/controlMode';
import VoltageUnit from '../../../configuration/enums/voltageUnit';
import MeasurementType from '../../../configuration/enums/measurementType';
@ -81,7 +80,7 @@ class VerticalWidget extends React.Component<any, any> {
onDoubleClick={() => this.changeChannelStatus(0)}>
<label
className={"Channel1ButtonText"}
style={{color: this.props.verticalWidget.settings[0].status == 1 ? this.props.verticalWidget.channelColorsList[0] : "black"}}>
style={{color: this.props.verticalWidget.settings[0].status === 1 ? this.props.verticalWidget.channelColorsList[0] : "black"}}>
CH1
</label>
</button>
@ -91,7 +90,7 @@ class VerticalWidget extends React.Component<any, any> {
onDoubleClick={() => this.changeChannelStatus(1)}>
<label
className={"Channel2ButtonText"}
style={{color: this.props.verticalWidget.settings[1].status == 1 ? this.props.verticalWidget.channelColorsList[1] : "black"}}>
style={{color: this.props.verticalWidget.settings[1].status === 1 ? this.props.verticalWidget.channelColorsList[1] : "black"}}>
CH2
</label>
</button>
@ -101,7 +100,7 @@ class VerticalWidget extends React.Component<any, any> {
onDoubleClick={() => this.changeChannelStatus(2)}>
<label
className={"Channel3ButtonText"}
style={{color: this.props.verticalWidget.settings[2].status == 1 ? this.props.verticalWidget.channelColorsList[2] : "black"}}>
style={{color: this.props.verticalWidget.settings[2].status === 1 ? this.props.verticalWidget.channelColorsList[2] : "black"}}>
CH3
</label>
</button>
@ -111,7 +110,7 @@ class VerticalWidget extends React.Component<any, any> {
onDoubleClick={() => this.changeChannelStatus(3)}>
<label
className={"Channel4ButtonText"}
style={{color: this.props.verticalWidget.settings[3].status == 1 ? this.props.verticalWidget.channelColorsList[3] : "black"}}>
style={{color: this.props.verticalWidget.settings[3].status === 1 ? this.props.verticalWidget.channelColorsList[3] : "black"}}>
CH4
</label>
</button>
@ -126,7 +125,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeControlMode(ControlMode.Course)}>
<label
className=""
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Course ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Course ? "bold" : "normal"}}>
Course
</label>
</button>
@ -135,7 +134,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeControlMode(ControlMode.Fine)}>
<label
className=""
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Fine ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Fine ? "bold" : "normal"}}>
Fine
</label>
</button>
@ -144,37 +143,37 @@ class VerticalWidget extends React.Component<any, any> {
<div className="VerticalWidgetAdjustBlock-TimePerDivision">
<button
className="MinusButton"
onClick={() => this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Course ? this.decrementTimePerDivision() : this.decrementTimePerDivisionFine()}>
onClick={() => this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Course ? this.decrementTimePerDivision() : this.decrementTimePerDivisionFine()}>
-
</button>
<label
className="AdjustValueBlockTimePerDivision"
style={{color: this.props.verticalWidget.channelColorsList[this.props.verticalWidget.activeChannel-1]}}
>
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Course
&& this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode == ProbeMode.x1
&& DefaultValues.x1ProbeValues[this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].index]}
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Course
&& this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode == ProbeMode.x10
&& DefaultValues.x10ProbeValues[this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].index]}
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Fine && this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineValue.toString()}
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Fine && this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineUnit.toString() + "/div"}
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].course.value.toString()
+ this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].course.unit.toString() + "/div"}
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Fine
&& (this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode === ProbeMode.x1
? this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.value.toString()
: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.x10value.toString())
+ this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.unit.toString() + "/div"}
</label>
<button
className="PlusButton"
onClick={() => this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Course ? this.incrementTimePerDivision() : this.incrementTimePerDivisionFine()}>
onClick={() => this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Course ? this.incrementTimePerDivision() : this.incrementTimePerDivisionFine()}>
+
</button>
</div>
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode == ControlMode.Fine &&
{this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Fine &&
<div className="FineModeUnitButtons">
<button
className="NanoVoltButtonVertical"
onClick={() => this.changeDivisionUnit(VoltageUnit.NanoVolt)}>
<label
className={"MicroVoltButtonText"}
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineUnit == VoltageUnit.NanoVolt? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.unit === VoltageUnit.NanoVolt? "bold" : "normal"}}>
{VoltageUnit.NanoVolt}
</label>
</button>
@ -183,7 +182,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeDivisionUnit(VoltageUnit.MicroVolt)}>
<label
className={"MicroVoltButtonText"}
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineUnit == VoltageUnit.MicroVolt? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.unit === VoltageUnit.MicroVolt? "bold" : "normal"}}>
{VoltageUnit.MicroVolt}
</label>
</button>
@ -192,7 +191,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeDivisionUnit(VoltageUnit.MilliVolt)}>
<label
className={"MilliVoltButtonText"}
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineUnit == VoltageUnit.MilliVolt ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.unit === VoltageUnit.MilliVolt ? "bold" : "normal"}}>
{VoltageUnit.MilliVolt}
</label>
</button>
@ -201,7 +200,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeDivisionUnit(VoltageUnit.Volt)}>
<label
className={"VoltButtonText"}
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fineUnit == VoltageUnit.Volt ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].fine.unit === VoltageUnit.Volt ? "bold" : "normal"}}>
{VoltageUnit.Volt}
</label>
</button>
@ -221,7 +220,8 @@ class VerticalWidget extends React.Component<any, any> {
className="AdjustValueBlockVerticalOffset"
style={{color: this.props.verticalWidget.channelColorsList[this.props.verticalWidget.activeChannel-1]}}
>
{this.props.verticalWidget.verticalOffset[this.props.verticalWidget.activeChannel-1].value}{"mV"}
{this.props.verticalWidget.verticalOffset[this.props.verticalWidget.activeChannel-1].value}
{this.props.verticalWidget.verticalOffset[this.props.verticalWidget.activeChannel-1].unit}
</label>
<button
className="PlusButton"
@ -239,7 +239,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeCouplingMode(MeasurementType.AC)}>
<label
className="AC-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].coupling == MeasurementType.AC ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].coupling === MeasurementType.AC ? "bold" : "normal"}}>
{MeasurementType.AC}
</label>
</button>
@ -248,7 +248,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeCouplingMode(MeasurementType.DC)}>
<label
className="DC-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].coupling == MeasurementType.DC ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].coupling === MeasurementType.DC ? "bold" : "normal"}}>
{MeasurementType.DC}
</label>
</button>
@ -263,7 +263,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeProbeMode(ProbeMode.x1)}>
<label
className="x1-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode == ProbeMode.x1 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode === ProbeMode.x1 ? "bold" : "normal"}}>
x1
</label>
</button>
@ -272,7 +272,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeProbeMode(ProbeMode.x10)}>
<label
className="x10-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode == ProbeMode.x10 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].probeMode === ProbeMode.x10 ? "bold" : "normal"}}>
x10
</label>
</button>
@ -287,7 +287,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeBandwidth(20)}>
<label
className="20MHz-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth == 20 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth === 20 ? "bold" : "normal"}}>
20MHz
</label>
</button>
@ -296,7 +296,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => this.changeBandwidth(100)}>
<label
className="100MHz-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth == 100 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth === 100 ? "bold" : "normal"}}>
100MHz
</label>
</button>
@ -305,7 +305,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => (this.props.verticalWidget.totalChannelsUsed <= 2) && this.changeBandwidth(200)}>
<label
className="200MHz-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth == 200 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth === 200 ? "bold" : "normal"}}>
200MHz
</label>
</button>
@ -314,7 +314,7 @@ class VerticalWidget extends React.Component<any, any> {
onClick={() => (this.props.verticalWidget.totalChannelsUsed <= 1) && this.changeBandwidth(350)}>
<label
className="350MHz-ButtonText"
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth == 350 ? "bold" : "normal"}}>
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].bandwidth === 350 ? "bold" : "normal"}}>
350MHz
</label>
</button>

View File

@ -1,74 +1,250 @@
import VoltageUnit from './enums/voltageUnit';
import TimeUnit from './enums/timeUnit';
const x1ProbeValues = [
"10V/div",
"5V/div",
"2V/div",
"1V/div",
"500mV/div",
"200mV/div",
"100mV/div",
"50mV/div",
"20mV/div",
"10mV/div",
"5mV/div",
"2mV/div",
"1mV/div"
{
value: 10,
unit: VoltageUnit.Volt
},
{
value: 5,
unit: VoltageUnit.Volt
},
{
value: 2,
unit: VoltageUnit.Volt
},
{
value: 1,
unit: VoltageUnit.Volt
},
{
value: 500,
unit: VoltageUnit.MilliVolt
},
{
value: 200,
unit: VoltageUnit.MilliVolt
},
{
value: 100,
unit: VoltageUnit.MilliVolt
},
{
value: 50,
unit: VoltageUnit.MilliVolt
},
{
value: 20,
unit: VoltageUnit.MilliVolt
},
{
value: 10,
unit: VoltageUnit.MilliVolt
},
{
value: 5,
unit: VoltageUnit.MilliVolt
},
{
value: 2,
unit: VoltageUnit.MilliVolt
},
{
value: 1,
unit: VoltageUnit.MilliVolt
}
];
const x10ProbeValues = [
"100V/div",
"50V/div",
"20V/div",
"10V/div",
"5V/div",
"2V/div",
"1V/div",
"500mV/div",
"200mV/div",
"100mV/div",
"50mV/div",
"20mV/div",
"10mV/div"
{
value: 100,
unit: VoltageUnit.Volt
},
{
value: 50,
unit: VoltageUnit.Volt
},
{
value: 20,
unit: VoltageUnit.Volt
},
{
value: 10,
unit: VoltageUnit.Volt
},
{
value: 5,
unit: VoltageUnit.Volt
},
{
value: 2,
unit: VoltageUnit.Volt
},
{
value: 1,
unit: VoltageUnit.Volt
},
{
value: 500,
unit: VoltageUnit.MilliVolt
},
{
value: 200,
unit: VoltageUnit.MilliVolt
},
{
value: 100,
unit: VoltageUnit.MilliVolt
},
{
value: 50,
unit: VoltageUnit.MilliVolt
},
{
value: 20,
unit: VoltageUnit.MilliVolt
},
{
value: 10,
unit: VoltageUnit.MilliVolt
}
];
// 13 different voltages per divison presets
// Start at x1ProbeValues[6] and change accordingly
const horizontalTimeBases = [
"1ns/div",
"2ns/div",
"5ns/div",
"10ns/div",
"20ns/div",
"50ns/div",
"100ns/div",
"200ns/div",
"500ns/div",
"1µs/div",
"2µs/div",
"5µs/div",
"10µs/div",
"20µs/div",
"50µs/div",
"100µs/div",
"200µs/div",
"500µs/div",
"1ms/div",
"2ms/div",
"5ms/div",
"10ms/div",
"20ms/div",
"50ms/div",
"100ms/div",
"200ms/div",
"500ms/div",
"1s/div",
"2s/div",
"5s/div",
"10s/div"
{
value: 1,
unit: TimeUnit.NanoSecond
},
{
value: 2,
unit: TimeUnit.NanoSecond
},
{
value: 5,
unit: TimeUnit.NanoSecond
},
{
value: 10,
unit: TimeUnit.NanoSecond
},
{
value: 20,
unit: TimeUnit.NanoSecond
},
{
value: 50,
unit: TimeUnit.NanoSecond
},
{
value: 100,
unit: TimeUnit.NanoSecond
},
{
value: 200,
unit: TimeUnit.NanoSecond
},
{
value: 500,
unit: TimeUnit.NanoSecond
},
{
value: 1,
unit: TimeUnit.MicroSecond
},
{
value: 2,
unit: TimeUnit.MicroSecond
},
{
value: 5,
unit: TimeUnit.MicroSecond
},
{
value: 10,
unit: TimeUnit.MicroSecond
},
{
value: 20,
unit: TimeUnit.MicroSecond
},
{
value: 50,
unit: TimeUnit.MicroSecond
},
{
value: 100,
unit: TimeUnit.MicroSecond
},
{
value: 200,
unit: TimeUnit.MicroSecond
},
{
value: 500,
unit: TimeUnit.MicroSecond
},
{
value: 1,
unit: TimeUnit.MilliSecond
},
{
value: 2,
unit: TimeUnit.MilliSecond
},
{
value: 5,
unit: TimeUnit.MilliSecond
},
{
value: 10,
unit: TimeUnit.MilliSecond
},
{
value: 20,
unit: TimeUnit.MilliSecond
},
{
value: 50,
unit: TimeUnit.MilliSecond
},
{
value: 100,
unit: TimeUnit.MilliSecond
},
{
value: 200,
unit: TimeUnit.MilliSecond
},
{
value: 500,
unit: TimeUnit.MilliSecond
},
{
value: 1,
unit: TimeUnit.Second
},
{
value: 2,
unit: TimeUnit.Second
},
{
value: 5,
unit: TimeUnit.Second
},
{
value: 10,
unit: TimeUnit.Second
}
];
// 31 different voltages per division presets
// Start at horizontalTimeBases[15] and change accordingly
export default {
x1ProbeValues,
x1ProbeValues,
x10ProbeValues,
horizontalTimeBases
};

View File

@ -0,0 +1,6 @@
enum MathType {
Max = "Max",
Min = "Min"
}
export default MathType;

View File

@ -2,26 +2,27 @@
user-select: none;
}
.MeasurementsWidgetDisplayValueBlock-Value2 {
.MeasurementsWidget-Min {
margin-top: 1vh;
margin-bottom: 1vh;
}
.DisplayValueBlockLeftValue1 {
.DisplayValue-MaxLabel {
padding-left: 2vw;
float: left;
}
.DisplayValueBlockLeftValue2 {
padding-left: 2vw;
float: left;
}
.DisplayValueBlockRightValue1 {
.DisplayValue-MaxValue {
padding-right: 2vw;
float: right;
}
.DisplayValueBlockRightValue2 {
.DisplayValue-MinLabel {
padding-left: 2vw;
float: left;
}
.DisplayValue-MinValue {
padding-right: 2vw;
float: right;
}

View File

@ -0,0 +1,24 @@
import DefaultValues from '../../configuration/defaultValues';
import TimeUnit from '../../configuration/enums/timeUnit';
import ControlMode from '../../configuration/enums/controlMode';
const HorizontalWidgetInitialState = {
horizontalTimeBase: {
mode: ControlMode.Course,
index: 15,
course: {
value: DefaultValues.horizontalTimeBases[15].value,
unit: DefaultValues.horizontalTimeBases[15].unit
},
fine: {
value: 0,
unit: TimeUnit.MicroSecond
}
},
horizontalOffset: {
value: 0,
unit: TimeUnit.MicroSecond
}
};
export default HorizontalWidgetInitialState;

View File

@ -0,0 +1,20 @@
import MathType from '../../configuration/enums/mathType';
import TimeUnit from '../../configuration/enums/timeUnit';
import VoltageUnit from '../../configuration/enums/voltageUnit';
const MeasurementsWidgetInitialState = {
measurement: [
{
mathType: MathType.Max,
value: 500,
unit: TimeUnit.NanoSecond
},
{
mathType: MathType.Min,
value: 300,
unit: VoltageUnit.MilliVolt
}
]
};
export default MeasurementsWidgetInitialState;

View File

@ -0,0 +1,39 @@
import TriggerType from '../../configuration/enums/triggerType';
import DefaultChannelColor from '../../configuration/enums/defaultChannelColor';
import VoltageUnit from '../../configuration/enums/voltageUnit';
const TriggerWidgetInitialState = {
triggerChannel: 1,
channelColorsList: [
DefaultChannelColor.Channel1,
DefaultChannelColor.Channel2,
DefaultChannelColor.Channel3,
DefaultChannelColor.Channel4
],
triggerType: [
TriggerType.RisingEdge,
TriggerType.RisingEdge,
TriggerType.RisingEdge,
TriggerType.RisingEdge
],
triggerLevel: [
{
value: 0.0,
unit: VoltageUnit.MilliVolt
},
{
value: 0.0,
unit: VoltageUnit.MilliVolt
},
{
value: 0.0,
unit: VoltageUnit.MilliVolt
},
{
value: 0.0,
unit: VoltageUnit.MilliVolt
}
]
};
export default TriggerWidgetInitialState;

View File

@ -0,0 +1,117 @@
import DefaultChannelColor from '../../configuration/enums/defaultChannelColor';
import MeasurementType from '../../configuration/enums/measurementType';
import VoltageUnit from '../../configuration/enums/voltageUnit';
import ControlMode from '../../configuration/enums/controlMode';
import ProbeMode from '../../configuration/enums/probeMode';
import DefaultValues from '../../configuration/defaultValues';
const VerticalWidgetInitialState = {
activeChannel: 1,
totalChannelsUsed: 4,
channelColorsList: [
DefaultChannelColor.Channel1,
DefaultChannelColor.Channel2,
DefaultChannelColor.Channel3,
DefaultChannelColor.Channel4
],
timePerDivision: [
{
course: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
fine: {
value: 0,
x10value: 0,
unit: VoltageUnit.MilliVolt
},
index: 6
},
{
course: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
fine: {
value: 0,
x10value: 0,
unit: VoltageUnit.MilliVolt
},
index: 6
},
{
course: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
fine: {
value: 0,
x10value: 0,
unit: VoltageUnit.MilliVolt
},
index: 6
},
{
course: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
fine: {
value: 0,
x10value: 0,
unit: VoltageUnit.MilliVolt
},
index: 6
}
],
settings: [
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
}
],
verticalOffset: [
{
value: 0,
unit: VoltageUnit.MilliVolt
},
{
value: 0,
unit: VoltageUnit.MilliVolt
},
{
value: 0,
unit: VoltageUnit.MilliVolt
},
{
value: 0,
unit: VoltageUnit.MilliVolt
}
]
};
export default VerticalWidgetInitialState;

View File

@ -1,24 +1,8 @@
import DefaultValues from '../../../configuration/defaultValues';
import TimeUnit from '../../../configuration/enums/timeUnit';
import ControlMode from '../../../configuration/enums/controlMode';
import HorizontalWidgetInitialState from '../../initialStates/horizontalWidgetInitialState';
const initialState = {
horizontalTimeBase: {
mode: ControlMode.Course,
value: DefaultValues.horizontalTimeBases[15],
index: 15,
fineValue: 0,
fineUnit: TimeUnit.MicroSecond
},
horizontalOffset: {
value: 0,
unit: TimeUnit.MilliSecond
}
};
export default function(state = initialState, action: {type: any, payload: any}) {
var tmp;
export default function(state = HorizontalWidgetInitialState, action: {type: any, payload: any}) {
switch(action.type) {
case "horizontal/changeTimeBaseMode":
return {
@ -26,6 +10,10 @@ export default function(state = initialState, action: {type: any, payload: any})
horizontalTimeBase: {
...state.horizontalTimeBase,
mode: action.payload
},
horizontalOffset: {
...state.horizontalOffset,
unit: action.payload === ControlMode.Fine ? state.horizontalTimeBase.fine.unit : state.horizontalTimeBase.course.unit
}
}
case "horizontal/changeTimeBaseUnit":
@ -33,7 +21,14 @@ export default function(state = initialState, action: {type: any, payload: any})
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
fineUnit: action.payload
fine: {
...state.horizontalTimeBase.fine,
unit: action.payload
}
},
horizontalOffset: {
...state.horizontalOffset,
unit: action.payload
}
}
case "horizontal/increaseTimeBase":
@ -44,8 +39,15 @@ export default function(state = initialState, action: {type: any, payload: any})
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1],
course: {
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1].value,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1].unit
},
index: state.horizontalTimeBase.index + 1
},
horizontalOffset: {
...state.horizontalOffset,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1].unit
}
}
case "horizontal/decreaseTimeBase":
@ -56,8 +58,15 @@ export default function(state = initialState, action: {type: any, payload: any})
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1],
course: {
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1].value,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1].unit
},
index: state.horizontalTimeBase.index - 1
},
horizontalOffset: {
...state.horizontalOffset,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1].unit
}
}
case "horizontal/increaseTimeBaseFine":
@ -65,7 +74,10 @@ export default function(state = initialState, action: {type: any, payload: any})
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
fineValue: Number((state.horizontalTimeBase.fineValue + 0.1).toFixed(1))
fine: {
...state.horizontalTimeBase.fine,
value: Number((state.horizontalTimeBase.fine.value + 0.1).toFixed(1))
}
}
};
case "horizontal/decreaseTimeBaseFine":
@ -73,7 +85,10 @@ export default function(state = initialState, action: {type: any, payload: any})
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
fineValue: Number((state.horizontalTimeBase.fineValue - 0.1).toFixed(1))
fine: {
...state.horizontalTimeBase.fine,
value: Number((state.horizontalTimeBase.fine.value - 0.1).toFixed(1))
}
}
};
case "horizontal/increaseOffset":

View File

@ -1,11 +1,6 @@
const initialState = {
leftValue1: "X1->X2",
rightValue1: "500ns",
leftValue2: "Y1->Y2",
rightValue2: "300mV"
};
import MeasurementsWidgetInitialState from '../../initialStates/measurementsWidgetInitialState';
export default function(state = initialState, action: {type: any, payload: any}) {
export default function(state = MeasurementsWidgetInitialState, action: {type: any, payload: any}) {
switch(action.type) {
default:
return state;

View File

@ -1,30 +1,6 @@
import TriggerType from '../../../configuration/enums/triggerType';
import DefaultChannelColor from '../../../configuration/enums/defaultChannelColor';
import VoltageUnit from '../../../configuration/enums/voltageUnit';
import TriggerWidgetInitialState from '../../initialStates/triggerWidgetInitialState';
const initialState = {
triggerChannel: 1,
channelColorsList: [
DefaultChannelColor.Channel1,
DefaultChannelColor.Channel2,
DefaultChannelColor.Channel3,
DefaultChannelColor.Channel4
],
triggerType: [
TriggerType.RisingEdge,
TriggerType.RisingEdge,
TriggerType.RisingEdge,
TriggerType.RisingEdge
],
triggerLevel: [
{value: 0.0, unit: VoltageUnit.MilliVolt},
{value: 0.0, unit: VoltageUnit.MilliVolt},
{value: 0.0, unit: VoltageUnit.MilliVolt},
{value: 0.0, unit: VoltageUnit.MilliVolt}
]
};
export default function(state = initialState, action: {type: any, payload: any}) {
export default function(state = TriggerWidgetInitialState, action: {type: any, payload: any}) {
var channelIndex = state.triggerChannel - 1;
var tmp;

View File

@ -1,91 +1,27 @@
import DefaultValues from '../../../configuration/defaultValues';
import DefaultChannelColor from '../../../configuration/enums/defaultChannelColor';
import MeasurementType from '../../../configuration/enums/measurementType';
import VoltageUnit from '../../../configuration/enums/voltageUnit';
import ControlMode from '../../../configuration/enums/controlMode';
import ProbeMode from '../../../configuration/enums/probeMode';
import DefaultValues from '../../../configuration/defaultValues';
import VerticalWidgetInitialState from '../../initialStates/verticalWidgetInitialState';
const initialState = {
activeChannel: 1,
totalChannelsUsed: 1,
channelColorsList: [
DefaultChannelColor.Channel1,
DefaultChannelColor.Channel2,
DefaultChannelColor.Channel3,
DefaultChannelColor.Channel4
],
timePerDivision: [
{
fineValue: 0,
fineUnit: VoltageUnit.MilliVolt,
index: 6
},
{
fineValue: 0,
fineUnit: VoltageUnit.MilliVolt,
index: 6
},
{
fineValue: 0,
fineUnit: VoltageUnit.MilliVolt,
index: 6
},
{
fineValue: 0,
fineUnit: VoltageUnit.MilliVolt,
index: 6
}
],
settings: [
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 0
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 0
},
{
controlMode: ControlMode.Course,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 0
}
],
verticalOffset: [
{value: 0, unit: VoltageUnit.MilliVolt},
{value: 0, unit: VoltageUnit.MilliVolt},
{value: 0, unit: VoltageUnit.MilliVolt},
{value: 0, unit: VoltageUnit.MilliVolt}
]
};
export default function(state = initialState, action: {type: any, payload: any}) {
export default function(state = VerticalWidgetInitialState, action: {type: any, payload: any}) {
var channelIndex = state.activeChannel - 1;
var tmp;
var tmp2;
var tmp3;
switch(action.type) {
case "vertical/changeControlMode":
tmp = state.settings;
tmp[channelIndex].controlMode = action.payload;
tmp2 = state.verticalOffset;
tmp2[channelIndex].unit = action.payload === ControlMode.Fine ? state.timePerDivision[channelIndex].fine.unit : state.timePerDivision[channelIndex].course.unit;
return {
...state,
settings: tmp
settings: tmp,
verticalOffset: tmp2
};
case "vertical/changeChannel":
return {
@ -95,10 +31,15 @@ export default function(state = initialState, action: {type: any, payload: any})
case "vertical/changeDivisionUnit":
tmp = state.timePerDivision;
tmp[channelIndex].fineUnit = action.payload;
tmp[channelIndex].fine.unit = action.payload;
tmp2 = state.verticalOffset;
tmp2[channelIndex].unit = action.payload;
return {
...state,
timePerDivision: tmp
timePerDivision: tmp,
verticalOffset: tmp2
};
case "vertical/changeCouplingMode":
tmp = state.settings;
@ -112,9 +53,24 @@ export default function(state = initialState, action: {type: any, payload: any})
tmp = state.settings;
tmp[channelIndex].probeMode = action.payload;
tmp2 = state.timePerDivision;
tmp2[channelIndex].course.value = action.payload === ProbeMode.x1
? DefaultValues.x1ProbeValues[state.timePerDivision[channelIndex].index].value
: DefaultValues.x10ProbeValues[state.timePerDivision[channelIndex].index].value;
tmp2[channelIndex].course.unit = action.payload === ProbeMode.x1
? DefaultValues.x1ProbeValues[state.timePerDivision[channelIndex].index].unit
: DefaultValues.x10ProbeValues[state.timePerDivision[channelIndex].index].unit;
tmp3 = state.verticalOffset;
tmp3[channelIndex].unit = tmp2[channelIndex].course.unit;
return {
...state,
settings: tmp
settings: tmp,
timePerDivision: tmp2,
verticalOffset: tmp3
};
case "vertical/changeBandwidth":
tmp = state.settings;
@ -128,7 +84,7 @@ export default function(state = initialState, action: {type: any, payload: any})
tmp = state.settings;
var newTotalChannelsUsed = state.totalChannelsUsed;
if (tmp[action.payload].status == 0) {
if (tmp[action.payload].status === 0) {
tmp[action.payload].status = 1;
newTotalChannelsUsed++;
}
@ -164,9 +120,20 @@ export default function(state = initialState, action: {type: any, payload: any})
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index - 1;
tmp[channelIndex].course.value = state.settings[channelIndex].probeMode === ProbeMode.x1
? DefaultValues.x1ProbeValues[tmp[channelIndex].index].value
: DefaultValues.x10ProbeValues[tmp[channelIndex].index].value;
tmp[channelIndex].course.unit = state.settings[channelIndex].probeMode === ProbeMode.x1
? DefaultValues.x1ProbeValues[tmp[channelIndex].index].unit
: DefaultValues.x10ProbeValues[tmp[channelIndex].index].unit;
tmp2 = state.verticalOffset;
tmp2[channelIndex].unit = tmp[channelIndex].course.unit;
return {
...state,
timePerDivision: tmp
timePerDivision: tmp,
verticalOffset: tmp2
}
case "vertical/decreaseTimePerDivision":
if (state.timePerDivision[state.activeChannel - 1].index >= 12) {
@ -175,14 +142,26 @@ export default function(state = initialState, action: {type: any, payload: any})
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index + 1;
tmp[channelIndex].course.value = state.settings[channelIndex].probeMode === ProbeMode.x1
? DefaultValues.x1ProbeValues[tmp[channelIndex].index].value
: DefaultValues.x10ProbeValues[tmp[channelIndex].index].value;
tmp[channelIndex].course.unit = state.settings[channelIndex].probeMode === ProbeMode.x1
? DefaultValues.x1ProbeValues[tmp[channelIndex].index].unit
: DefaultValues.x10ProbeValues[tmp[channelIndex].index].unit;
tmp2 = state.verticalOffset;
tmp2[channelIndex].unit = tmp[channelIndex].course.unit;
return {
...state,
timePerDivision: tmp
timePerDivision: tmp,
verticalOffset: tmp2
}
case "vertical/increaseTimePerDivisionFine":
tmp = state.timePerDivision;
tmp[channelIndex].fineValue = Number((state.timePerDivision[channelIndex].fineValue + 0.1).toFixed(1));
tmp[channelIndex].fine.value = Number((state.timePerDivision[channelIndex].fine.value + 0.1).toFixed(1));
tmp[channelIndex].fine.x10value = Number((tmp[channelIndex].fine.value*10).toFixed(1));
return {
...state,
timePerDivision: tmp
@ -190,7 +169,8 @@ export default function(state = initialState, action: {type: any, payload: any})
case "vertical/decreaseTimePerDivisionFine":
tmp = state.timePerDivision;
tmp[channelIndex].fineValue = Number((state.timePerDivision[channelIndex].fineValue - 0.1).toFixed(1));
tmp[channelIndex].fine.value = Number((state.timePerDivision[channelIndex].fine.value - 0.1).toFixed(1));
tmp[channelIndex].fine.x10value = Number((tmp[channelIndex].fine.value*10).toFixed(1));
return {
...state,
timePerDivision: tmp