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] Exit reparse before update TFT #6589

Merged
merged 2 commits into from
Apr 29, 2024
Merged

Conversation

edwardtfn
Copy link
Contributor

What does this implement/fix?

This implements the capability to exit reparse right before the tft upload, reducing the chance of some command on the TFT return to reparse mode before the update starts.

@param exit_reparse If true, the function exits reparse mode before uploading the TFT file. This parameter defaults to true, ensuring that the display is ready to receive and apply the new TFT file without needing to manually reset or reconfigure. Exiting reparse mode is recommended for most upload scenarios to ensure the display properly processes the uploaded file command.

This is part of the breaking down of #6192

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

Test Environment

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

Example entry for config.yaml:

# Example config.yaml
button:
  - name: Upload TFT
    platform: template
    on_press:
      lambda: id(disp1).upload_tft();

  # This will upload at 92160 bps, showing the result message in the log.
  - name: Upload TFT with Exit reparse
    platform: template
    on_press:
      - lambda: |-
          static const char *const TAG = "addon_upload_tft.script.nextion_upload";
          ESP_LOGD(TAG, "Starting TFT upload...");
          bool upload_tft_result = disp1->upload_tft(true);
          ESP_LOGD(TAG, "TFT uploaded: %s", YESNO(upload_tft_result));

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:

This implements the capability to exit reparse right before the tft upload, reducing the chance of some command on the TFT return to reparse mode before the update starts.

@param exit_reparse If true, the function exits reparse mode before uploading the TFT file. This parameter defaults to true, ensuring that the display is ready to receive and apply the new TFT file without needing to manually reset or reconfigure. Exiting reparse mode is recommended for most upload scenarios to ensure the display properly processes the uploaded file command.

This is part of the breaking down of esphome#6192
@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)

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.05%. Comparing base (4d8b5ed) to head (7739c5e).
Report is 495 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6589      +/-   ##
==========================================
+ Coverage   53.70%   54.05%   +0.34%     
==========================================
  Files          50       50              
  Lines        9408     9554     +146     
  Branches     1654     1687      +33     
==========================================
+ Hits         5053     5164     +111     
- Misses       4056     4066      +10     
- Partials      299      324      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@edwardtfn
Copy link
Contributor Author

@kbx81, with this PR I've almost finished the breakdown of #6192 as you suggested. Still pending the ENUM part, but I will wait until the other parts are merged (or rejected) to make the life easier.

These last pieces will certainly have conflicts to merge, but feel free to merge those in the order you prefer and I will be solving the conflicts with the remaining parts.

Thanks!!

@edwardtfn edwardtfn changed the title Nextion - Exit reparse before update TFT [nextion] Exit reparse before update TFT Apr 29, 2024
@jesserockz jesserockz merged commit 05fbb26 into esphome:dev Apr 29, 2024
55 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 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

3 participants