Add testing COM connection to knob

This commit is contained in:
GHOSCHT 2021-07-10 16:28:20 +02:00
parent e89d12f13b
commit 12168899d1
2 changed files with 14 additions and 13 deletions

View file

@ -20,20 +20,24 @@ const App = () => {
baudRate: 9600, baudRate: 9600,
autoOpen: false, autoOpen: false,
}); });
const handler = () => { const sendIncreaseHandler = () => {
// eslint-disable-next-line port.write("2i");
port.write("off", (err) => { };
if (err) { const sendDecreaseHandler = () => {
return console.log("Error on write: ", err.message); port.write("2d");
} };
console.log("message written"); const sendToggleHandler = () => {
}); port.write("2t");
}; };
return ( return (
<div> <div>
<GlobalStyle /> <GlobalStyle />
<Knob increase={() => { console.log("inc"); }} decrease={() => { console.log("dec"); }} toggle={() => { console.log("togg"); }} /> <Knob
increase={sendIncreaseHandler}
decrease={sendDecreaseHandler}
toggle={sendToggleHandler}
/>
<button <button
type="button" type="button"
onClick={() => { onClick={() => {
@ -50,9 +54,6 @@ const App = () => {
> >
close close
</button> </button>
<button type="button" onClick={handler}>
send
</button>
<button <button
type="button" type="button"
onClick={() => { onClick={() => {

View file

@ -3,7 +3,7 @@ import styled from "styled-components";
import { remote } from "electron"; import { remote } from "electron";
const SvgHeight = 180; const SvgHeight = 180;
const steps = 10; const steps = 5;
const accentColor = remote.systemPreferences.getAccentColor(); const accentColor = remote.systemPreferences.getAccentColor();
const KnobSVG = styled.svg` const KnobSVG = styled.svg`