Skip to content

Commit

Permalink
Added ability to send break signal on Enter key press.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbmhunter committed Jun 15, 2024
1 parent 96bf7dd commit 0cc80a5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Clicking on the many of the indicators in the bottom status bar takes you to the settings view where you can change the related settings.
- Added accordions to the terminal right-hand drawer, and added more controls such as quick port settings.
- The terminal right-hand drawer now remembers if it was open or closed. This info is also saved in each profile.
- The terminal right-hand drawer now remembers if it was open or closed. This info is also saved in each profile.
- Added to option to send a break signal on Enter key press.

### Changed

Expand Down
2 changes: 2 additions & 0 deletions src/model/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ export class App {
} else if (this.settings.txSettings.enterKeyPressBehavior === EnterKeyPressBehavior.SEND_CRLF) {
bytesToWrite.push(0x0d);
bytesToWrite.push(0x0a);
} else if (this.settings.txSettings.enterKeyPressBehavior === EnterKeyPressBehavior.SEND_BREAK) {
await this.sendBreakSignal();
} else {
throw Error('Unsupported enter key press behavior!');
}
Expand Down
1 change: 1 addition & 0 deletions src/model/Settings/TxSettings/TxSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum EnterKeyPressBehavior {
SEND_LF,
SEND_CR,
SEND_CRLF,
SEND_BREAK, // Send the break signal (not a character)
}

export enum BackspaceKeyPressBehavior {
Expand Down
34 changes: 21 additions & 13 deletions src/view/Settings/TxSettings/TxSettingsView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Checkbox, FormControl, FormControlLabel, FormLabel, InputAdornment, Radio, RadioGroup, Tooltip } from "@mui/material";
import { observer } from "mobx-react-lite";
import { Checkbox, FormControl, FormControlLabel, FormLabel, InputAdornment, Radio, RadioGroup, Tooltip } from '@mui/material';
import { observer } from 'mobx-react-lite';

import TxSettings, { BackspaceKeyPressBehavior, DeleteKeyPressBehavior, EnterKeyPressBehavior } from "src/model/Settings/TxSettings/TxSettings";
import BorderedSection from "src/view/Components/BorderedSection";
import TxSettings, { BackspaceKeyPressBehavior, DeleteKeyPressBehavior, EnterKeyPressBehavior } from 'src/model/Settings/TxSettings/TxSettings';
import BorderedSection from 'src/view/Components/BorderedSection';

interface Props {
txSettings: TxSettings;
Expand All @@ -12,11 +12,15 @@ function TxSettingsView(props: Props) {
const { txSettings } = props;

return (
<div style={{ display: "flex", flexDirection: "column", alignItems: "start" }}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }}>
{/* =============================================================================== */}
{/* ENTER PRESSED */}
{/* =============================================================================== */}
<BorderedSection title="Enter" childStyle={{ display: "flex", flexDirection: "column" }} style={{ width: "400px" }}>
<BorderedSection
title="Enter"
childStyle={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}
style={{ width: '400px' }}
>
{/* BACKSPACE */}
<FormControl>
<FormLabel>When enter is pressed:</FormLabel>
Expand All @@ -38,17 +42,21 @@ function TxSettingsView(props: Props) {
<Tooltip title="Send both the carriage return and line feed chars (0x0D 0x0A) when the Enter key is pressed." placement="right" arrow>
<FormControlLabel value={EnterKeyPressBehavior.SEND_CRLF} control={<Radio />} label="Send CRLF (0x0D 0x0A)" />
</Tooltip>
{/* SEND BREAK */}
<Tooltip title="Send a break signal when the Enter key is pressed." placement="right" arrow>
<FormControlLabel value={EnterKeyPressBehavior.SEND_BREAK} control={<Radio />} label="Send a break signal" />
</Tooltip>
</RadioGroup>
</FormControl>
</BorderedSection>
{/* =============================================================================== */}
{/* ROW FOR DELETE AND BACKSPACE */}
{/* =============================================================================== */}
<div style={{ display: "flex" }}>
<div style={{ display: 'flex' }}>
{/* =============================================================================== */}
{/* COL1: BACKSPACE */}
{/* =============================================================================== */}
<BorderedSection title="Backspace" childStyle={{ display: "flex", flexDirection: "column" }}>
<BorderedSection title="Backspace" childStyle={{ display: 'flex', flexDirection: 'column' }}>
{/* BACKSPACE */}
<FormControl>
<FormLabel>When backspace is pressed:</FormLabel>
Expand All @@ -72,7 +80,7 @@ function TxSettingsView(props: Props) {
{/* =============================================================================== */}
{/* COL2: DELETE */}
{/* =============================================================================== */}
<BorderedSection title="Delete" childStyle={{ display: "flex", flexDirection: "column" }}>
<BorderedSection title="Delete" childStyle={{ display: 'flex', flexDirection: 'column' }}>
<FormControl>
<FormLabel>When delete is pressed:</FormLabel>
<RadioGroup
Expand Down Expand Up @@ -100,12 +108,12 @@ function TxSettingsView(props: Props) {
</RadioGroup>
</FormControl>
</BorderedSection>
</div>{" "}
</div>{' '}
{/* End of row for TX */}
{/* =============================================================================== */}
{/* META KEYS */}
{/* =============================================================================== */}
<BorderedSection title="Meta Keys" childStyle={{ display: "flex", flexDirection: "column" }}>
<BorderedSection title="Meta Keys" childStyle={{ display: 'flex', flexDirection: 'column' }}>
{/* =============================================================================== */}
{/* CTRL KEYS */}
{/* =============================================================================== */}
Expand All @@ -120,7 +128,7 @@ function TxSettingsView(props: Props) {
/>
}
label="Send 0x01-0x1A when Ctrl+A thru Ctrl+Z is pressed"
sx={{ marginBottom: "10px" }}
sx={{ marginBottom: '10px' }}
/>
</Tooltip>
{/* =============================================================================== */}
Expand All @@ -142,7 +150,7 @@ function TxSettingsView(props: Props) {
/>
}
label="Send [ESC] + <char> when Alt-<char> is pressed (e.g. Alt-A sends 0x1B 0x41)."
sx={{ marginBottom: "10px" }}
sx={{ marginBottom: '10px' }}
/>
</Tooltip>
</BorderedSection>
Expand Down

0 comments on commit 0cc80a5

Please sign in to comment.