avishorp / TM1637

Arduino library for TM1637 (LED Driver)
GNU Lesser General Public License v3.0
427 stars 218 forks source link

Add Colon support #87

Open bastiengrignon opened 3 years ago

bastiengrignon commented 3 years ago

Adding a new feature to support usage of colon (see new example)

@avishorp this could be interesting to have a new feature to this library

riraosan commented 3 years ago

@bastiengrignon I like this request. It can be used in my project. Thanks.

bastiengrignon commented 3 years ago

I'm actually using a modified version of your library for years but didn't think and took the time to make it a new feature for others.

Time has come 😄

stef-ladefense commented 3 years ago

I'm actually using a modified version of your library for years but didn't think and took the time to make it a new feature for others.

Time has come 😄

hi, have tested your version support dot with your TM1637Colon exemple don't work correctly with dot on -> "16:45" without dot -> "18 45"

correction : change "writeByte(segments[k] | 0x7f); // Set colon OFF" by -> "writeByte(segments[k] & ~0x80); // Set colon OFF" in your "TM1637Display::setSegments" (line 111)

stef-ladefense commented 3 years ago

I'm actually using a modified version of your library for years but didn't think and took the time to make it a new feature for others.

Time has come 😄

see https://github.com/stef-ladefense/TM1637

avishorp commented 3 years ago

In the design of the library, I tried to keep it as stateless as possible (with brightness being the only exception). Your suggestion contradicts this principle. Moreover, setSegments just sends the value to the display, setting the colon on or off is just a matter of setting the right bits, there is no need for a special function to do that.