Skip to content

Conversation

@NestorDP
Copy link
Owner

Summary

  • What does this PR do? Why is it needed?
  • Link related issues (e.g., Closes #123)

Changes

  • API changes
  • Behavior changes
  • Docs updated
  • Tests added/updated

Details

  • Briefly list the key changes and files touched

How to test

  • Commands and steps to validate locally
  • Include any environment requirements (Linux only, kernel version, etc.)

Screenshots/Logs (optional)

  • Paste relevant output/logs if helpful

Checklist

  • Builds locally (Release + Debug)
  • All tests pass (if applicable)
  • Lint/format pass: make cppcheck / make cpplint / make uncrustify
  • Example(s) tested (if touched)
  • Documentation updated (README/docs)

Risks and rollbacks

  • Potential impact areas, and how to revert if needed

@NestorDP NestorDP requested a review from Copilot October 31, 2025 21:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Suggested change
libserial::Serial serial();
libserial::Serial serial;

Copilot uses AI. Check for mistakes.
docs/usage.rst Outdated
libserial::Serial serial("/dev/ttyUSB0");
serial.open();
libserial::Serial serial();
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copilot uses AI. Check for mistakes.
docs/usage.rst Outdated
try {
libserial::Serial serial("/dev/ttyUSB0");
serial.open();
libserial::Serial serial();
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Suggested change
libserial::Serial serial();
libserial::Serial serial;

Copilot uses AI. Check for mistakes.
Comment on lines +345 to +347
std::cout << "Number of devices found: " << num_ports + 1 << std::endl;
for (uint16_t i = 0; i <= num_ports; ++i) {
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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) {

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@NestorDP NestorDP merged commit 87efd99 into main Oct 31, 2025
3 of 4 checks passed
@NestorDP NestorDP deleted the feat-improve-exemples-docs branch October 31, 2025 22:08
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.

2 participants