mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-08 06:25:30 +00:00
moved initial states to their own files
This commit is contained in:
parent
657c20bc93
commit
5f4fea33e6
@ -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_New[15].value,
|
||||
unit: DefaultValues.horizontalTimeBases_New[15].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
unit: TimeUnit.MicroSecond
|
||||
}
|
||||
},
|
||||
horizontalOffset: {
|
||||
value: 0,
|
||||
unit: TimeUnit.MicroSecond
|
||||
}
|
||||
};
|
||||
|
||||
export default HorizontalWidgetInitialState;
|
@ -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;
|
@ -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;
|
@ -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_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[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;
|
@ -1,27 +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,
|
||||
index: 15,
|
||||
course: {
|
||||
value: DefaultValues.horizontalTimeBases_New[15].value,
|
||||
unit: DefaultValues.horizontalTimeBases_New[15].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
unit: TimeUnit.MicroSecond
|
||||
}
|
||||
},
|
||||
horizontalOffset: {
|
||||
value: 0,
|
||||
unit: TimeUnit.MicroSecond
|
||||
}
|
||||
};
|
||||
|
||||
export default function(state = initialState, action: {type: any, payload: any}) {
|
||||
export default function(state = HorizontalWidgetInitialState, action: {type: any, payload: any}) {
|
||||
switch(action.type) {
|
||||
case "horizontal/changeTimeBaseMode":
|
||||
return {
|
||||
|
@ -1,23 +1,6 @@
|
||||
import MathType from '../../../configuration/enums/mathType';
|
||||
import TimeUnit from '../../../configuration/enums/timeUnit';
|
||||
import VoltageUnit from '../../../configuration/enums/voltageUnit';
|
||||
import MeasurementsWidgetInitialState from '../../initialStates/measurementsWidgetInitialState';
|
||||
|
||||
const initialState = {
|
||||
measurement: [
|
||||
{
|
||||
mathType: MathType.Max,
|
||||
value: 500,
|
||||
unit: TimeUnit.NanoSecond
|
||||
},
|
||||
{
|
||||
mathType: MathType.Min,
|
||||
value: 300,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,108 +1,9 @@
|
||||
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: [
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[6].unit
|
||||
},
|
||||
fine: {
|
||||
value: 0,
|
||||
x10value: 0,
|
||||
unit: VoltageUnit.MilliVolt
|
||||
},
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
course: {
|
||||
value: DefaultValues.x1ProbeValues_New[6].value,
|
||||
unit: DefaultValues.x1ProbeValues_New[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: 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;
|
||||
|
Loading…
Reference in New Issue
Block a user