7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-04-08 06:25:30 +00:00

Merge pull request from EEVengers/features/ux-cleanup

Features/ux cleanup
This commit is contained in:
Jason Bonnell 2021-03-25 15:04:00 -04:00 committed by GitHub
commit 713ef14026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 97 additions and 94 deletions

View File

@ -11,9 +11,9 @@ 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.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.Coarse
&& this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].coarse.value.toString()
+ this.props.verticalWidget.timePerDivision[this.props.channelNumber-1].coarse.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()

View File

@ -7,8 +7,8 @@ class TimePerDivision extends React.Component<any, any> {
render() {
return(
<div className="TimePerDivisionComponent">
{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.Coarse && this.props.horizontalWidget.horizontalTimeBase.coarse.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Coarse && this.props.horizontalWidget.horizontalTimeBase.coarse.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

@ -42,7 +42,7 @@ class Graph extends React.Component<any, any> {
}
render() {
let base = this.props.horizontalWidget.horizontalTimeBase.course;
let base = this.props.horizontalWidget.horizontalTimeBase.coarse;
let dCount = DefaultValues.divisions.time;
let winSize = dCount * convertTime(base.value, base.unit, TimeUnit.NanoSecond);
let yTicks = [-128, -96, -64, -32, 0, 32, 64, 96, 128]

View File

@ -60,12 +60,12 @@ class HorizontalWidget extends React.Component<any, any> {
<div className="TimeBaseMode">
<button
className="CourseControlButton"
onClick={() => this.changeTimeBaseMode(ControlMode.Course)}>
className="CoarseControlButton"
onClick={() => this.changeTimeBaseMode(ControlMode.Coarse)}>
<label
className=""
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Course ? "bold" : "normal"}}>
Course
style={{fontWeight: this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Coarse ? "bold" : "normal"}}>
Coarse
</label>
</button>
<button
@ -82,21 +82,21 @@ 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.Coarse ? this.decrementTimeBase() : this.decrementTimeBaseFine()}>
-
</button>
<label
className="AdjustValueBlockHorizontalTimeBase"
style={{color: "white"}}
>
{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.Coarse && this.props.horizontalWidget.horizontalTimeBase.coarse.value.toString()}
{this.props.horizontalWidget.horizontalTimeBase.mode === ControlMode.Coarse && this.props.horizontalWidget.horizontalTimeBase.coarse.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.Coarse ? this.incrementTimeBase() : this.incrementTimeBaseFine()}>
+
</button>
</div>

View File

@ -17,18 +17,18 @@ class TriggerWidget extends React.Component<any, any> {
changeChannel1 = (channelNumber: number) => {
let w = this.props.mathWidget;
if(w.channel2 != channelNumber) {
if(w.channel2 !== channelNumber) {
Plumber.getInstance().handleMath(w.mathEnabled, channelNumber, w.channel2, w.mathOperator);
this.props.dispatch({type: 'math/changeChannel1', payload: channelNumber });
}
this.props.dispatch({type: 'math/changeChannel1', payload: channelNumber });
}
changeChannel2 = (channelNumber: number) => {
let w = this.props.mathWidget;
if(w.channel1 != channelNumber) {
if(w.channel1 !== channelNumber) {
Plumber.getInstance().handleMath(w.mathEnabled, w.channel1, channelNumber, w.mathOperator);
this.props.dispatch({type: 'math/changeChannel2', payload: channelNumber });
}
this.props.dispatch({type: 'math/changeChannel2', payload: channelNumber });
}
changeOperator = (operator: MathOperators) => {

View File

@ -31,7 +31,7 @@ class MeasurementsWidget extends React.Component<any, any> {
//TODO: unit analysis
let channels = this.props.measurementsWidget.displayChannel as boolean[];
let channelNum = channels.map(v => v ? 1 : 0) as number[];
if(channelNum.reduce((a, b) => a + b) == 0) {
if(channelNum.reduce((a, b) => a + b) === 0) {
return; //Don't bother C if we don't need to.
}
let maxArgs: PlumberArgs = {
@ -129,8 +129,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel1-MaxValue"
style={{color: this.props.settings.colors.channel[0]}}>
{this.props.measurementsWidget.max[0].value}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[0].course.unit.toString()}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[0].coarse.unit.toString()}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[0].fine.unit.toString()}
</label>
@ -144,8 +144,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel1-MinValue"
style={{color: this.props.settings.colors.channel[0]}}>
{this.props.measurementsWidget.min[0].value}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[0].course.unit.toString()}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[0].coarse.unit.toString()}
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[0].fine.unit.toString()}
</label>
@ -169,8 +169,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel2-MaxValue"
style={{color: this.props.settings.colors.channel[1]}}>
{this.props.measurementsWidget.max[1].value}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[1].course.unit.toString()}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[1].coarse.unit.toString()}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[1].fine.unit.toString()}
</label>
@ -184,8 +184,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel2-MinValue"
style={{color: this.props.settings.colors.channel[1]}}>
{this.props.measurementsWidget.min[1].value}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[1].course.unit.toString()}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[1].coarse.unit.toString()}
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[1].fine.unit.toString()}
</label>
@ -209,8 +209,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel3-MaxValue"
style={{color: this.props.settings.colors.channel[2]}}>
{this.props.measurementsWidget.max[2].value}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[2].course.unit.toString()}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[2].coarse.unit.toString()}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[2].fine.unit.toString()}
</label>
@ -224,8 +224,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel3-MinValue"
style={{color: this.props.settings.colors.channel[2]}}>
{this.props.measurementsWidget.min[2].value}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[2].course.unit.toString()}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[2].coarse.unit.toString()}
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[2].fine.unit.toString()}
</label>
@ -249,8 +249,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel4-MaxValue"
style={{color: this.props.settings.colors.channel[3]}}>
{this.props.measurementsWidget.max[3].value}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[3].course.unit.toString()}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[3].coarse.unit.toString()}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[3].fine.unit.toString()}
</label>
@ -264,8 +264,8 @@ class MeasurementsWidget extends React.Component<any, any> {
className="Channel4-MinValue"
style={{color: this.props.settings.colors.channel[3]}}>
{this.props.measurementsWidget.min[3].value}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Course
&& this.props.verticalWidget.timePerDivision[3].course.unit.toString()}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Coarse
&& this.props.verticalWidget.timePerDivision[3].coarse.unit.toString()}
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Fine
&& + this.props.verticalWidget.timePerDivision[3].fine.unit.toString()}
</label>

View File

@ -22,15 +22,16 @@ class TriggerWidget extends React.Component<any, any> {
changeChannel = (channelNumber: number) => {
let chStatus = (this.props.verticalWidget.settings as any[]).map(x => x.status > 0);
let setChState = setChHelper(chStatus[0], chStatus[1], chStatus[2], chStatus[3], channelNumber);
Plumber.getInstance().handleSetchState(setChState);
Plumber.getInstance().handleSetChState(setChState);
this.props.dispatch({type: 'vertical/setChannelOrder', payload: setChState.chOrder});
this.props.dispatch({type: 'trigger/changeChannel', payload: channelNumber});
this.props.dispatch({type: 'vertical/changeChannelStatus', payload: channelNumber});
// this.props.dispatch({type: 'vertical/changeChannelStatus', payload: channelNumber - 1});
// This was making it so that clicking on Trigger will activate that channel in the UX. We do not want the UX to show this, only the backend needs to know.
}
// Trigger Type
changeTriggerType = (triggerType: TriggerType) => {
let edgeNum = (triggerType == TriggerType.RisingEdge) ? 1 : 2;
let edgeNum = (triggerType === TriggerType.RisingEdge) ? 1 : 2;
let args: PlumberArgs = {
headCheck: () => true,
bodyCheck: () => true,

View File

@ -58,7 +58,7 @@ class VerticalWidget extends React.Component<any, any> {
chStatus[channelNumber] = !chStatus[channelNumber];
let triggerCh = this.props.triggerWidget.triggerChannel;
let setChState = setChHelper(chStatus[0], chStatus[1], chStatus[2], chStatus[3], triggerCh);
Plumber.getInstance().handleSetchState(setChState);
Plumber.getInstance().handleSetChState(setChState);
this.props.dispatch({type: 'vertical/setChannelOrder', payload: setChState.chOrder})
this.props.dispatch({type: 'trigger/changeChannel', payload: triggerCh});
this.props.dispatch({type: 'vertical/changeChannelStatus', payload: channelNumber});
@ -132,12 +132,12 @@ class VerticalWidget extends React.Component<any, any> {
</div>
<div className="DivisionMode">
<button
className="CourseControlButton"
onClick={() => this.changeControlMode(ControlMode.Course)}>
className="CoarseControlButton"
onClick={() => this.changeControlMode(ControlMode.Coarse)}>
<label
className=""
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Course ? "bold" : "normal"}}>
Course
style={{fontWeight: this.props.verticalWidget.settings[this.props.verticalWidget.activeChannel-1].controlMode === ControlMode.Coarse ? "bold" : "normal"}}>
Coarse
</label>
</button>
<button
@ -154,16 +154,16 @@ 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.Coarse ? this.decrementTimePerDivision() : this.decrementTimePerDivisionFine()}>
-
</button>
<label
className="AdjustValueBlockTimePerDivision"
style={{color: this.props.settings.colors.channel[this.props.verticalWidget.activeChannel-1]}}
>
{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.Coarse
&& this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].coarse.value.toString()
+ this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].coarse.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()
@ -172,7 +172,7 @@ class VerticalWidget extends React.Component<any, any> {
</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.Coarse ? this.incrementTimePerDivision() : this.incrementTimePerDivisionFine()}>
+
</button>
</div>

View File

@ -248,9 +248,11 @@ let divisions = {
time: 10
}
export default {
let DefaultValues = {
x1ProbeValues,
x10ProbeValues,
horizontalTimeBases,
divisions
};
}
export default DefaultValues;

View File

@ -1,5 +1,5 @@
enum ControlMode {
Course,
Coarse,
Fine
}

View File

@ -32,7 +32,7 @@
font-weight: bold;
}
.CourseControlButton {
.CoarseControlButton {
margin-right: 1vw;
margin-left: 1vw;
margin-bottom: 1vh;

View File

@ -71,7 +71,7 @@
font-weight: bold;
}
.CourseControlButton {
.CoarseControlButton {
margin-right: 1vw;
margin-left: 1vw;
margin-bottom: 1vh;

View File

@ -6,9 +6,9 @@ let index = 3; //originally 15
const HorizontalWidgetInitialState = {
horizontalTimeBase: {
mode: ControlMode.Course,
mode: ControlMode.Coarse,
index: index,
course: {
coarse: {
value: DefaultValues.horizontalTimeBases[index].value, //originally index 15
unit: DefaultValues.horizontalTimeBases[index].unit //originally index 15
},

View File

@ -9,7 +9,7 @@ const VerticalWidgetInitialState = {
totalChannelsUsed: 4,
timePerDivision: [
{
course: {
coarse: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
@ -21,7 +21,7 @@ const VerticalWidgetInitialState = {
index: 6
},
{
course: {
coarse: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
@ -33,7 +33,7 @@ const VerticalWidgetInitialState = {
index: 6
},
{
course: {
coarse: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
@ -45,7 +45,7 @@ const VerticalWidgetInitialState = {
index: 6
},
{
course: {
coarse: {
value: DefaultValues.x1ProbeValues[6].value,
unit: DefaultValues.x1ProbeValues[6].unit
},
@ -59,32 +59,32 @@ const VerticalWidgetInitialState = {
],
settings: [
{
controlMode: ControlMode.Course,
controlMode: ControlMode.Coarse,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
controlMode: ControlMode.Course,
controlMode: ControlMode.Coarse,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
status: 0
},
{
controlMode: ControlMode.Course,
controlMode: ControlMode.Coarse,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
status: 0
},
{
controlMode: ControlMode.Course,
controlMode: ControlMode.Coarse,
probeMode: ProbeMode.x1,
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
status: 0
},
{
status: 0

View File

@ -1,7 +1,7 @@
import GraphStatus from '../../configuration/enums/graphStatus';
import GraphInitialState from '../initialStates/graphInitialState';
export default function(state = GraphInitialState, action: {type: any, payload: any}) {
export default function GraphReducer(state = GraphInitialState, action: {type: any, payload: any}) {
switch(action.type) {
case "graph/changeStatus":
var newStatus = state.currentStatus === GraphStatus.On ? GraphStatus.Off : GraphStatus.On;

View File

@ -1,6 +1,6 @@
import SettingsInitialState from '../initialStates/settingsInitialState';
export default function(state = SettingsInitialState, action: {type: any, payload: any}) {
export default function SettingsReducer(state = SettingsInitialState, action: {type: any, payload: any}) {
switch(action.type) {
default:
return state;

View File

@ -2,7 +2,7 @@ import DefaultValues from '../../../configuration/defaultValues';
import ControlMode from '../../../configuration/enums/controlMode';
import HorizontalWidgetInitialState from '../../initialStates/horizontalWidgetInitialState';
export default function(state = HorizontalWidgetInitialState, action: {type: any, payload: any}) {
export default function HorizontalWidgetReducer(state = HorizontalWidgetInitialState, action: {type: any, payload: any}) {
switch(action.type) {
case "horizontal/changeTimeBaseMode":
return {
@ -13,7 +13,7 @@ export default function(state = HorizontalWidgetInitialState, action: {type: any
},
horizontalOffset: {
...state.horizontalOffset,
unit: action.payload === ControlMode.Fine ? state.horizontalTimeBase.fine.unit : state.horizontalTimeBase.course.unit
unit: action.payload === ControlMode.Fine ? state.horizontalTimeBase.fine.unit : state.horizontalTimeBase.coarse.unit
}
}
case "horizontal/changeTimeBaseUnit":
@ -39,7 +39,7 @@ export default function(state = HorizontalWidgetInitialState, action: {type: any
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
course: {
coarse: {
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1].value,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1].unit
},
@ -58,7 +58,7 @@ export default function(state = HorizontalWidgetInitialState, action: {type: any
...state,
horizontalTimeBase: {
...state.horizontalTimeBase,
course: {
coarse: {
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1].value,
unit: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1].unit
},

View File

@ -1,6 +1,6 @@
import MathWidgetInitialState from '../../initialStates/mathWidgetInitialState';
export default function(state = MathWidgetInitialState, action: {type: any, payload: any}) {
export default function MathWidgetReducer(state = MathWidgetInitialState, action: {type: any, payload: any}) {
switch(action.type) {
case "math/toggleMathMode":
return {

View File

@ -1,7 +1,7 @@
import MeasurementsWidgetInitialState from '../../initialStates/measurementsWidgetInitialState';
import { MaxMinResult } from '../../../util/plumber';
export default function(state = MeasurementsWidgetInitialState, action: {type: any, payload: any}) {
export default function MeasurementsWidgetReducer(state = MeasurementsWidgetInitialState, action: {type: any, payload: any}) {
var tmp;
switch(action.type) {

View File

@ -1,6 +1,6 @@
import TriggerWidgetInitialState from '../../initialStates/triggerWidgetInitialState';
export default function(state = TriggerWidgetInitialState, action: {type: any, payload: any}) {
export default function TriggerWidgetReducer(state = TriggerWidgetInitialState, action: {type: any, payload: any}) {
var channelIndex = state.triggerChannel - 1;
var tmp;

View File

@ -3,7 +3,7 @@ import ProbeMode from '../../../configuration/enums/probeMode';
import DefaultValues from '../../../configuration/defaultValues';
import VerticalWidgetInitialState from '../../initialStates/verticalWidgetInitialState';
export default function(state = VerticalWidgetInitialState, action: {type: any, payload: any}) {
export default function VerticalWidgetReducer(state = VerticalWidgetInitialState, action: {type: any, payload: any}) {
var channelIndex = state.activeChannel - 1;
var tmp;
var tmp2;
@ -17,7 +17,7 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
tmp2 = state.verticalOffset;
tmp2[channelIndex].unit = action.payload === ControlMode.Fine ? state.timePerDivision[channelIndex].fine.unit : state.timePerDivision[channelIndex].course.unit;
tmp2[channelIndex].unit = action.payload === ControlMode.Fine ? state.timePerDivision[channelIndex].fine.unit : state.timePerDivision[channelIndex].coarse.unit;
return {
...state,
settings: tmp,
@ -56,16 +56,16 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
tmp2 = state.timePerDivision;
tmp2[channelIndex].course.value = action.payload === ProbeMode.x1
tmp2[channelIndex].coarse.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
tmp2[channelIndex].coarse.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;
tmp3[channelIndex].unit = tmp2[channelIndex].coarse.unit;
return {
...state,
settings: tmp,
@ -120,16 +120,16 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index - 1;
tmp[channelIndex].course.value = state.settings[channelIndex].probeMode === ProbeMode.x1
tmp[channelIndex].coarse.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
tmp[channelIndex].coarse.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;
tmp2[channelIndex].unit = tmp[channelIndex].coarse.unit;
return {
...state,
timePerDivision: tmp,
@ -142,16 +142,16 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index + 1;
tmp[channelIndex].course.value = state.settings[channelIndex].probeMode === ProbeMode.x1
tmp[channelIndex].coarse.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
tmp[channelIndex].coarse.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;
tmp2[channelIndex].unit = tmp[channelIndex].coarse.unit;
return {
...state,
timePerDivision: tmp,

View File

@ -112,7 +112,7 @@ export class Plumber {
}
}
public handleSetchState(s: SetChState) {
public handleSetChState(s: SetChState) {
let setChArgs: PlumberArgs = {
headCheck: () => true,
bodyCheck: () => true,
@ -134,7 +134,7 @@ export class Plumber {
public handleMath(enable: boolean, lhsChan: number, rhsChan: number, op: MathOperators) {
var protcolOp = 0;
if(enable) {
protcolOp = (op == MathOperators.Addition) ? 1 : 2;
protcolOp = (op === MathOperators.Addition) ? 1 : 2;
}
let mathArgs: PlumberArgs = {
headCheck: () => true,

View File

@ -17,9 +17,9 @@ export function setChHelper(
let triggerChIdx = triggerCh - 1;
let quadChOrder = [1, 2, 3, 4];
var chOrder = quadChOrder.filter((a, i) => chList[i] || triggerChIdx == i);
var chOrder = quadChOrder.filter((a, i) => chList[i] || triggerChIdx === i);
var setCh = chOrder.length as setChMode;
if(setCh == 3) {
if(setCh === 3) {
chOrder = quadChOrder;
setCh = quadChOrder.length;
}

View File

@ -46,7 +46,7 @@ class TestPoints {
writeData: [74, 0]
}
let base = state.horizontalWidget.horizontalTimeBase.course;
let base = state.horizontalWidget.horizontalTimeBase.coarse;
let dCount = DefaultValues.divisions.time;
let xLimit = dCount * convertTime(base.value, base.unit, TimeUnit.NanoSecond);
this.setWinArgs = {
@ -70,7 +70,7 @@ class TestPoints {
update() {
if(this.setChDone && this.setFileDone && this.setWinDone) {
let state = store.getState();
let base = state.horizontalWidget.horizontalTimeBase.course;
let base = state.horizontalWidget.horizontalTimeBase.coarse;
let xLimit = convertTime(base.value, base.unit, TimeUnit.NanoSecond);
let doMath = state.mathWidget.mathEnabled as boolean;
let order = state.verticalWidget.getDataChannelOrder as number[];
@ -83,12 +83,12 @@ class TestPoints {
let xOffset = (this.lastX < xLimit) ? this.lastX : 0;
var cppChannel = 0;
for(var uiChannel = 0; uiChannel < this.getDataMaxCh; uiChannel++) {
let mathCh = (uiChannel == this.getDataMaxCh-1) && doMath;
let mathCh = (uiChannel === this.getDataMaxCh-1) && doMath;
let dataCh = order.includes(uiChannel + 1);
if(mathCh || dataCh) {
for(var i = 0; i < perChannel; i++) {
var x = xOffset + i;
if(x != 0 && !this.scope_data[uiChannel][x-1]) {
if(x !== 0 && !this.scope_data[uiChannel][x-1]) {
//Adding a channel while other channels in middle of screen
//causes an error.
break;