mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-14 23:59:19 +00:00
added support for x10 values in fine mode
This commit is contained in:
parent
fce7574cb6
commit
657c20bc93
Software/waveview/src
components
redux/reducers/widgets
@ -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';
|
||||
@ -13,13 +12,13 @@ class Channel extends React.Component<any, any> {
|
||||
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.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},
|
||||
|
@ -137,7 +137,7 @@ class HorizontalWidget extends React.Component<any, any> {
|
||||
|
||||
|
||||
<div className="HorizontalOffsetTitle">
|
||||
Horizontal Offset
|
||||
Offset
|
||||
</div>
|
||||
<div className="HorizontalWidgetAdjustBlock-HorizontalOffset">
|
||||
<button
|
||||
|
@ -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';
|
||||
@ -152,13 +151,13 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
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.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"
|
||||
@ -174,7 +173,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
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"
|
||||
|
@ -1,9 +1,9 @@
|
||||
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';
|
||||
|
||||
const initialState = {
|
||||
activeChannel: 1,
|
||||
@ -16,23 +16,51 @@ const initialState = {
|
||||
],
|
||||
timePerDivision: [
|
||||
{
|
||||
fineValue: 0,
|
||||
fineUnit: VoltageUnit.MilliVolt,
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
fineValue: 0,
|
||||
fineUnit: VoltageUnit.MilliVolt,
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
fineValue: 0,
|
||||
fineUnit: VoltageUnit.MilliVolt,
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
fineValue: 0,
|
||||
fineUnit: VoltageUnit.MilliVolt,
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
}
|
||||
],
|
||||
@ -77,15 +105,22 @@ const initialState = {
|
||||
export default function(state = initialState, 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 +130,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 +152,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_New[state.timePerDivision[channelIndex].index].value
|
||||
: DefaultValues.x10ProbeValues_New[state.timePerDivision[channelIndex].index].value;
|
||||
tmp2[channelIndex].course.unit = action.payload == ProbeMode.x1
|
||||
? DefaultValues.x1ProbeValues_New[state.timePerDivision[channelIndex].index].unit
|
||||
: DefaultValues.x10ProbeValues_New[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;
|
||||
@ -164,9 +219,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_New[tmp[channelIndex].index].value
|
||||
: DefaultValues.x10ProbeValues_New[tmp[channelIndex].index].value;
|
||||
tmp[channelIndex].course.unit = state.settings[channelIndex].probeMode == ProbeMode.x1
|
||||
? DefaultValues.x1ProbeValues_New[tmp[channelIndex].index].unit
|
||||
: DefaultValues.x10ProbeValues_New[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 +241,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_New[tmp[channelIndex].index].value
|
||||
: DefaultValues.x10ProbeValues_New[tmp[channelIndex].index].value;
|
||||
tmp[channelIndex].course.unit = state.settings[channelIndex].probeMode == ProbeMode.x1
|
||||
? DefaultValues.x1ProbeValues_New[tmp[channelIndex].index].unit
|
||||
: DefaultValues.x10ProbeValues_New[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 +268,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
|
||||
|
Loading…
Reference in New Issue
Block a user