espressif / esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
https://espressif.github.io/esptool-js/
Apache License 2.0
276 stars 108 forks source link

Can I use transport for sending string commands over serial? #60

Closed domagojk closed 1 year ago

domagojk commented 1 year ago

I am trying to send a command using Transport but I am stuck...

Without esptool-js, I was able to send those commands like this:

function send(command: string) {
    const encoder = new TextEncoder();
    const dataArrayBuffer = encoder.encode(command);
    const writer = this.serialPort.writable.getWriter();
    await writer.write(dataArrayBuffer);
    writer.releaseLock();
}

but this no longer works after ESPLoader is synced so I tried using Transporter:

function send(command: string) {
    const encoder = new TextEncoder();
    const dataArrayBuffer = encoder.encode(command);
    await this.transport.write(dataArrayBuffer);
}

However, I got no response... Could someone help me out?

domagojk commented 1 year ago

nevermind, I managed to use the "old method" of sending commands after hard reseting