MrYsLab / telemetrix

A user-extensible replacement for StandardFirmata. All without the complexity of Firmata!
GNU Affero General Public License v3.0
67 stars 26 forks source link

Discard any input from device after reset #75

Closed yaqwsx closed 8 months ago

yaqwsx commented 8 months ago

Hi, first, thank you for the project. It was quite easy to get started.

I run into a problem when using it with ESP32 Dev Modules. They output bootloader logs on the default serial line upon restart. On Windows, you get Invalid Arduino ID: []. Windows toggles DTR lines when you open a port, which restarts the module. The bootloader messages get into the input buffer, confusing the stream parser.

The bootloader messages can be disabled by flashing a custom bootloader or by keeping a given bootstrap pin low during reset; however, such a solution is not beginner-friendly.

I propose to discard the input buffer after opening the port. It should be safe as no meaningful communication should happen before we actually ask for the Arduino ID.

MrYsLab commented 8 months ago

Thanks for the pull request. It is available in release 1.37. You may not be aware of this, but there is a version of telemetrix specifically for ESP32 WIFI and BLE.