corneliusmunz / legoino

Arduino Library for controlling Powered UP and Boost controllers
MIT License
257 stars 34 forks source link

Duplo train - Invalid color name for no-color #31

Closed Gcopper1984 closed 3 years ago

Gcopper1984 commented 3 years ago

Hello once again.

I try the DuploTrainBase example and work properly with my board.

But I noticed that if I lift the train base the callback function report a color of (int) 255 so in the serial display appear an invalid name (something that is readed like "???").

Could be useful add another color named "nocolor" (for example) in the COLOR_STRING array or map the color id > 10 as "black" in the parseColor() function.

Thank you,

GC84

corneliusmunz commented 3 years ago

Hi @Gcopper1984 ! Very good finding! I will fix this and add an additional Color in the Color array

corneliusmunz commented 3 years ago

Will be fixed together with your proposed change in the next released version 1.0.2. I have introduced now a new entry in the COLOR_STRING array and added a static funtion which handles the conversion from color/int to a string. This method will handle all color values above NUM_COLORS as "none".

corneliusmunz commented 3 years ago

fixed with release https://github.com/corneliusmunz/legoino/releases/tag/1.0.2