Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the documentation to reflect API changes in the libserial library. The changes demonstrate a significant refactoring of the serial communication interface, moving from constructor-based port configuration to a more flexible open/configure pattern.
- Updated API usage patterns across all documentation examples
- Modified serial port initialization from constructor-based to separate open() calls
- Replaced old API methods with new equivalents (e.g.,
available()→getAvailableData(),setTimeout()→setReadTimeout())
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/usage.rst | Updated all code examples to use new API patterns including default constructors, explicit open() calls, and renamed methods |
| docs/examples.rst | Replaced example code with updated implementations, commented out outdated examples, and updated port discovery example |
| README.md | Reordered badge placement and commented out example application section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
docs/usage.rst
Outdated
| try { | ||
| libserial::Serial serial("/dev/ttyUSB0"); | ||
| serial.open(); | ||
| libserial::Serial serial(); |
There was a problem hiding this comment.
This line declares a function named serial that returns a libserial::Serial object (most vexing parse), not a Serial object instance. Remove the parentheses to create an instance: libserial::Serial serial;
| libserial::Serial serial(); | |
| libserial::Serial serial; |
docs/usage.rst
Outdated
| libserial::Serial serial("/dev/ttyUSB0"); | ||
| serial.open(); | ||
|
|
||
| libserial::Serial serial(); |
There was a problem hiding this comment.
This line declares a function named serial that returns a libserial::Serial object (most vexing parse), not a Serial object instance. Remove the parentheses to create an instance: libserial::Serial serial;
docs/usage.rst
Outdated
| try { | ||
| libserial::Serial serial("/dev/ttyUSB0"); | ||
| serial.open(); | ||
| libserial::Serial serial(); |
There was a problem hiding this comment.
This line declares a function named serial that returns a libserial::Serial object (most vexing parse), not a Serial object instance. Remove the parentheses to create an instance: libserial::Serial serial;
| libserial::Serial serial(); | |
| libserial::Serial serial; |
| std::cout << "Number of devices found: " << num_ports + 1 << std::endl; | ||
|
|
||
| for (uint16_t i = 0; i <= num_ports; ++i) { |
There was a problem hiding this comment.
Off-by-one error in device count. If scanPorts() returns the count of ports found, adding 1 will show an incorrect count. This should likely be just num_ports without the + 1.
| std::cout << "Number of devices found: " << num_ports + 1 << std::endl; | |
| for (uint16_t i = 0; i <= num_ports; ++i) { | |
| std::cout << "Number of devices found: " << num_ports << std::endl; | |
| for (uint16_t i = 0; i < num_ports; ++i) { |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Changes
Details
How to test
Screenshots/Logs (optional)
Checklist
make cppcheck/make cpplint/make uncrustifyRisks and rollbacks