well, so code is incomplete - because I need to somehow mark syncColors so I can query them when receiving value from syncColors. e.g. I receive COLOR_1 which is 0x41, and that corresponds to syncColor[0].
but how to do it without having additional array for mapping.
And yes I am aware that syncColors[0x41] is no valid, it was just to illustrate what I want to achieve
yes, I am aware of that... but how can I shape those arrays/enums so I can have something common in both to query them by the same value. like e.g 0x41 could be converted to integer and by this integer maybe I can query syncColors.
That's why I am asking now I am in planning phase and trying to thing how I can have those 2 different arrays associated together maybe something like Associative arrays in C++ - GeeksforGeeks
But that seems not to be available in arudino ide
That's the thing, I am not stuck with them and I can change them as I wish, but I just don't have a clever Idea. My first thought was just because there is only couple of them, I could create some helper method with switch in it to find my what I need. but wanted to be clever
The numbers are all pretty close to one another. You oculd sort them out and see if you could do some transform. floor((c(0x41,0x45,0x49,0x4d,0x51)-0x40)^.6)-1 looks promising...but unmaintainable.
A lookup array or a switch would be sufficiently clever.
If the upper and lower values are not too different than I would simply put up with the fact that you are going to waste some memory holding intermediate but unused array elements.
Put the array in PROGMEM and it is not going to matter much anyway