Add testing COM connection to knob
This commit is contained in:
parent
e89d12f13b
commit
12168899d1
2 changed files with 14 additions and 13 deletions
|
@ -20,20 +20,24 @@ const App = () => {
|
|||
baudRate: 9600,
|
||||
autoOpen: false,
|
||||
});
|
||||
const handler = () => {
|
||||
// eslint-disable-next-line
|
||||
port.write("off", (err) => {
|
||||
if (err) {
|
||||
return console.log("Error on write: ", err.message);
|
||||
}
|
||||
console.log("message written");
|
||||
});
|
||||
const sendIncreaseHandler = () => {
|
||||
port.write("2i");
|
||||
};
|
||||
const sendDecreaseHandler = () => {
|
||||
port.write("2d");
|
||||
};
|
||||
const sendToggleHandler = () => {
|
||||
port.write("2t");
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<GlobalStyle />
|
||||
<Knob increase={() => { console.log("inc"); }} decrease={() => { console.log("dec"); }} toggle={() => { console.log("togg"); }} />
|
||||
<Knob
|
||||
increase={sendIncreaseHandler}
|
||||
decrease={sendDecreaseHandler}
|
||||
toggle={sendToggleHandler}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
|
@ -50,9 +54,6 @@ const App = () => {
|
|||
>
|
||||
close
|
||||
</button>
|
||||
<button type="button" onClick={handler}>
|
||||
send
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import styled from "styled-components";
|
|||
import { remote } from "electron";
|
||||
|
||||
const SvgHeight = 180;
|
||||
const steps = 10;
|
||||
const steps = 5;
|
||||
const accentColor = remote.systemPreferences.getAccentColor();
|
||||
|
||||
const KnobSVG = styled.svg`
|
||||
|
|
Reference in a new issue