【问题标题】:Tera Term Language: wait doesn't wait for timeout to endTera Term Language:等待不等待超时结束
【发布时间】:2021-05-03 13:44:33
【问题描述】:

我正在尝试编写一个宏来加快测试的设置。

我要做的就是向我的板子发送一堆配置命令,然后在每个命令之后等待“ok”。最后一个命令是开始测试的命令,之后我想等待最多 30 秒才能得到某个答案。问题是,即使我设置了超时,所有命令都是一个接一个地发送,而不是等待超时,测试一开始就结束。我错过了什么吗?

这是我的代码:

send 'command 1'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'command 2'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'command 3'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'command 4'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'command 5'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'command 6'

timeout = 5             ;timeout set to 5 seconds
wait 'ok'

send 'test start'

timeout = 30                ;timeout set to 30 seconds
wait 'the response I want'

if result = 1 goto pass
if result = 0 goto fail

【问题讨论】:

    标签: timeout wait ttl term tera


    【解决方案1】:

    在寻找其他问题时偶然发现了您的问题。

    Timeout 用于表示“如果某件事在 X 时间内没有完成,则继续”,只需要设置一次。您还想在发送命令之前设置它。

    在你的情况下

    Timeout = 5
    Send 'Command'
    Wait 'OK'
    Send 'Command'
    Wait 'OK'
    Timeout = 30
    Send 'Command'
    Wait 'OK'
    

    您可能还希望使用 MPause 在它们之间添加一个轻微的暂停,以防止它们像旧调制解调器那样相互绊倒。

    Send 'Command'
    Wait 'OK'
    MPause 50
    Send 'Command'
    Wait 'OK'
    

    根据您的操作,可能还值得将 Sends 和 Waits 更改为 SendLn 和 WaitLn,它们将发送带有命令的新行并等待带有新行的响应,这很常见。

    警告,但 TeraTerm 有点混乱,而且有点受限。如果您可以使用真实的语言,我会这样做。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-31
      • 2013-12-03
      • 1970-01-01
      • 2022-01-16
      相关资源
      最近更新 更多