feat(scripting): wait settles until device is idle before matching
After finding the keyword, wait requires the receive buffer to stay quiet for ~300ms (no new bytes) and consumes up to the LAST occurrence. This rejects matches on echoed command prompts (e.g. 'SVOS> help') mid-output, preventing the script from racing ahead. Applies to all wait-based loops without per-command markers.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
|------|------|------|
|
||||
| `send` | `send '文字'` | 送出文字(不加換行)到 active session。 |
|
||||
| `sendln` | `sendln '文字'` | 送出文字並附加 `\r\n`。 |
|
||||
| `wait` | `wait '字串'` | **一直等到**接收緩衝出現指定字串才往下;預設無限等待(可按 Stop 取消)。命中後 `result=1` 並清掉緩衝中該字串(含)之前的內容。 |
|
||||
| `wait` | `wait '字串'` | **一直等到**接收緩衝出現指定字串才往下;預設無限等待(可按 Stop 取消)。命中後會再確認裝置「安靜」約 300ms(無新資料)才接受,以排除夾在輸出中途的回顯(如 `SVOS> help`),並消費到該字串**最後一次**出現(含)之前的內容,`result=1`。 |
|
||||
| `pause` | `pause 秒數` | 暫停指定秒數(可被 Stop 中止)。 |
|
||||
| `timeout` | `timeout = 秒數` | 設定 `wait` 的逾時秒數。預設 `0`=無限等待;若設為 `N>0`,`wait` 超過 N 秒仍未命中會**中止整個腳本並報錯**(不會略過 `wait` 往下做)。 |
|
||||
| `flushrecv` | `flushrecv` | 清空接收緩衝區。 |
|
||||
|
||||
Reference in New Issue
Block a user