Skip to content

Conversation

@dwhinham
Copy link
Contributor

Some devices (e.g. Heltec V3.1) are reset when the RTS or DTR pins are messed with, which means that without workarounds, Meshtastic CLI will cause a reset with any operation that opens the serial port.

This behavior is documented in this PySerial issue: pyserial/pyserial#124

On Linux, we already handle this by disabling the HUPCL termios flag, which has the effect of preventing the offending lines being toggled. On Windows, setting the initial state of RTS and DTR before opening the port has a similar effect.

Implement this workaround so that Meshtastic CLI can be used on Windows with these devices.

@CLAassistant
Copy link

CLAassistant commented Mar 20, 2025

CLA assistant check
All committers have signed the CLA.

Some devices (e.g. Heltec V3.1) are reset when the RTS or DTR pins are
messed with, which means that without workarounds, Meshtastic CLI will
cause a reset with any operation that opens the serial port.

This behavior is documented in this PySerial issue:
pyserial/pyserial#124

On Linux, we already handle this by disabling the HUPCL termios flag,
which has the effect of preventing the offending lines being toggled. On
Windows, setting the initial state of RTS and DTR before opening the
port has a similar effect.

Implement this workaround so that Meshtastic CLI can be used on Windows
with these devices.
@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.13%. Comparing base (32a61b0) to head (bc1664d).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
meshtastic/serial_interface.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #753      +/-   ##
==========================================
- Coverage   60.14%   60.13%   -0.01%     
==========================================
  Files          24       24              
  Lines        4062     4066       +4     
==========================================
+ Hits         2443     2445       +2     
- Misses       1619     1621       +2     
Flag Coverage Δ
unittests 60.13% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ianmcorvidae
Copy link
Contributor

Hi, sorry to get to this so slowly. I think this looks good, though I lack a windows machine to test it on, so I'll trust that this is beneficial on that platform for now.

@ianmcorvidae ianmcorvidae merged commit f426699 into meshtastic:master Mar 31, 2025
10 of 11 checks passed
@dwhinham
Copy link
Contributor Author

dwhinham commented Apr 1, 2025

Hi, sorry to get to this so slowly. I think this looks good, though I lack a windows machine to test it on, so I'll trust that this is beneficial on that platform for now.

No worries at all - thank you for merging! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants