Skip to content
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

UNO R4 - Library(libraries) - will not build on new Arduino boards... And may not work at all. #127

Open
KurtE opened this issue Jul 24, 2023 · 2 comments

Comments

@KurtE
Copy link

KurtE commented Jul 24, 2023

Recently I started playing with the new Arduino UNO R4 boards (MINIMA and WIFI) - and yesterday I thought I would try it
So I pulled out my Dynamixel Servo Shield and plugged it into the Minima. I made sure my libraries were up to date.

Loaded the scan_dynamixel.ino example sketch and tried to compile it which failed. More details in the forum thread:
https://forum.arduino.cc/t/robotis-dynamixel-shield-code-does-not-compile/1150975

Found the issue was that Arduino defined: LED_RED and LED_BLUE

C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\variants\MINIMA\includes\ra_cfg\fsp_cfg\bsp\bsp_pin_cfg.h:
   10  #define A1 (BSP_IO_PORT_00_PIN_01)
   11  #define A2 (BSP_IO_PORT_00_PIN_02)
   12: #define LED_RED (BSP_IO_PORT_00_PIN_11)
   13  #define TX_LED (BSP_IO_PORT_00_PIN_12)
   14  #define LED_BLUE (BSP_IO_PORT_00_PIN_13)

C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\variants\UNOWIFIR4\includes\ra_cfg\fsp_cfg\bsp\bsp_pin_cfg.h:
   10  #define A1 (BSP_IO_PORT_00_PIN_01)
   11  #define A2 (BSP_IO_PORT_00_PIN_02)
   12: #define LED_RED (BSP_IO_PORT_00_PIN_11)
   13  #define TX_LED (BSP_IO_PORT_00_PIN_12)
   14  #define LED_BLUE (BSP_IO_PORT_00_PIN_13)

2 matches across 2 files

Which completely screws up anyone else who use these words in any way, including yours which should be safe,
as yours are contained in an enum, which is in a namespace, which is nice and clean.

I created an issue yesterday: arduino/ArduinoCore-renesas#64
Which they blew off and closed it with the response:
I suggest you open an issue with the Dynamixel library, we are likely going to keep those defines.

So here it is.

Not sure how many libraries, documents, examples, and the like this might impact. Nor if there are any other now new magic words, which may show up with additional testing.

Edit: If it were me, my fix for this would be to add something like this in your header file:

#ifdef LED_RED
#undef LED_RED
#undef LED_BLUE
#endif

Note: currently even if you "fix" this, their serial subsystem has lots of issues, including Serial1.flush() does not work, and as such the direction pin will change state before it should, and the packets are corrupted.
For example I had 18 servos and it only found 5... Some of this could be wiring connection issues, but mostly issues with their subsystems.

I have experimented with some updates to their serial code base (arduino/ArduinoCore-renesas#59), but this has not gained any traction, so not expecting that any of these issues will be fixed anytime soon.

@ROBOTIS-Will
Copy link
Collaborator

@KurtE

Hi, it's been a while talking to you :)
Yes, there are some definitions that are identical from the Arduino boards, and LED colors.
It seems even if we make modifications on those definition, it may not affect to our library.
However, there were a few cases when the Arduino users wanted to keep the LED_COLOR function so that they can control their own LED lights for other purpose.

I'll see if I can find some other workaround to resolve this issue.
Thanks for reporting

@KurtE
Copy link
Author

KurtE commented Jul 26, 2023

@ROBOTIS-Will - Yes been awhile. Hope all is well!

Been mostly playing around with Teensy boards and the like. Thought I would try out the new UNO boards.
They feel far more like an Alpha or Beta release than a real production release.

As for preserving the usage of their #defines, I personally would not worry much about that.
They maybe have a slight possibility of usage on MINIMA (keyword slight)

The defines are the same for both boards:

#define LED_RED (BSP_IO_PORT_00_PIN_11)
#define TX_LED (BSP_IO_PORT_00_PIN_12)
#define LED_BLUE (BSP_IO_PORT_00_PIN_13)

On MINIMA - P011 is not connected, P012 is connected to TX , P013 is connected to RX .

On WIFI - P011-P013 are connected to their 8x12 led matrix, which require knowledge on the setting of the different IO pins on the matrix. Charlieplexing

Locally I have mine hacked up like:

// -----------------------------------------------
// Kurts hack
#ifdef LED_RED
#undef LED_RED
#undef LED_BLUE
#endif

namespace ControlTableItem{
  enum ControlTableItemIndex{

Again hope all is well.

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

No branches or pull requests

2 participants