Skip to content

Allow compilation in absence of RS485 library #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sebromero
Copy link
Contributor

This PR allows to compile on Opta without the need to install the ArduinoRS485 library. ArduinoRS485 is only needed for debugging USB storage which occupies the USB port so debug prints need to go through RS485.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 17, 2025
@sebromero sebromero requested a review from per1234 July 2, 2025 08:39
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

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

An #include directive for ArduinoRS485.h should be added to examples/Logger/Logger.ino. The file already contains a conditional directive for the Opta, so that can be moved to above the #include directive for Arduino_UnifiedStorage.h line and the #include <ArduinoRS485.h> placed inside that conditional.

An #include directive for ArduinoRS485.h should also be added to the sketches under extras/test.

#include <Arduino_UnifiedStorage.h>

void setup(){
debugPrint("I'm alive!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
debugPrint("I'm alive!");
Arduino_UnifiedStorage::debugPrint("I'm alive!");

@@ -65,3 +65,16 @@ This limitation only affects Portenta C33 boards.
## 📖 Documentation

For more information about this library please read the documentation [here](./docs).

## 🐛 Debugging

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
One of two methods are typically used to debug programs:
- Adding code to print program status information to the serial port (e.g., `Serial.print` calls), which can be viewed in [Serial Monitor](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-serial-monitor)
- "[In-circuit emulation](https://en.wikipedia.org/wiki/In-circuit_emulation)" using a debug probe and [debugger](https://en.wikipedia.org/wiki/Debugger)

Add an introductory overview. This will make it easier for the reader to understand the nature of the dilemma presented in the subsequent sentences.


## 🐛 Debugging

Printing debug messages over the USB Serial port is not possible when the USB port is used for data storage operations. On Arduino Opta this is the only accessible option however, since no JTAG connector is exposed. Therefore you need to resort to the RS485 connector to see the output of your messages. To do so you can use the `debugPrint` function from this library. In order to make it work you will have to install the `ArduinoRS485` library beforehand and add the corresponding header in your sketch above the include for this library. e.g.
Copy link
Contributor

@per1234 per1234 Jul 2, 2025

Choose a reason for hiding this comment

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

Suggested change
Printing debug messages over the USB Serial port is not possible when the USB port is used for data storage operations. On Arduino Opta this is the only accessible option however, since no JTAG connector is exposed. Therefore you need to resort to the RS485 connector to see the output of your messages. To do so you can use the `debugPrint` function from this library. In order to make it work you will have to install the `ArduinoRS485` library beforehand and add the corresponding header in your sketch above the include for this library. e.g.
Printing debug messages over the USB Serial port is not possible when the USB port is used for data storage operations. When using Arduino Opta, the alternative "in-circuit emulation" approach is also unavailable due to not having an exposed JTAG connector. Therefore in order to debug programs on the Opta you must resort to using the RS485 connector to see the output of your messages. To do so you can use the `debugPrint` function from this library. In order to make it work you will have to install the `ArduinoRS485` library beforehand and add an `#include` directive for that library in your sketch above the include for this library. e.g.
  • Reference information provided by the overview I proposed.
  • Make it more clear that the information re: RS-485 is specific to Opta.
  • Minor improvements to wording.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants