RGB.on() and .off() saves color state

Led.RGB.on() and Led.RGB.off() weren’t saving color state.

It was also treating the RGB as individual LEDs and calling Led.on()
was causing unexpected results because there isn’t the concept of
individual brightness on the RGB pins. (It just produced unexpected
color combinations rather than “dimming” them.)

This simplified implementation will need to be revisited when/if #375
is addressed, but at least it’s consistent and intuitive for now.
Led.RGB.on() is essentially the same as Led.RGB.color(“#ffffff”) with
this update.

Color also wasn’t being checked for in the shape tests for RGB (both
varieties)

Fixes #445
This is awesome—really good bugs here :)

> But neither the existing implementation nor my patch address saving the previous color. I was just trying to at least get it to a consistent state.


Yep, and that definitely needs to be fixed.

> In the existing implementation, with or without the call to .on(), you get strange results:

This was all naively implemented, I apologize.




> See how it's treating each color independently? For an RGB it needs to think of them as three parts of a whole.

Agreed.

> Instead of hard coding the white value like I did in this PR, I could do an isOn check against all three colors and just return immediately if ANY of them are already on. At least then you wouldn't get that strange behavior above.

Do it.


> (But still wouldn't honor previous color after a call to .off())

> Or I could do a new PR that addresses this issue and #375 together?
I'm happy to do that, it's just a larger undertaking and I've got a couple questions to clarify behavior.

Let's fix all the bugs, I'll let you decide if that's two patches or one.

> After creating an RGB led instance, .color() returns { red: 0, green: 0, blue: 0 }
After a call to .on(), what should .color() return? { red: 255, green: 255, blue: 255 }?

I would say yes to 255 across, but what do you think?


> If I set .color("#ff0000") .color() should return { red: 255, green: 0, blue: 0 }

What happens when isAnode is set? The inverse or do we normalize? I vote normalize, otherwise it will be really confusing to get the opposite of what you'd expect "blue" to be.

> After a call to .off(), what should .color() return? The same? or { red: 0, green: 0, blue: 0 }
i.e. does it return the "saved" previous color or the current state of the led?

It should return the saved color. 

> And all the other functions will have to be updated to honor and save the previous color too where applicable: "toggle", "brightness", "fade", "fadeIn", "fadeOut", "pulse", "strobe", "stop". Like the .on() function, they will need to treat the three colors as a whole instead of individually like they are now.

Makes sense, let's do it.