-
-
Couldn't load subscription status.
- Fork 1k
Fix minor issues #2287
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
Fix minor issues #2287
Conversation
d9d2c80 to
49b422a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your rummaging around to fix the TCP connection is finding some valuable fixes. Thanks!
src/js/msp/MSPHelper.js
Outdated
| if (callback) callback({'command': code, 'data': data, 'length': data.byteLength, 'crcError': crcError}); | ||
| for (let i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length | ||
| if (dataHandler.callbacks[i] !== undefined) { | ||
| if (dataHandler.callbacks[i].code === code) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More concise to go if (dataHandler.callbacks[i]?.code === code) {.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference: https://github.com/claudepache/es-optional-chaining
49b422a to
1758260
Compare
|
It's recommended to replace all |
src/js/msp/MSPHelper.js
Outdated
| if (callback) callback({'command': code, 'data': data, 'length': data.byteLength, 'crcError': crcError}); | ||
| for (let i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length | ||
| if (dataHandler.callbacks[i] !== undefined) { | ||
| if (dataHandler.callbacks[i]?.code === code) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case (?.) the outer if (dataHandler.callbacks[i] !== undefined) { is not needed anymore, as dataHandler.callbacks[i]?.code will yield undefined if dataHandler.callbacks[i] does not exist. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, one Control-Z to many. Fixed
1758260 to
6dc7fec
Compare
6dc7fec to
06f4c8b
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
Minor issues found and fixed:
connectionTypenot established before connecting.offsetcrcerrors out ofmsp.jsto better show where it's coming fromcodein callback after save and rebootReboot request acceptedby changing timeout from100to200inserial_backend.js