From 08a38bbf6143b1d60078526c80cd07474f26642d Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 12 Dec 2021 12:23:15 +0100 Subject: [PATCH] serial: slow feed mode - fixes #4901 --- tabby-serial/src/api.ts | 9 ++++++++- .../src/components/serialProfileSettings.component.pug | 6 ++++++ tabby-serial/src/profiles.ts | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tabby-serial/src/api.ts b/tabby-serial/src/api.ts index 84b992e5..7fba2306 100644 --- a/tabby-serial/src/api.ts +++ b/tabby-serial/src/api.ts @@ -20,6 +20,7 @@ export interface SerialProfileOptions extends StreamProcessingOptions, LoginScri xon?: boolean xoff?: boolean xany?: boolean + slowSend?: boolean } export const BAUD_RATES = [ @@ -123,7 +124,13 @@ export class SerialSession extends BaseSession { } write (data: Buffer): void { - this.streamProcessor.feedFromTerminal(data) + if (!this.profile.options.slowSend) { + this.streamProcessor.feedFromTerminal(data) + } else { + for (const byte of data) { + this.streamProcessor.feedFromTerminal(Buffer.from([byte])) + } + } } async destroy (): Promise { diff --git a/tabby-serial/src/components/serialProfileSettings.component.pug b/tabby-serial/src/components/serialProfileSettings.component.pug index cd7d86d1..60a79259 100644 --- a/tabby-serial/src/components/serialProfileSettings.component.pug +++ b/tabby-serial/src/components/serialProfileSettings.component.pug @@ -77,6 +77,12 @@ ul.nav-tabs(ngbNav, #nav='ngbNav') .title Xany toggle([(ngModel)]='profile.options.xany') + .form-line + .header + .title Slow feed + .description Sends data one byte at a time + toggle([(ngModel)]='profile.options.slowFeed') + li(ngbNavItem) a(ngbNavLink) Login scripts ng-template(ngbNavContent) diff --git a/tabby-serial/src/profiles.ts b/tabby-serial/src/profiles.ts index e83ce488..d32e1d53 100644 --- a/tabby-serial/src/profiles.ts +++ b/tabby-serial/src/profiles.ts @@ -30,6 +30,7 @@ export class SerialProfilesService extends ProfileProvider { inputNewlines: null, outputNewlines: null, scripts: [], + slowSend: false, }, }