8000 [rtttl] Various optimizations/clean-up by kbx81 · Pull Request #8923 · esphome/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[rtttl] Various optimizations/clean-up #8923

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

kbx81
Copy link
Member
@kbx81 kbx81 commented May 28, 2025

What does this implement/fix?

The focus of this PR is some minor code clean-up but more importantly on making log messages shorter and more concise with the goal of making the final binary smaller (more on this to come...).

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)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes

Pull request in esphome-docs with documentation (if applicable):

  • esphome/esphome-docs#

Test Environment

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

Example entry for config.yaml:

# Example config.yaml

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:

@probot-esphome
Copy link

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

@codecov-commenter
Copy link
codecov-commenter commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 14.34%. Comparing base (4d8b5ed) to head (d499ff2).
Report is 2734 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff             @@
##              dev    #8923       +/-   ##
===========================================
- Coverage   53.70%   14.34%   -39.37%     
===========================================
  Files          50     1158     +1108     
  Lines        9408    48077    +38669     
  Branches     1654     5774     +4120     
===========================================
+ Hits         5053     6898     +1845     
- Misses       4056    40741    +36685     
- Partials      299      438      +139     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


// it's somewhat documented to be up to 10 characters but let's be a bit flexible here
if (this->position_ == std::string::npos || this->position_ > 15) {
ESP_LOGE(TAG, "Missing ':' when looking for name.");
ESP_LOGE(TAG, "Unable to determine name; missing ':'");
Copy link
Member

Choose a reason for hiding this comment

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

Or name too long?

Copy link
Member
@jesserockz jesserockz May 28, 2025

Choose a reason for hiding this comment

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

IMO ESPHome doesn't really need to have any kind of length restrictions on the name, but that is not for this PR to change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree on the first part, i will create a PR to resolve this.
Anyway thinking about it is it really an Error for us when there is no name set?

@jesserockz jesserockz merged commit 18a1d31 into esphome:dev May 28, 2025
27 checks passed
@@ -387,7 +387,7 @@ static const LogString *state_to_string(State state) {
void Rtttl::set_state_(State state) {
State old_state = this->state_;
this->state_ = state;
ESP_LOGD(TAG, "State changed from %s to %s", LOG_STR_ARG(state_to_string(old_state)),
ESP_LOGV(TAG, "State changed from %s to %s", LOG_STR_ARG(state_to_string(old_state)),
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also have been set to VV imho. :D

@nielsnl68
Copy link
Contributor

Thanks @kbx81 to look into this PR. Did also tried it out?

This was referenced Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0