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

Nextion draw QR code at runtime #6027

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Conversation

edwardtfn
Copy link
Contributor

What does this implement/fix?

This adds the qrcode method to Nextion library, allowing to plot QR codes on any Nextion page without the need of a QR code component previously added to the TFT.
This isn't the exactly same qr_code from display component as Nextion already have it's own QR code generator and it didn't requires a QR code component at build time.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): N/A

Pull request in esphome-docs with documentation (if applicable): N/A - Nextion docs don't includes this kind of method documentation, so I've added inline doc only, keeping consistency with existing methods.

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml
display:
  - id: disp1
    platform: nextion

text:
  - id: nextion_qrcode
    name: QR code
    platform: template
    icon: mdi:qrcode-scan
    restore_value: false
    initial_value: ""
    mode: text
    set_action:
      then:
        - lambda: |-
            static const char *const TAG = "text.nextion_qrcode.set_action";
            ESP_LOGD(TAG, "Plotting new QR code: %s", x.c_str());
            disp1->qrcode(113, 62, x.c_str(), 222, 65535, 0, -1, 7);

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@edwardtfn edwardtfn marked this pull request as ready for review December 28, 2023 02:34
@probot-esphome
Copy link

Hey there @SenexCrenshaw, mind taking a look at this pull request as it has been labeled with an integration (nextion) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jesserockz jesserockz merged commit 869cdf1 into esphome:dev Jan 9, 2024
48 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants