Features/trigger widget #101
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import './../../../css/bottombar/subscomponents/channel.css';
|
import './../../../css/bottombar/subcomponents/channel.css';
|
||||||
|
|
||||||
class Channel extends React.Component<any, any> {
|
class Channel extends React.Component<any, any> {
|
||||||
render() {
|
render() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import './../../../css/bottombar/subscomponents/timeperdivision.css';
|
import './../../../css/bottombar/subcomponents/timeperdivision.css';
|
||||||
|
|
||||||
class TimePerDivision extends React.Component<any, any> {
|
class TimePerDivision extends React.Component<any, any> {
|
||||||
render() {
|
render() {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import './../../../css/bottombar/subscomponents/trigger.css';
|
import './../../../css/bottombar/subcomponents/trigger.css';
|
||||||
|
|
||||||
class Trigger extends React.Component<any, any> {
|
class Trigger extends React.Component<any, any> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="TriggerStatus">
|
<div className="TriggerStatus">
|
||||||
Trig:CH{this.props.triggerWidget.triggerChannel}, Mode:{this.props.triggerWidget.triggerType}
|
Trig:CH{this.props.triggerWidget.triggerChannel}, Mode: {this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1]}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import './../../../css/sidebar/widgets/triggerWidget.css';
|
import './../../../css/sidebar/widgets/triggerWidget.css';
|
||||||
|
import VoltageUnit from '../../../configuration/enums/voltageUnit';
|
||||||
|
|
||||||
class TriggerWidget extends React.Component<any, any> {
|
class TriggerWidget extends React.Component<any, any> {
|
||||||
|
|
||||||
@ -20,11 +21,16 @@ class TriggerWidget extends React.Component<any, any> {
|
|||||||
|
|
||||||
// Trigger Level
|
// Trigger Level
|
||||||
increaseTriggerLevel = () => {
|
increaseTriggerLevel = () => {
|
||||||
this.props.dispatch({type: 'trigger/increaseTriggerLevel'});
|
this.props.dispatch({type: 'trigger/increaseTriggerLevelValue'});
|
||||||
}
|
}
|
||||||
|
|
||||||
decreaseTriggerLevel = () => {
|
decreaseTriggerLevel = () => {
|
||||||
this.props.dispatch({type: 'trigger/decreaseTriggerLevel'});
|
this.props.dispatch({type: 'trigger/decreaseTriggerLevelValue'});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger Level Unit
|
||||||
|
changeTriggerLevelUnit = (voltageUnit: VoltageUnit) => {
|
||||||
|
this.props.dispatch({type: 'trigger/changeTriggerLevelUnit', payload: voltageUnit})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -63,7 +69,7 @@ class TriggerWidget extends React.Component<any, any> {
|
|||||||
className="AdjustChannelBlockValue"
|
className="AdjustChannelBlockValue"
|
||||||
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
||||||
>
|
>
|
||||||
{this.props.triggerWidget.triggerType.toString()}
|
{this.props.triggerWidget.triggerType[this.props.triggerWidget.triggerChannel-1].toString()}
|
||||||
</label>
|
</label>
|
||||||
<button
|
<button
|
||||||
className="PlusButton"
|
className="PlusButton"
|
||||||
@ -72,7 +78,7 @@ class TriggerWidget extends React.Component<any, any> {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="TriggerWidgetAdjustTriggerLevel">
|
<div className="TriggerWidgetAdjustTriggerLevelValue">
|
||||||
<button
|
<button
|
||||||
className="MinusButton"
|
className="MinusButton"
|
||||||
onClick={() => this.decreaseTriggerLevel()}>
|
onClick={() => this.decreaseTriggerLevel()}>
|
||||||
@ -82,7 +88,8 @@ class TriggerWidget extends React.Component<any, any> {
|
|||||||
className="AdjustChannelBlockValue"
|
className="AdjustChannelBlockValue"
|
||||||
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
||||||
>
|
>
|
||||||
{this.props.triggerWidget.triggerLevel.toString()}
|
{this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].value.toString()}
|
||||||
|
{this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit}
|
||||||
</label>
|
</label>
|
||||||
<button
|
<button
|
||||||
className="PlusButton"
|
className="PlusButton"
|
||||||
@ -90,6 +97,45 @@ class TriggerWidget extends React.Component<any, any> {
|
|||||||
+
|
+
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="TriggerWidgetAdjustTriggerLevelUnit">
|
||||||
|
<button
|
||||||
|
className="NanoVoltButton"
|
||||||
|
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.NanoVolt)}>
|
||||||
|
<label
|
||||||
|
className={"NanoVoltButtonText"}
|
||||||
|
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.NanoVolt ? "bold" : "normal"}}>
|
||||||
|
{VoltageUnit.NanoVolt}
|
||||||
|
</label>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="MicroVoltButton"
|
||||||
|
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.MicroVolt)}>
|
||||||
|
<label
|
||||||
|
className={"MicroVoltButtonText"}
|
||||||
|
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.MicroVolt ? "bold" : "normal"}}>
|
||||||
|
{VoltageUnit.MicroVolt}
|
||||||
|
</label>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="MilliVoltButton"
|
||||||
|
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.MilliVolt)}>
|
||||||
|
<label
|
||||||
|
className={"MilliVoltButtonText"}
|
||||||
|
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.MilliVolt ? "bold" : "normal"}}>
|
||||||
|
{VoltageUnit.MilliVolt}
|
||||||
|
</label>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="VoltButton"
|
||||||
|
onClick={() => this.changeTriggerLevelUnit(VoltageUnit.Volt)}>
|
||||||
|
<label
|
||||||
|
className={"VoltButtonText"}
|
||||||
|
style={{fontWeight: this.props.triggerWidget.triggerLevel[this.props.triggerWidget.triggerChannel-1].unit == VoltageUnit.Volt ? "bold" : "normal"}}>
|
||||||
|
{VoltageUnit.Volt}
|
||||||
|
</label>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,48 @@
|
|||||||
margin-top: 1vh;
|
margin-top: 1vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.TriggerWidgetAdjustTriggerLevel {
|
.TriggerWidgetAdjustTriggerLevelValue {
|
||||||
margin-top: 1vh;
|
margin-top: 1vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.TriggerWidgetAdjustTriggerLevelUnit {
|
||||||
|
margin-top: 1vh;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.NanoVoltButton {
|
||||||
|
margin-right: 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.NanoVoltButtonText {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MicroVoltButton {
|
||||||
|
margin-right: 1vw;
|
||||||
|
margin-left: 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MicroVoltButtonText {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MilliVoltButton {
|
||||||
|
margin-right: 1vw;
|
||||||
|
margin-left: 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MilliVoltButtonText {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.VoltButton {
|
||||||
|
margin-right: 1vw;
|
||||||
|
margin-left: 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.VoltButtonText {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import TriggerType from '../../configuration/enums/triggerType';
|
import TriggerType from '../../configuration/enums/triggerType';
|
||||||
import DefaultChannelColor from '../../configuration/enums/defaultChannelColor';
|
import DefaultChannelColor from '../../configuration/enums/defaultChannelColor';
|
||||||
|
import VoltageUnit from '../../configuration/enums/voltageUnit';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
triggerChannel: 1,
|
triggerChannel: 1,
|
||||||
@ -9,11 +10,24 @@ const initialState = {
|
|||||||
DefaultChannelColor.Channel3,
|
DefaultChannelColor.Channel3,
|
||||||
DefaultChannelColor.Channel4
|
DefaultChannelColor.Channel4
|
||||||
],
|
],
|
||||||
triggerType: TriggerType.RisingEdge,
|
triggerType: [
|
||||||
triggerLevel: 0
|
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 = initialState, action: {type: any, payload: any}) {
|
||||||
|
var channelIndex = state.triggerChannel - 1;
|
||||||
|
var tmp;
|
||||||
|
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case "trigger/increaseChannel":
|
case "trigger/increaseChannel":
|
||||||
if (state.triggerChannel >= 4) {
|
if (state.triggerChannel >= 4) {
|
||||||
@ -32,26 +46,41 @@ export default function(state = initialState, action: {type: any, payload: any})
|
|||||||
triggerChannel: state.triggerChannel - 1
|
triggerChannel: state.triggerChannel - 1
|
||||||
};
|
};
|
||||||
case "trigger/changeTriggerType":
|
case "trigger/changeTriggerType":
|
||||||
if (state.triggerType == TriggerType.RisingEdge) {
|
tmp = state.triggerType;
|
||||||
|
|
||||||
|
if (state.triggerType[channelIndex] == TriggerType.RisingEdge) {
|
||||||
|
tmp[channelIndex] = TriggerType.FallingEdge;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
triggerType: TriggerType.FallingEdge
|
triggerType: tmp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tmp[channelIndex] = TriggerType.RisingEdge;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
triggerType: TriggerType.RisingEdge
|
triggerType: tmp
|
||||||
}
|
}
|
||||||
case "trigger/increaseTriggerLevel":
|
case "trigger/increaseTriggerLevelValue":
|
||||||
|
tmp = state.triggerLevel;
|
||||||
|
tmp[channelIndex].value = Number((state.triggerLevel[channelIndex].value + 0.1).toFixed(1));
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
triggerLevel: state.triggerLevel + 1
|
triggerLevel: tmp
|
||||||
};
|
};
|
||||||
case "trigger/decreaseTriggerLevel":
|
case "trigger/decreaseTriggerLevelValue":
|
||||||
|
tmp = state.triggerLevel;
|
||||||
|
tmp[channelIndex].value = Number((state.triggerLevel[channelIndex].value - 0.1).toFixed(1));
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
triggerLevel: state.triggerLevel - 1
|
triggerLevel: tmp
|
||||||
};
|
};
|
||||||
|
case "trigger/changeTriggerLevelUnit":
|
||||||
|
tmp = state.triggerLevel;
|
||||||
|
tmp[channelIndex].unit = action.payload;
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
triggerLevel: tmp
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user