fix(core): 修复一些情况下板卡无法进入waiting for download模式

This commit is contained in:
王立帮
2025-10-26 19:40:22 +08:00
parent 69508845a2
commit f9d3427b20
2 changed files with 19 additions and 3 deletions

View File

@@ -110,7 +110,11 @@ class Transport {
async setRTS(state) {
await this.serial.setRTS(state);
if (this.tracing) this.trace(`Set RTS = ${state}`);
await this.serial.setDTR(this.serial.getDTR());
if (this.tracing) {
this.trace(`Set RTS = ${state}`);
this.trace(`Set DTR = ${this.serial.getDTR()}`);
}
}
async setDTR(state) {

View File

@@ -224,11 +224,23 @@ class WebSerialPort extends Serial {
}
async setDTR(dtr) {
return this.setDTRAndRTS(dtr, this.getRTS());
if (!this.isOpened()) {
return;
}
await this.#serialport_.setSignals({
dataTerminalReady: dtr
});
super.setDTR(dtr);
}
async setRTS(rts) {
return this.setDTRAndRTS(this.getDTR(), rts);
if (!this.isOpened()) {
return;
}
await this.#serialport_.setSignals({
requestToSend: rts
});
super.setRTS(rts);
}
getVID() {