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

SML: FastExit for binary SML parsing #21497

Merged
merged 4 commits into from
May 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tasmota/tasmota_xsns_sensor/xsns_53_sml.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,15 @@ void SML_Decode(uint8_t index) {
return;
}


struct METER_DESC *md = &meter_desc[index];
// start of serial source buffer
cp = md->sbuff;
if (md->flag & 32 && md->type == 's' && *cp != SML_SYNC) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't the code be easier to understand if a constant with a descriptive name were used for the numerical value 32? And since a bit is obviously being tested here, the use of 0x20 is a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the same comment as #21497 (review) ?
This is already fixed.

// fast exit when not in sync
return;
}

while (mp != NULL) {
// check list of defines
if (*mp == 0) break;
Expand Down