Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for 0.56" 7-Segment LED Backpack with floating point and raw segment addressing #8900

Merged
merged 5 commits into from
Jul 14, 2020

Conversation

tthk
Copy link
Contributor

@tthk tthk commented Jul 14, 2020

Description:

The 0.56" 7-Segment LED display from Adafruit with I2C backpack has a decimal point on each digit which may used in the display to show a floating point number.

Added support for this display, and also code to allow showing floating point number, as well as addressing every addressable segment of every digit.

This fix adds the f and r modifier prefixes to xdsp_11_sevenseg display driver:
From the code:

    // [optional prefix(es) chars]digits
    // Some combinations won't make sense.
    // Reference: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-led-backpack.pdf
    // This code has been tested on 1.2" and 0.56" 7-Segment LED displays, but should mostly work for others.
    // 
    // Prefixes:
    // x  upcoming decimal integer number displayed as hex
    // :  turn on middle colon
    // ^  turn on top left dot
    // v  turn on bottom left dot
    // .  turn on AM/PM/Degree dot
    // s  upcoming number is seconds, print as HH:MM or MM:SS
    // z  clear this display
    // f  upcoming number is floating point
    // r  raw segment based on bitmap of upcoming integer number (see reference document above)
    // 
    // Some sample valid combinations:
    //  787     -> 787
    //  x47     -> 2F
    //  s:241   -> 04:01
    //  s241    -> 4 01
    //  s:1241  -> 20:41
    //  z       ->
    //  x88     -> 58
    //  f8.5    -> 8.5
    //  f-9.34  -> -9.34
    //  f:-9.34 -> -9:.34
    //  r255    -> 8. (all 8 segments on)

To address raw segments for digit n, use the Console command with DisplayMode 0:
DisplayText [xn]m
where n is in range 0..4 which specifies which digit of LED display (including : at position 2) and m is the bitmask to select individual segment. Reference: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-led-backpack.pdf.
Examples:
DisplayText [y0x0]r255 turns all the segments of left most digit of first LED display on, giving: 8.
DisplayText [x0]r62[x1]r243 displays: UP.

Related issue (if applicable): fixes #

Checklist:

  • The pull request is done against the latest dev branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR.
  • The code change is tested and works on core ESP8266 V.2.7.2
  • The code change is tested and works on core ESP32 V.1.12.2
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@arendst arendst merged commit 5e4554e into arendst:development Jul 14, 2020
@marksmanaz
Copy link

I'm not sure if this is where I would give information on this update if I am in the wrong place forgive me.
Everything works as describe and expected except for:
s1241 -> 2041
NOT s1241 -> 20:41
s:1241 -> 20:41
This does not affect my project I only want to contribute what information I can to help. All other commands work including individual segments on each digit. Thank you

@tthk
Copy link
Contributor Author

tthk commented Jul 15, 2020

I'm not sure if this is where I would give information on this update if I am in the wrong place forgive me.
Everything works as describe and expected except for:
s1241 -> 2041
NOT s1241 -> 20:41
s:1241 -> 20:41
This does not affect my project I only want to contribute what information I can to help. All other commands work including individual segments on each digit. Thank you

You're absolutely right. Since the error isn't in the code but just the comments, it's probably not worth a git pull. I'll just make the correction the next time I'm editing the file for a fix. I made this fix in this pull request text above, though. Thanks.

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

Successfully merging this pull request may close these issues.

None yet

3 participants