Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Displayio Positioning Bug Fix - #306

Merged
Andrea Mah (andreamah) merged 5 commits into
devfrom
users/t-anmah/positioning-fix
Apr 9, 2020
Merged

Andrea Mah (andreamah) merged 5 commits into
devfrom
users/t-anmah/positioning-fix

Conversation

@andreamah

Copy link
Copy Markdown
Contributor

Description:

Issues:

  • Setting group.x or group.y does not have an impact on the output
  • Setting group.x, group.y, group.scale when the group is active does not update the screen

Solutions:

  • Adding custom properties for group.x, group.y, and group.scale.
  • Setting adafruit_display_text's anchored_position already updates group.y and group.x, so we just needed to remove consideration for anchored_position and add reference to group.y and group.x whenever we need to draw.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Testing:

The example code here: https://github.com/adafruit/Adafruit_CircuitPython_CLUE/blob/master/examples/clue_spirit_level.py

(for the best result, use values between -10 and 10 for xy acceleration)

Also, the regular sensor code:

from adafruit_bitmap_font import bitmap_font
from adafruit_clue import clue

clue_data = clue.simple_text_display(text_scale=2)

while True:
    clue_data[0].text = "Acceleration: {:.2f} {:.2f} {:.2f} m/s^2".format(
        *clue.acceleration
    )
    clue_data[1].text = "Pressure: {:.3f} hPa".format(clue.pressure)
    clue_data[2].text = "Altitude: {:.1f} m".format(clue.altitude)
    clue_data[3].text = "Temperature: {:.1f} C".format(clue.temperature)
    clue_data[4].text = "Humidity: {:.1f} %".format(clue.humidity)
    clue_data[5].text = "Proximity: {}".format(clue.proximity)
    clue_data[6].text = "Gesture: {}".format(clue.gesture)
    clue_data[7].text = "Color: R: {} G: {} B: {} C: {}".format(*clue.color)
    clue_data[8].text = "Button A: {}".format(clue.button_a)
    clue_data[9].text = "Button B: {}".format(clue.button_b)

    clue_data.show()

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
LGTM

Comment thread src/base_circuitpython/displayio/group.py
Comment thread src/base_circuitpython/displayio/group.py Outdated

@vandyliu Vandy Liu (vandyliu) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@andreamah
Andrea Mah (andreamah) merged commit 2495de3 into dev Apr 9, 2020
@andreamah
Andrea Mah (andreamah) deleted the users/t-anmah/positioning-fix branch April 9, 2020 00:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants