Fix: 修复串口在只接收 "\n" 时不会自动换行

This commit is contained in:
王立帮
2025-02-22 01:52:56 +08:00
parent e751fa9652
commit 044840def3

View File

@@ -145,8 +145,8 @@ class Serial {
// 如果当前字节是 "_"
this.#specialLength_ = 2;
this.#special_.push(String.fromCharCode(byte));
} else if (byte !== 0x0A) {
// 如果当前字节是 "\n"
} else if (byte !== 0x0D) {
// 如果当前字节是 "\r"
if (this.#specialLength_) {
this.#specialLength_--;
this.#special_.push(String.fromCharCode(byte));