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

unclear use of comma operator in settings_leds.htm #4321

Closed
softhack007 opened this issue Nov 25, 2024 · 2 comments · Fixed by #4328
Closed

unclear use of comma operator in settings_leds.htm #4321

softhack007 opened this issue Nov 25, 2024 · 2 comments · Fixed by #4328
Labels
fixed in source This issue is unsolved in the latest release but fixed in master javascript Pull requests that update Javascript code

Comments

@softhack007
Copy link
Collaborator

I'm not sure if this line does the right thing;
actually my IDE (CLion) warned me of a "comma expression that may lead to subtle bugs".

oMaxB = maxB = b; maxD = d, maxA = a, maxV = v; maxM = m; maxPB = p; maxL = l; maxCO = o;

Either the comma is not needed here --> replace with ";"
Or it has a very special intention ?? --> maybe add a comment to explain?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator#using_the_comma_operator_to_join_assignments

@softhack007 softhack007 added needs investigation The bug has not yet been reproduced by me. Analysis or more details are needed. javascript Pull requests that update Javascript code labels Nov 25, 2024
@blazoncek
Copy link
Collaborator

function bLimits(b,v,p,m,l,o=5,d=2,a=6) {
	oMaxB = maxB = b; // maxB - max buses (can be changed if using ESP32 parallel I2S)
	maxD = d; // maxD - max digital channels (can be changed if using ESP32 parallel I2S)
	maxA = a; // maxA - max analog channels
	maxV = v; // maxV - min virtual buses
	maxPB = p; // maxPB - max LEDs per bus
	maxM = m; // maxM - max LED memory
	maxL = l; // maxL - max LEDs (will serve to determine ESP >1664 == ESP32)
	maxCO = o; // maxCO - max Color Order mappings
}

@softhack007
Copy link
Collaborator Author

@blazoncek PR?

blazoncek added a commit to blazoncek/WLED that referenced this issue Nov 27, 2024
@softhack007 softhack007 added the fixed in source This issue is unsolved in the latest release but fixed in master label Nov 27, 2024
@softhack007 softhack007 linked a pull request Nov 27, 2024 that will close this issue
netmindz added a commit that referenced this issue Nov 27, 2024
Fix for #4321 - unclear use of comma operator
netmindz pushed a commit that referenced this issue Nov 27, 2024
@softhack007 softhack007 removed the needs investigation The bug has not yet been reproduced by me. Analysis or more details are needed. label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in source This issue is unsolved in the latest release but fixed in master javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants