mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-08 06:25:30 +00:00
Merge pull request #184 from EEVengers/features/ux-work
Features/ux work
This commit is contained in:
commit
93f2c14a76
Software/waveview/src
components
css/sidebar
redux
initialStates
reducers/widgets
util
@ -81,12 +81,14 @@ class Graph extends React.Component<any, any> {
|
||||
/>
|
||||
{
|
||||
this.generator.getData().map((data: any, index: any) => {
|
||||
return <LineSeries
|
||||
return (
|
||||
<LineSeries
|
||||
className="data-series"
|
||||
data={data}
|
||||
style={{fill:"none", transform: "translate(0,0)"}}
|
||||
style={{fill:"none", transform: "translate(0,0)", opacity: this.props.verticalWidget.settings[index].status}}
|
||||
color={this.props.settings.colors.channel[index]}
|
||||
/>
|
||||
)
|
||||
})
|
||||
}
|
||||
</FlexibleXYPlot>
|
||||
@ -95,10 +97,11 @@ class Graph extends React.Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state: { graph: any, settings: any }) {
|
||||
function mapStateToProps(state: { graph: any, settings: any, verticalWidget: any }) {
|
||||
return {
|
||||
graph: state.graph,
|
||||
settings: state.settings
|
||||
settings: state.settings,
|
||||
verticalWidget: state.verticalWidget
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ class TriggerWidget extends React.Component<any, any> {
|
||||
|
||||
toggleMathMode = (mathEnabled: boolean) => {
|
||||
this.props.dispatch({type: 'math/toggleMathMode', payload: mathEnabled });
|
||||
this.props.dispatch({type: 'vertical/toggleMathWaveform' });
|
||||
}
|
||||
|
||||
changeChannel1 = (channelNumber: number) => {
|
||||
@ -179,9 +180,10 @@ class TriggerWidget extends React.Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state: { mathWidget: any, settings: any}) {
|
||||
function mapStateToProps(state: { mathWidget: any, verticalWidget: any, settings: any}) {
|
||||
return {
|
||||
mathWidget: state.mathWidget,
|
||||
verticalWidget: state.verticalWidget,
|
||||
settings: state.settings
|
||||
};
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import GraphStatus from '../../../configuration/enums/graphStatus';
|
||||
|
||||
import CMD from '../../../configuration/enums/cmd';
|
||||
import {Plumber, PlumberArgs} from '../../../util/plumber';
|
||||
import ControlMode from '../../../configuration/enums/controlMode';
|
||||
|
||||
class MeasurementsWidget extends React.Component<any, any> {
|
||||
static instanceList: MeasurementsWidget[] = [];
|
||||
@ -128,7 +129,10 @@ 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.measurementsWidget.max[0].unit}
|
||||
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[0].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[0].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
<label
|
||||
@ -140,7 +144,10 @@ 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.measurementsWidget.min[0].unit}
|
||||
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[0].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[0].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[0].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
</div>
|
||||
@ -162,7 +169,10 @@ 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.measurementsWidget.max[1].unit}
|
||||
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[1].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[1].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
<label
|
||||
@ -174,7 +184,10 @@ 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.measurementsWidget.min[1].unit}
|
||||
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[1].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[1].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[1].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
</div>
|
||||
@ -196,7 +209,10 @@ 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.measurementsWidget.max[2].unit}
|
||||
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[2].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[2].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
<label
|
||||
@ -208,7 +224,10 @@ 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.measurementsWidget.min[2].unit}
|
||||
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[2].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[2].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[2].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
</div>
|
||||
@ -230,7 +249,10 @@ 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.measurementsWidget.max[3].unit}
|
||||
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[3].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[3].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
<label
|
||||
@ -242,7 +264,10 @@ 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.measurementsWidget.min[3].unit}
|
||||
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Course
|
||||
&& this.props.verticalWidget.timePerDivision[3].course.unit.toString()}
|
||||
{this.props.verticalWidget.settings[3].controlMode === ControlMode.Fine
|
||||
&& + this.props.verticalWidget.timePerDivision[3].fine.unit.toString()}
|
||||
</label>
|
||||
<div className="ClearBlock"></div>
|
||||
</div>
|
||||
@ -253,9 +278,10 @@ class MeasurementsWidget extends React.Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state: { measurementsWidget: any, settings: any, graph: any }) {
|
||||
function mapStateToProps(state: { measurementsWidget: any, verticalWidget: any, settings: any, graph: any }) {
|
||||
return {
|
||||
measurementsWidget: state.measurementsWidget,
|
||||
verticalWidget: state.verticalWidget,
|
||||
settings: state.settings,
|
||||
graph: state.graph
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
width: 15vw;
|
||||
height: 2vh;
|
||||
color: white;
|
||||
background: #2E2E2E;
|
||||
background: #212121;
|
||||
z-index: 100;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import MathOperators from '../../configuration/enums/mathOperators';
|
||||
|
||||
const MathWidgetInitialState = {
|
||||
mathEnabled: true,
|
||||
mathEnabled: false,
|
||||
mathOperator: MathOperators.Addition,
|
||||
channel1: 1,
|
||||
channel2: 2
|
||||
|
@ -6,9 +6,9 @@ const SettingsInitialState = {
|
||||
DefaultColors.Channel1,
|
||||
DefaultColors.Channel2,
|
||||
DefaultColors.Channel3,
|
||||
DefaultColors.Channel4
|
||||
],
|
||||
math: DefaultColors.Math
|
||||
DefaultColors.Channel4,
|
||||
DefaultColors.Math
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -85,6 +85,9 @@ const VerticalWidgetInitialState = {
|
||||
coupling: MeasurementType.DC,
|
||||
bandwidth: 100,
|
||||
status: 1
|
||||
},
|
||||
{
|
||||
status: 0
|
||||
}
|
||||
],
|
||||
verticalOffset: [
|
||||
|
@ -81,6 +81,7 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
|
||||
settings: tmp
|
||||
};
|
||||
case "vertical/changeChannelStatus":
|
||||
// TODO: Call C and tell them that we want to either start getting or stop receiving data from the channel
|
||||
tmp = state.settings;
|
||||
var newTotalChannelsUsed = state.totalChannelsUsed;
|
||||
|
||||
@ -175,6 +176,15 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
|
||||
...state,
|
||||
timePerDivision: tmp
|
||||
};
|
||||
case "vertical/toggleMathWaveform":
|
||||
tmp = state.settings;
|
||||
var newStatus = (state.settings[4].status === 1) ? 0 : 1;
|
||||
|
||||
state.settings[4].status = newStatus;
|
||||
return {
|
||||
...state,
|
||||
settings: tmp
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export class Plumber {
|
||||
this.bridge.read(rxBuff, (err: NodeJS.ErrnoException, bytesRead: number, bytes: Uint8Array) => {
|
||||
var bytes16 = new Uint16Array(bytes.buffer);
|
||||
var dataSize = bytes16[2];
|
||||
if(!args.headCheck(args, bytes16) || dataSize == 0) {
|
||||
if(!args.headCheck(args, bytes16) || dataSize === 0) {
|
||||
this.nextCycle();
|
||||
return;
|
||||
}
|
||||
@ -85,7 +85,7 @@ export class Plumber {
|
||||
if(args.cmd <= CMD.CMD_GetData4) {
|
||||
return false;
|
||||
}
|
||||
else if(args.cmd == CMD.CMD_RampDemo) {
|
||||
else if(args.cmd === CMD.CMD_RampDemo) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -117,7 +117,7 @@ export class Plumber {
|
||||
let a64s = new BigInt64Array(a.buffer);
|
||||
var res: MaxMinResult[] = [];
|
||||
for(var i = 0; i < args.writeData.length; i++) {
|
||||
if(args.writeData[i] != 0) {
|
||||
if(args.writeData[i] !== 0) {
|
||||
res.push({ch: i + 1, x: Number(a64u[i]), y: Number(a64s[i + maxCh])});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user