Skip to content
New issue

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

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

Already on GitHub? # to your account

Bad color definitions #1

Open
JakubVanek opened this issue Aug 26, 2018 · 3 comments
Open

Bad color definitions #1

JakubVanek opened this issue Aug 26, 2018 · 3 comments

Comments

@JakubVanek
Copy link
Contributor

Hi,

I was looking into the LCD implementation and found that colors are defined improperly.
Upstream lejos.robotics.Color:

    public static final int RED = 0;
    public static final int GREEN = 1;
    public static final int BLUE = 2;
    public static final int YELLOW = 3;
    public static final int MAGENTA = 4;
    public static final int ORANGE = 5;
    public static final int WHITE = 6;
    public static final int BLACK = 7;
    public static final int PINK = 8;
    public static final int GRAY = 9;
    public static final int LIGHT_GRAY = 10;
    public static final int DARK_GRAY = 11;
    public static final int CYAN = 12;
    public static final int BROWN = 13;
    public static final int NONE = -1;

Local lejos.robotics.Color:

    public static final int NONE = 0;
    public static final int BLACK = 1;
    public static final int BLUE = 2;
    public static final int GREEN = 3;
    public static final int YELLOW = 4;
    public static final int RED = 5;
    public static final int WHITE = 6;
    public static final int MAGENTA = 4;
    public static final int ORANGE = 5;
    public static final int BROWN = 7;

Is there a reason for this change? I would like to add colors to ev3dev.actuators.LCD#setColor(int color), but this way there are duplicate switch branches.

Regards,

Jakub

@JakubVanek
Copy link
Contributor Author

Hmmm, upstream leJOS GraphicsLCD isn't using this enum, but this is still a bug.

    /**
     * Set the current drawing color. The value is in the format 0x00RRGGBB.
     * NOTE. Currently only black and white is supported. any non black color
     * is treated as white!
     * @param rgb new color.
     */
    public void setColor(int rgb);
    
    /**
     * Sets the current color to the specified RGB values.
     * @param red the red component
     * @param green the green component
     * @param blue the blue
     * @throws IllegalArgumentException if any of the color components
     * are outside of range <code>0-255</code>
     */
    public void setColor(int red, int green, int blue);

@jabrena
Copy link
Member

jabrena commented Aug 26, 2018

Yes, in EV3Dev, color are returned in that way by EV3 Color sensor

@jabrena
Copy link
Member

jabrena commented Aug 26, 2018

I didnt test that feature with LCD. But colors with monochrome... :p

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants