Misc fixes

This commit is contained in:
Sacha Weatherstone
2021-12-17 23:09:17 +11:00
parent 8b221e28c5
commit 87dcf35547
14 changed files with 239 additions and 89 deletions
+11 -1
View File
@@ -3,13 +3,15 @@ import React from 'react';
import { useForm } from 'react-hook-form';
import { FiCheck } from 'react-icons/fi';
import { useAppDispatch } from '@app/hooks/redux';
import { Button } from '@components/generic/Button';
import { IconButton } from '@components/generic/IconButton';
import { serial, setConnection } from '@core/connection';
import { connType } from '@core/slices/appSlice';
import { connType, setConnectionParams } from '@core/slices/appSlice';
export const Serial = (): JSX.Element => {
const [serialDevices, setSerialDevices] = React.useState<SerialPort[]>([]);
const dispatch = useAppDispatch();
const { register, handleSubmit, control } = useForm<{
device?: SerialPort;
@@ -45,6 +47,14 @@ export const Serial = (): JSX.Element => {
</div>
<IconButton
onClick={async (): Promise<void> => {
dispatch(
setConnectionParams({
type: connType.SERIAL,
params: {
port: device,
},
}),
);
await setConnection(connType.SERIAL);
}}
icon={<FiCheck />}