From 4701d736c49ff0ab7fe5e482ba2663ffcd5b452b Mon Sep 17 00:00:00 2001 From: Jason Bonnell Date: Sat, 16 Jan 2021 15:57:16 -0500 Subject: [PATCH 1/7] cleaned up some verticalWidget code --- .../sidebar/widgets/verticalWidget.tsx | 58 ++++++----- .../src/configuration/defaultValues.tsx | 37 +++++++ .../css/sidebar/widgets/verticalWidget.css | 8 +- .../redux/reducers/verticalWidgetReducer.tsx | 97 ++++++------------- 4 files changed, 104 insertions(+), 96 deletions(-) create mode 100644 Software/waveview/src/configuration/defaultValues.tsx diff --git a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx index 3fb9bb8..96da726 100644 --- a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx +++ b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx @@ -1,17 +1,11 @@ import React from 'react'; import { connect } from 'react-redux'; +import DefaultValues from '../../../configuration/defaultValues'; import './../../../css/sidebar/widgets/verticalWidget.css'; class VerticalWidget extends React.Component { - incrementValue = (value: any) => { - this.props.dispatch({ type: 'vertical/increaseValue', payload: value}); - } - - decrementValue = (value: any) => { - this.props.dispatch({ type: 'vertical/decreaseValue' , payload: value}); - } - - increaseChannel = () => { + // Active Channel + increaseChannel = () => { this.props.dispatch({type: 'vertical/increaseChannel'}); } @@ -19,6 +13,24 @@ class VerticalWidget extends React.Component { this.props.dispatch({type: 'vertical/decreaseChannel'}); } + // Vertical Offset + incrementVerticalOffset = () => { + this.props.dispatch({ type: 'vertical/increaseVerticalOffset'}); + } + + decrementVerticalOffset = () => { + this.props.dispatch({ type: 'vertical/decreaseVerticalOffset'}); + } + + // Time Per Division + incrementTimePerDivision = () => { + this.props.dispatch({type: 'vertical/increaseTimePerDivision'}); + } + + decrementTimePerDivision = () => { + this.props.dispatch({type: 'vertical/decreaseTimePerDivision'}); + } + render() { return (
@@ -34,9 +46,9 @@ class VerticalWidget extends React.Component {
-
+
-
+
diff --git a/Software/waveview/src/configuration/defaultValues.tsx b/Software/waveview/src/configuration/defaultValues.tsx new file mode 100644 index 0000000..b982c0c --- /dev/null +++ b/Software/waveview/src/configuration/defaultValues.tsx @@ -0,0 +1,37 @@ +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" +]; +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" +]; +// 13 different voltages per divison presets +// Start at x1ProbeValues[6] and change accordingly + +export default { + x1ProbeValues, + x10ProbeValues +}; \ No newline at end of file diff --git a/Software/waveview/src/css/sidebar/widgets/verticalWidget.css b/Software/waveview/src/css/sidebar/widgets/verticalWidget.css index bc74dfc..f2e85ec 100644 --- a/Software/waveview/src/css/sidebar/widgets/verticalWidget.css +++ b/Software/waveview/src/css/sidebar/widgets/verticalWidget.css @@ -15,20 +15,20 @@ padding-right: 2vw; } -.VerticalWidgetAdjustBlock-Value1 { +.VerticalWidgetAdjustBlock-TimePerDivision { margin-top: 1vh; } -.AdjustValueBlockValue1 { +.AdjustValueBlockTimePerDivision { padding-left: 2vw; padding-right: 2vw; } -.VerticalWidgetAdjustBlock-Value2 { +.VerticalWidgetAdjustBlock-VerticalOffset { margin-top: 1vh; } -.AdjustValueBlockValue2 { +.AdjustValueBlockVerticalOffset { padding-left: 2vw; padding-right: 2vw; } \ No newline at end of file diff --git a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx index fa2a0f6..943837c 100644 --- a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx +++ b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx @@ -1,88 +1,47 @@ +import DefaultValues from '../../configuration/defaultValues'; + const initialState = { - channel: 1, + activeChannel: 1, channelColorsList: ["#EBFF00", "#00FF19", "#0075FF", "#FF0000"], - value1: 0, - value2: 0 + timePerDivision: [DefaultValues.x1ProbeValues[6], DefaultValues.x1ProbeValues[6], DefaultValues.x1ProbeValues[6], DefaultValues.x1ProbeValues[6]], + timePerDivisionIndex: [6, 6, 6, 6], + verticalOffset: [0, 0, 0, 0] }; export default function(state = initialState, action: {type: any, payload: any}) { switch(action.type) { case "vertical/increaseChannel": - if (state.channel >= 4) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 - } + if (state.activeChannel >= 4) { + return { ...state } } return { - channel: state.channel + 1, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 + ...state, + activeChannel: state.activeChannel + 1 }; case "vertical/decreaseChannel": - if (state.channel == 1) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 - } + if (state.activeChannel == 1) { + return { ...state } } return { - channel: state.channel - 1, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 + ...state, + activeChannel: state.activeChannel - 1 }; - case "vertical/increaseValue": - if (action.payload == 1) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1 + 1, - value2: state.value2 - } - } - else if (action.payload == 2) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 + 1 - } - } - else return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 + case "vertical/increaseVerticalOffset": + return { ...state } + // Decrease vertical offset + case "vertical/decreaseVerticalOffset": + return { ...state } + // Decrease vertical offset + case "vertical/increaseTimePerDivision": + if (state.timePerDivisionIndex[state.activeChannel - 1] >= 12) { + return { ...state } }; - case "vertical/decreaseValue": - if (action.payload == 1) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1 - 1, - value2: state.value2 - } - } - else if (action.payload == 2) { - return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 - 1 - } - } - else return { - channel: state.channel, - channelColorsList: state.channelColorsList, - value1: state.value1, - value2: state.value2 + // Increase time per division + case "vertical/decreaseTimePerDivision": + if (state.timePerDivisionIndex[state.activeChannel - 1] == 0) { + return { ...state } }; + // Decrease time per division default: return state; } -- 2.45.2 From 6cc803cf947e92a242e3a347f3378c933f8136c3 Mon Sep 17 00:00:00 2001 From: Jason Bonnell Date: Sat, 16 Jan 2021 17:00:07 -0500 Subject: [PATCH 2/7] hooked up channels and timeperdiv in bottombar --- Software/waveview/src/App.tsx | 22 +------- .../src/components/bottombar/bottombar.tsx | 47 +++------------- .../bottombar/subcomponents/channel.tsx | 46 +++++++++------- .../subcomponents/timeperdivision.tsx | 25 +++++---- .../bottombar/subcomponents/trigger.tsx | 9 +--- .../sidebar/widgets/horizontalWidget.tsx | 38 ++++++++----- .../sidebar/widgets/verticalWidget.tsx | 4 +- .../configuration/enums/measurementType.tsx | 6 +++ .../css/sidebar/widgets/horizontalWidget.css | 6 +-- .../reducers/horizontalWidgetReducer.tsx | 54 +++++++++---------- .../redux/reducers/verticalWidgetReducer.tsx | 33 +++++++++--- 11 files changed, 139 insertions(+), 151 deletions(-) create mode 100644 Software/waveview/src/configuration/enums/measurementType.tsx diff --git a/Software/waveview/src/App.tsx b/Software/waveview/src/App.tsx index e6e998d..7094a34 100644 --- a/Software/waveview/src/App.tsx +++ b/Software/waveview/src/App.tsx @@ -19,14 +19,6 @@ class App extends React.Component { color: string, className:string }[]; - triggerInformation: { - channel: string, - mode: string - }; - timePerDivisionInformation: { - timeValue: number, - timeUnit: string - } constructor(props: any) { super(props); @@ -41,14 +33,6 @@ class App extends React.Component { {color: "#0075FF", className: "Channel3"}, {color: "#FF0000", className: "Channel4"} ] - this.triggerInformation = { - channel: "CH1", - mode: "RisingEdge" - } - this.timePerDivisionInformation = { - timeValue: 10, - timeUnit: "ns" - } } componentDidMount() { @@ -83,11 +67,7 @@ class App extends React.Component { dataSeries={this.generatorList.map((gen, idx) => gen.getData())} colorSeries={this.channelList.map((c, i) => c.color)} /> - +
); diff --git a/Software/waveview/src/components/bottombar/bottombar.tsx b/Software/waveview/src/components/bottombar/bottombar.tsx index 3128893..7650b72 100644 --- a/Software/waveview/src/components/bottombar/bottombar.tsx +++ b/Software/waveview/src/components/bottombar/bottombar.tsx @@ -4,48 +4,15 @@ import TimePerDivision from './subcomponents/timeperdivision'; import Trigger from './subcomponents/trigger'; import './../../css/bottombar/bottombar.css'; -interface IBottomBarProps { - channelList: { - color: string, - className: string - }[] - triggerInformation: { - channel: string, - mode: string - }; - timePerDivisionInformation: { - timeValue: number, - timeUnit: string - } -} - -function BottomBar(props: IBottomBarProps) { +function BottomBar() { return (
- { - props.channelList.map((c, i) => { - return ( - - ) - }) - } - - - + + + + + +
) } diff --git a/Software/waveview/src/components/bottombar/subcomponents/channel.tsx b/Software/waveview/src/components/bottombar/subcomponents/channel.tsx index 774b96f..69fea62 100644 --- a/Software/waveview/src/components/bottombar/subcomponents/channel.tsx +++ b/Software/waveview/src/components/bottombar/subcomponents/channel.tsx @@ -1,25 +1,31 @@ import React from 'react'; +import { connect } from 'react-redux'; import './../../../css/bottombar/subscomponents/channel.css'; -interface IChannelProps { - channelNumber: number - voltsPerDiv: number - voltageValue: number - voltageUnit: string - measurementType: string - channelClass: string - channelColor: string -}; - -function Channel(props: IChannelProps) { - return ( -
- -
- ) +class Channel extends React.Component { + render() { + return ( +
+ +
+ ) + } } - -export default Channel; + +function mapStateToProps(state: { verticalWidget: any; }) { + return { + verticalWidget: state.verticalWidget + }; +} + +export default connect(mapStateToProps)(Channel); \ No newline at end of file diff --git a/Software/waveview/src/components/bottombar/subcomponents/timeperdivision.tsx b/Software/waveview/src/components/bottombar/subcomponents/timeperdivision.tsx index acad0d7..13181e5 100644 --- a/Software/waveview/src/components/bottombar/subcomponents/timeperdivision.tsx +++ b/Software/waveview/src/components/bottombar/subcomponents/timeperdivision.tsx @@ -1,17 +1,22 @@ import React from 'react'; +import { connect } from 'react-redux'; import './../../../css/bottombar/subscomponents/timeperdivision.css'; -interface ITimePerDivisionProps { - timeValue: number, - timeUnit: string +class TimePerDivision extends React.Component { + render() { + return( +
+ {this.props.horizontalWidget.horizontalTimeBase.value.toString()} + {this.props.horizontalWidget.horizontalTimeBase.unit} +
+ ) + } } -function TimePerDivision(props: ITimePerDivisionProps) { - return( -
- {props.timeValue}{props.timeUnit}/div -
- ) +function mapStateToProps(state: { horizontalWidget: any; }) { + return { + horizontalWidget: state.horizontalWidget + }; } -export default TimePerDivision; \ No newline at end of file +export default connect(mapStateToProps)(TimePerDivision); \ No newline at end of file diff --git a/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx b/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx index bae410d..3180c7c 100644 --- a/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx +++ b/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx @@ -1,15 +1,10 @@ import React from 'react'; import './../../../css/bottombar/subscomponents/trigger.css'; -interface ITriggerProps { - channel: string, - mode: string -} - -function Trigger(props: ITriggerProps) { +function Trigger() { return (
- Trig:{props.channel}, Mode:{props.mode} + Trig:CH1, Mode:RisingEdge
) } diff --git a/Software/waveview/src/components/sidebar/widgets/horizontalWidget.tsx b/Software/waveview/src/components/sidebar/widgets/horizontalWidget.tsx index 4397cd3..825f772 100644 --- a/Software/waveview/src/components/sidebar/widgets/horizontalWidget.tsx +++ b/Software/waveview/src/components/sidebar/widgets/horizontalWidget.tsx @@ -4,12 +4,22 @@ import './../../../css/sidebar/widgets/horizontalWidget.css'; class HorizontalWidget extends React.Component { - incrementValue = (value: any) => { - this.props.dispatch({ type: 'horizontal/increaseValue', payload: value}); + // Horizontal Time Base + incrementTimeBase = () => { + this.props.dispatch({ type: 'horizontal/increaseTimeBase'}); } - decrementValue = (value: any) => { - this.props.dispatch({ type: 'horizontal/decreaseValue' , payload: value}); + decrementTimeBase = () => { + this.props.dispatch({ type: 'horizontal/decreaseTimeBase'}); + } + + // Horizontal Offset + incrementOffset = () => { + this.props.dispatch({ type: 'horizontal/increaseOffset'}); + } + + decrementOffset = () => { + this.props.dispatch({ type: 'horizontal/decreaseOffset'}); } render() { @@ -19,40 +29,40 @@ class HorizontalWidget extends React.Component { Horizontal
-
+
-
+
diff --git a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx index 96da726..77fc234 100644 --- a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx +++ b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx @@ -67,7 +67,7 @@ class VerticalWidget extends React.Component { className="AdjustValueBlockTimePerDivision" style={{color: this.props.verticalWidget.channelColorsList[this.props.verticalWidget.activeChannel-1]}} > - {DefaultValues.x1ProbeValues[this.props.verticalWidget.timePerDivisionIndex[this.props.verticalWidget.activeChannel-1]]} + {DefaultValues.x1ProbeValues[this.props.verticalWidget.timePerDivision[this.props.verticalWidget.activeChannel-1].index]}
@@ -51,7 +51,7 @@ class HorizontalWidget extends React.Component {
diff --git a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx index 77fc234..934c244 100644 --- a/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx +++ b/Software/waveview/src/components/sidebar/widgets/verticalWidget.tsx @@ -41,7 +41,7 @@ class VerticalWidget extends React.Component {
@@ -60,7 +60,7 @@ class VerticalWidget extends React.Component {
@@ -79,7 +79,7 @@ class VerticalWidget extends React.Component {
diff --git a/Software/waveview/src/configuration/defaultValues.tsx b/Software/waveview/src/configuration/defaultValues.tsx index b982c0c..2fd58c5 100644 --- a/Software/waveview/src/configuration/defaultValues.tsx +++ b/Software/waveview/src/configuration/defaultValues.tsx @@ -31,7 +31,44 @@ const x10ProbeValues = [ // 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", + "1us/div", + "2us/div", + "5us/div", + "10us/div", + "20us/div", + "50us/div", + "100us/div", + "200us/div", + "500us/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" +]; +// 31 different voltages per division presets +// Start at horizontalTimeBases[15] and change accordingly + export default { x1ProbeValues, - x10ProbeValues + x10ProbeValues, + horizontalTimeBases }; \ No newline at end of file diff --git a/Software/waveview/src/configuration/enums/defaultChannelColor.tsx b/Software/waveview/src/configuration/enums/defaultChannelColor.tsx new file mode 100644 index 0000000..3afbb79 --- /dev/null +++ b/Software/waveview/src/configuration/enums/defaultChannelColor.tsx @@ -0,0 +1,8 @@ +enum DefaultChannelColor { + Channel1 = "#EBFF00", + Channel2 = "#00FF19", + Channel3 = "#0075FF", + Channel4 = "#FF0000" +}; + +export default DefaultChannelColor; \ No newline at end of file diff --git a/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx b/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx index abaa8f4..09169c8 100644 --- a/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx +++ b/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx @@ -1,40 +1,54 @@ +import DefaultValues from '../../configuration/defaultValues'; + const initialState = { - horizontalTimeBase: {value: 0, unit: "ns/div"}, - horizontalOffset: {value: 0, unit: "ms"} + horizontalTimeBase: { + value: DefaultValues.horizontalTimeBases[15], + index: 15 + }, + horizontalOffset: { + value: 0, + unit: "ms" + } }; export default function(state = initialState, action: {type: any, payload: any}) { switch(action.type) { case "horizontal/increaseTimeBase": + if (state.horizontalTimeBase.index >= 30) { + return { ...state }; + } return { ...state, horizontalTimeBase: { - value: state.horizontalTimeBase.value + 1, - unit: state.horizontalTimeBase.unit + value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1], + index: state.horizontalTimeBase.index + 1 } } case "horizontal/decreaseTimeBase": + if (state.horizontalTimeBase.index === 0) { + return { ...state }; + } return { ...state, horizontalTimeBase: { - value: state.horizontalTimeBase.value - 1, - unit: state.horizontalTimeBase.unit + value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1], + index: state.horizontalTimeBase.index - 1 } } case "horizontal/increaseOffset": return { ...state, horizontalOffset: { - value: state.horizontalOffset.value + 1, - unit: state.horizontalOffset.unit + ...state.horizontalOffset, + value: state.horizontalOffset.value + 1 } } case "horizontal/decreaseOffset": return { ...state, horizontalOffset: { - value: state.horizontalOffset.value - 1, - unit: state.horizontalOffset.unit + ...state.horizontalOffset, + value: state.horizontalOffset.value - 1 } } default: diff --git a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx index d7a14c0..6f9a900 100644 --- a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx +++ b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx @@ -1,13 +1,14 @@ import DefaultValues from '../../configuration/defaultValues'; +import DefaultChannelColor from '../../configuration/enums/defaultChannelColor'; import MeasurementType from '../../configuration/enums/measurementType'; const initialState = { activeChannel: 1, channelColorsList: [ - "#EBFF00", - "#00FF19", - "#0075FF", - "#FF0000" + DefaultChannelColor.Channel1, + DefaultChannelColor.Channel2, + DefaultChannelColor.Channel3, + DefaultChannelColor.Channel4 ], timePerDivision: [ {value: DefaultValues.x1ProbeValues[6], index: 6}, @@ -30,6 +31,9 @@ const initialState = { }; export default function(state = initialState, action: {type: any, payload: any}) { + var channelIndex = state.activeChannel - 1; + var tmp; + switch(action.type) { case "vertical/increaseChannel": if (state.activeChannel >= 4) { @@ -48,23 +52,45 @@ export default function(state = initialState, action: {type: any, payload: any}) activeChannel: state.activeChannel - 1 }; case "vertical/increaseVerticalOffset": - return { ...state } - // Decrease vertical offset + tmp = state.verticalOffset; + + tmp[channelIndex].value = state.verticalOffset[channelIndex].value + 1; + return { + ...state, + verticalOffset: tmp + } case "vertical/decreaseVerticalOffset": - return { ...state } - // Decrease vertical offset + tmp = state.verticalOffset; + + tmp[channelIndex].value = state.verticalOffset[channelIndex].value - 1; + return { + ...state, + verticalOffset: tmp + } case "vertical/increaseTimePerDivision": - if (state.timePerDivision[state.activeChannel - 1].index >= 12) { - return { ...state } - }; - break; - // Increase time per division - case "vertical/decreaseTimePerDivision": if (state.timePerDivision[state.activeChannel - 1].index === 0) { return { ...state } }; - // Decrease time per division - break; + tmp = state.timePerDivision; + + tmp[channelIndex].index = state.timePerDivision[channelIndex].index - 1; + tmp[channelIndex].value = DefaultValues.x1ProbeValues[tmp[channelIndex].index]; + return { + ...state, + timePerDivision: tmp + } + case "vertical/decreaseTimePerDivision": + if (state.timePerDivision[state.activeChannel - 1].index >= 12) { + return { ...state } + }; + tmp = state.timePerDivision; + + tmp[channelIndex].index = state.timePerDivision[channelIndex].index + 1; + tmp[channelIndex].value = DefaultValues.x1ProbeValues[tmp[channelIndex].index]; + return { + ...state, + timePerDivision: tmp + } default: return state; } -- 2.45.2 From 4a4754618c77cdacf5d1f26e413ca1c4c0197410 Mon Sep 17 00:00:00 2001 From: Jason Bonnell Date: Sat, 16 Jan 2021 18:18:59 -0500 Subject: [PATCH 5/7] added basic logic for trigger reducer/state --- .../bottombar/subcomponents/trigger.tsx | 23 +++++++++++++------ .../src/configuration/enums/triggerType.tsx | 6 +++++ .../waveview/src/redux/reducers/index.tsx | 4 +++- .../redux/reducers/triggerWidgetReducer.tsx | 16 +++++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 Software/waveview/src/configuration/enums/triggerType.tsx create mode 100644 Software/waveview/src/redux/reducers/triggerWidgetReducer.tsx diff --git a/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx b/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx index 3180c7c..4d6786a 100644 --- a/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx +++ b/Software/waveview/src/components/bottombar/subcomponents/trigger.tsx @@ -1,12 +1,21 @@ import React from 'react'; +import { connect } from 'react-redux'; import './../../../css/bottombar/subscomponents/trigger.css'; -function Trigger() { - return ( -
- Trig:CH1, Mode:RisingEdge -
- ) +class Trigger extends React.Component { + render() { + return ( +
+ Trig:CH{this.props.triggerWidget.triggerChannel}, Mode:{this.props.triggerWidget.triggerType} +
+ ) + } } -export default Trigger; \ No newline at end of file +function mapStateToProps(state: { triggerWidget: any; }) { + return { + triggerWidget: state.triggerWidget + }; +} + +export default connect(mapStateToProps)(Trigger); \ No newline at end of file diff --git a/Software/waveview/src/configuration/enums/triggerType.tsx b/Software/waveview/src/configuration/enums/triggerType.tsx new file mode 100644 index 0000000..a00c1da --- /dev/null +++ b/Software/waveview/src/configuration/enums/triggerType.tsx @@ -0,0 +1,6 @@ +enum TriggerType { + RisingEdge = "RisingEdge", + FallingEdge = "FallingEdge" +} + +export default TriggerType; \ No newline at end of file diff --git a/Software/waveview/src/redux/reducers/index.tsx b/Software/waveview/src/redux/reducers/index.tsx index 6beb812..9a0ada9 100644 --- a/Software/waveview/src/redux/reducers/index.tsx +++ b/Software/waveview/src/redux/reducers/index.tsx @@ -2,11 +2,13 @@ import { combineReducers } from 'redux'; import horizontalWidgetReducer from './horizontalWidgetReducer'; import verticalWidgetReducer from './verticalWidgetReducer'; import measurementsWidgetReducer from './measurementsWidgetReducer'; +import triggerWidgetReducer from './triggerWidgetReducer'; export default combineReducers( { horizontalWidget: horizontalWidgetReducer, verticalWidget: verticalWidgetReducer, - measurementsWidget: measurementsWidgetReducer + measurementsWidget: measurementsWidgetReducer, + triggerWidget: triggerWidgetReducer } ); diff --git a/Software/waveview/src/redux/reducers/triggerWidgetReducer.tsx b/Software/waveview/src/redux/reducers/triggerWidgetReducer.tsx new file mode 100644 index 0000000..76f3d6e --- /dev/null +++ b/Software/waveview/src/redux/reducers/triggerWidgetReducer.tsx @@ -0,0 +1,16 @@ +import TriggerType from '../../configuration/enums/triggerType'; + +const initialState = { + triggerChannel: 1, + triggerType: TriggerType.RisingEdge, + triggerLevel: 0 +}; + +export default function(state = initialState, action: {type: any, payload: any}) { + switch(action.type) { + case "trigger/test": + return { ...state }; + default: + return state; + } +} \ No newline at end of file -- 2.45.2 From 0436e85467ec6e078c905dd1adb7ae7d86e98a3d Mon Sep 17 00:00:00 2001 From: Jason Bonnell Date: Sat, 16 Jan 2021 19:01:41 -0500 Subject: [PATCH 6/7] added micro, enums, and user-select as none --- .../src/configuration/defaultValues.tsx | 18 +++++++++--------- .../src/configuration/enums/timeUnit.tsx | 8 ++++++++ .../src/configuration/enums/voltageUnit.tsx | 8 ++++++++ .../css/bottombar/subscomponents/channel.css | 3 +++ .../subscomponents/timeperdivision.css | 1 + .../css/bottombar/subscomponents/trigger.css | 1 + Software/waveview/src/css/graph/graph.css | 1 + .../waveview/src/css/sidebar/core/search.css | 2 ++ .../src/css/sidebar/core/singleButton.css | 2 ++ .../src/css/sidebar/core/stopButton.css | 2 ++ .../css/sidebar/widgets/horizontalWidget.css | 1 + .../css/sidebar/widgets/measurementsWidget.css | 4 ++++ .../src/css/sidebar/widgets/verticalWidget.css | 1 + .../redux/reducers/horizontalWidgetReducer.tsx | 3 ++- .../redux/reducers/verticalWidgetReducer.tsx | 9 +++++---- 15 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 Software/waveview/src/configuration/enums/timeUnit.tsx create mode 100644 Software/waveview/src/configuration/enums/voltageUnit.tsx diff --git a/Software/waveview/src/configuration/defaultValues.tsx b/Software/waveview/src/configuration/defaultValues.tsx index 2fd58c5..52828ad 100644 --- a/Software/waveview/src/configuration/defaultValues.tsx +++ b/Software/waveview/src/configuration/defaultValues.tsx @@ -41,15 +41,15 @@ const horizontalTimeBases = [ "100ns/div", "200ns/div", "500ns/div", - "1us/div", - "2us/div", - "5us/div", - "10us/div", - "20us/div", - "50us/div", - "100us/div", - "200us/div", - "500us/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", diff --git a/Software/waveview/src/configuration/enums/timeUnit.tsx b/Software/waveview/src/configuration/enums/timeUnit.tsx new file mode 100644 index 0000000..be97d3f --- /dev/null +++ b/Software/waveview/src/configuration/enums/timeUnit.tsx @@ -0,0 +1,8 @@ +enum TimeUnit { + NanoSecond = "ns", + MicroSecond = "µs", + MilliSecond = "ms", + Second = "s" +} + +export default TimeUnit; \ No newline at end of file diff --git a/Software/waveview/src/configuration/enums/voltageUnit.tsx b/Software/waveview/src/configuration/enums/voltageUnit.tsx new file mode 100644 index 0000000..ef8b9fa --- /dev/null +++ b/Software/waveview/src/configuration/enums/voltageUnit.tsx @@ -0,0 +1,8 @@ +enum VoltageUnit { + NanoVolt = "nV", + MicroVolt = "µV", + MilliVolt = "mV", + Volt = "V" +} + +export default VoltageUnit; \ No newline at end of file diff --git a/Software/waveview/src/css/bottombar/subscomponents/channel.css b/Software/waveview/src/css/bottombar/subscomponents/channel.css index a3da12f..75c1f58 100644 --- a/Software/waveview/src/css/bottombar/subscomponents/channel.css +++ b/Software/waveview/src/css/bottombar/subscomponents/channel.css @@ -11,6 +11,7 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } .Channel2 { @@ -31,6 +32,7 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } .Channel4 { @@ -41,4 +43,5 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } \ No newline at end of file diff --git a/Software/waveview/src/css/bottombar/subscomponents/timeperdivision.css b/Software/waveview/src/css/bottombar/subscomponents/timeperdivision.css index f83586b..ea82924 100644 --- a/Software/waveview/src/css/bottombar/subscomponents/timeperdivision.css +++ b/Software/waveview/src/css/bottombar/subscomponents/timeperdivision.css @@ -12,4 +12,5 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } \ No newline at end of file diff --git a/Software/waveview/src/css/bottombar/subscomponents/trigger.css b/Software/waveview/src/css/bottombar/subscomponents/trigger.css index 2a47d2c..58583f6 100644 --- a/Software/waveview/src/css/bottombar/subscomponents/trigger.css +++ b/Software/waveview/src/css/bottombar/subscomponents/trigger.css @@ -12,4 +12,5 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } \ No newline at end of file diff --git a/Software/waveview/src/css/graph/graph.css b/Software/waveview/src/css/graph/graph.css index 4887ff8..7f878da 100644 --- a/Software/waveview/src/css/graph/graph.css +++ b/Software/waveview/src/css/graph/graph.css @@ -20,5 +20,6 @@ color: yellow; margin-top: 54vh; margin-bottom: 0; + user-select: none; } diff --git a/Software/waveview/src/css/sidebar/core/search.css b/Software/waveview/src/css/sidebar/core/search.css index 173efeb..475c9b8 100644 --- a/Software/waveview/src/css/sidebar/core/search.css +++ b/Software/waveview/src/css/sidebar/core/search.css @@ -1,10 +1,12 @@ .Search { text-align: center; display: flex; + user-select: none; } .Searchbar { position: relative; + user-select: none; top: 10px; width: 15vw; height: 2vh; diff --git a/Software/waveview/src/css/sidebar/core/singleButton.css b/Software/waveview/src/css/sidebar/core/singleButton.css index 195df7c..22c19d1 100644 --- a/Software/waveview/src/css/sidebar/core/singleButton.css +++ b/Software/waveview/src/css/sidebar/core/singleButton.css @@ -8,6 +8,7 @@ background: #EBFF00; z-index: 100; border: none; + user-select: none; } .SingleButtonText { @@ -16,4 +17,5 @@ display: flex; position: relative; left: 2vw; + user-select: none; } \ No newline at end of file diff --git a/Software/waveview/src/css/sidebar/core/stopButton.css b/Software/waveview/src/css/sidebar/core/stopButton.css index 5ec7718..ff2c9ae 100644 --- a/Software/waveview/src/css/sidebar/core/stopButton.css +++ b/Software/waveview/src/css/sidebar/core/stopButton.css @@ -8,6 +8,7 @@ background: #FF0000; z-index: 100; border: none; + user-select: none; } .StopButtonText { @@ -16,4 +17,5 @@ display: flex; position: relative; left: 2vw; + user-select: none; } \ No newline at end of file diff --git a/Software/waveview/src/css/sidebar/widgets/horizontalWidget.css b/Software/waveview/src/css/sidebar/widgets/horizontalWidget.css index a824376..a14573a 100644 --- a/Software/waveview/src/css/sidebar/widgets/horizontalWidget.css +++ b/Software/waveview/src/css/sidebar/widgets/horizontalWidget.css @@ -2,6 +2,7 @@ text-align: center; display: flex; flex-direction: column; + user-select: none; } .WidgetTitle { diff --git a/Software/waveview/src/css/sidebar/widgets/measurementsWidget.css b/Software/waveview/src/css/sidebar/widgets/measurementsWidget.css index feed992..8fb9f2c 100644 --- a/Software/waveview/src/css/sidebar/widgets/measurementsWidget.css +++ b/Software/waveview/src/css/sidebar/widgets/measurementsWidget.css @@ -1,3 +1,7 @@ +.MeasurementsWidget { + user-select: none; +} + .MeasurementsWidgetDisplayValueBlock-Value2 { margin-top: 1vh; } diff --git a/Software/waveview/src/css/sidebar/widgets/verticalWidget.css b/Software/waveview/src/css/sidebar/widgets/verticalWidget.css index f2e85ec..b678cf2 100644 --- a/Software/waveview/src/css/sidebar/widgets/verticalWidget.css +++ b/Software/waveview/src/css/sidebar/widgets/verticalWidget.css @@ -2,6 +2,7 @@ text-align: center; display: flex; flex-direction: column; + user-select: none; } .WidgetTitle { diff --git a/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx b/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx index 09169c8..efc8e52 100644 --- a/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx +++ b/Software/waveview/src/redux/reducers/horizontalWidgetReducer.tsx @@ -1,4 +1,5 @@ import DefaultValues from '../../configuration/defaultValues'; +import TimeUnit from '../../configuration/enums/timeUnit'; const initialState = { horizontalTimeBase: { @@ -7,7 +8,7 @@ const initialState = { }, horizontalOffset: { value: 0, - unit: "ms" + unit: TimeUnit.MilliSecond } }; diff --git a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx index 6f9a900..704ebb4 100644 --- a/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx +++ b/Software/waveview/src/redux/reducers/verticalWidgetReducer.tsx @@ -1,6 +1,7 @@ import DefaultValues from '../../configuration/defaultValues'; import DefaultChannelColor from '../../configuration/enums/defaultChannelColor'; import MeasurementType from '../../configuration/enums/measurementType'; +import VoltageUnit from '../../configuration/enums/voltageUnit'; const initialState = { activeChannel: 1, @@ -17,10 +18,10 @@ const initialState = { {value: DefaultValues.x1ProbeValues[6], index: 6} ], verticalOffset: [ - {value: 0, unit: "mV"}, - {value: 0, unit: "mV"}, - {value: 0, unit: "mV"}, - {value: 0, unit: "mV"} + {value: 0, unit: VoltageUnit.MilliVolt}, + {value: 0, unit: VoltageUnit.MilliVolt}, + {value: 0, unit: VoltageUnit.MilliVolt}, + {value: 0, unit: VoltageUnit.MilliVolt} ], measurementType: [ MeasurementType.DC, -- 2.45.2 From 7d33234dbf0452bede754432220ec5b2b9b51b08 Mon Sep 17 00:00:00 2001 From: Jason Bonnell Date: Sat, 16 Jan 2021 19:03:14 -0500 Subject: [PATCH 7/7] added user-select to Channel2 in channel.css --- Software/waveview/src/css/bottombar/subscomponents/channel.css | 1 + 1 file changed, 1 insertion(+) diff --git a/Software/waveview/src/css/bottombar/subscomponents/channel.css b/Software/waveview/src/css/bottombar/subscomponents/channel.css index 75c1f58..7ac6890 100644 --- a/Software/waveview/src/css/bottombar/subscomponents/channel.css +++ b/Software/waveview/src/css/bottombar/subscomponents/channel.css @@ -22,6 +22,7 @@ height: 2vh; background: #4b4b4b; z-index: 1000; + user-select: none; } .Channel3 { -- 2.45.2