Skip to content

Macro command for change RS232 transmit delay time #437

Closed
1 of 1 issue completed
Closed

Description

@nmaya

The other request is macro. I do not think we could change RS232 serial port transmit delay time. Can you add a command to control the transmit delay time(msec/line)? Thanks in advance.

Originally posted by @renovictor in #433

Activity

  1. nmaya commented on Jan 27, 2025

    @nmaya
    MemberAuthor

    マクロコマンドで変更できる必要があるか、INIで指定できさえすればよいか、要検討

  2. added theissue type on Feb 24, 2025
  3. added this to the 5.5.0 milestone on Apr 10, 2025
  4. self-assigned this
    on Apr 10, 2025
  5. nmaya commented on Apr 10, 2025

    @nmaya
    MemberAuthor

    candidate of command name

    • setserialchardelay
    • setseriallinedelay
  6. nmaya commented on Aug 10, 2025

    @nmaya
    MemberAuthor

    I’ve added the feature, and we created a test binary.
    Can you check that it works properly?
    https://github.com/TeraTermProject/teraterm/actions/runs/16856155566

  7. hkanou commented on Aug 15, 2025

    @hkanou
    Member

    I confirmed the operation using com0com with a loopback from COM2 to COM1.

    I have sent PR #773 with the following modifications:

    1. Fixed it so that 0 can be specified for the transmission delay in milliseconds.
    2. Modified it so that changes to the transmission delay are reflected in the running macro (set in the ComVar structure: cv).
    3. Adjusted it so that the transmission delay is applied after the transmission buffer is empty (checked if the transmission buffer is empty using GetOutBuffInfo).
      This modification is because the sending of the send command and the transmission to the COM port are done asynchronously,
      so the change in transmission delay occurs after the sent data is cleared.
    4. Changed it so that the next macro command is executed after the transmission delay change is complete (modified to wait for WM_USER_DDECMNDEND).
      This is a fix related to point 3, ensuring that the return occurs after the transmission delay changes via the setserialdelaychar and setserialdelayline commands are completed.
    5. Changed the number of transmission buffers (sendmem_fifo) from 10 to unlimited.
      This modification is to prevent a shortage of the transmission buffer when the transmission delay is increased.

    I have added TTL files for operation confirmation:

    • tests/setserialdelay_1.ttl
    • tests/setserialdelay_2.ttl

    I would appreciate it if you could review the source.

    Other notes:

    • In tests/setserialdelay_2.ttl:
      • I found a bug where using send(ln)broadcast and send(ln)multicast can cause data loss. I will create a separate issue for this.
      • I discovered that even when executing commands in pairs with sendkcode and send, there are cases where they do not execute in the order of sendkcode -> send.
        It seems that increasing the transmission delay raises the frequency of occurrence.
        There is no solution yet.
    • The manual addition for the macro command is still pending:
      doc\ja\html\html\macro\command\setserialdelaychar.html
      doc\en\html\html\macro\command\setserialdelayline.html

    in Japanese

    com0comを使用して COM2 -> COM1 の折り返しで動作を確認しました。

    下記の修正を行う PR #773 をお送りさせて頂きました。

    1. 送信遅延ミリ秒に0を指定出来るよう修正
    2. 送信遅延の変更が起動中のマクロに反映されるよう修正 (ComVar構造体:cvに設定)
    3. 送信バッファが空になってから送信遅延が反映されるように修正 (GetOutBuffInfoで送信バッファが空か確認)
      sendコマンドの送信とCOMポートへの送信は非同期で行われるため、送信済のデータがなくなってから送信遅延の変更を行う修正です。
    4. 送信遅延の変更が終わってから次のマクロコマンドを実行するよう変更 (WM_USER_DDECMNDENDを待つよう修正)
      3.の関連でsetserialdelaychar, setserialdelayline コマンドによる送信遅延の変更が終わってから復帰する修正です。
    5. 送信バッファ(sendmem_fifo)の数を10から無制限に変更
      送信遅延を大きくした際、送信バッファが不足しないようにする修正です。

    動作確認用のTTLファイルを追加しました。

    • tests/setserialdelay_1.ttl
    • tests/setserialdelay_2.ttl

    ソースレビューをして頂けると助かります。

    その他

    • tests/setserialdelay_2.ttl
      • send(ln)broadcast, send(ln)multicastを使用すると送信データをロストする場合がある不具合が見つかりました。
        別 issue を起票します。
      • sendkcodeとsendのペアでコマンドを実行しても sendkcode -> send の順に実行されないケースがあることがわかりました。
        送信遅延を大きくすると発生頻度が上がるように見えます。
        対処は未です。
    • マクロコマンドのマニュアル追加は未です。
      doc\ja\html\html\macro\command\setserialdelaychar.html
      doc\en\html\html\macro\command\setserialdelayline.html
  8. 21 remaining items

  9. hkanou commented on Aug 23, 2025

    @hkanou
    Member

    main にマージさせて頂きました。
    本 issue をクローズ致します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions