Skip to content

Commit 8add2e3

Browse files
committed
WIP hard reset fix
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
1 parent d7142e8 commit 8add2e3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/picoMpyCom.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,12 @@ export class PicoMpyCom extends EventEmitter {
118118
}
119119
};
120120
this.once(PicoSerialEvents.interrupt, onInter);
121-
readUntil(this.serialPort, 2, "\n>>> ", null, this.followReset)
121+
readUntil(this.serialPort, 2, ">OK", null, this.followReset)
122122
.catch(() => {
123123
// Do nothing
124124
})
125125
.finally(() => {
126+
this.serialPort?.write(BUFFER_CR);
126127
this.resetInProgress = false;
127128
this.followReset = undefined;
128129
this.off(PicoSerialEvents.relayInput, onRelayInput);

src/serialHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ del __pe_RTC
15541554
// TODO: needs more work to be able to continue connection and receive output
15551555
export function hardReset(port: SerialPort): void {
15561556
stopRunningStuff(port);
1557-
port.write("\rimport machine\nmachine.reset()");
1557+
port.write(Buffer.from("\rimport machine\nmachine.reset()", "utf-8"));
15581558
port.write(BUFFER_04);
15591559
}
15601560

0 commit comments

Comments
 (0)