-
-
Notifications
You must be signed in to change notification settings - Fork 875
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
check every 100ms for DFU mode #2836
check every 100ms for DFU mode #2836
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
513e812
to
f4031ab
Compare
This comment has been minimized.
This comment has been minimized.
f4031ab
to
c9338fd
Compare
Thanks Mark @haslinghuis ! That's a much nicer way to code it. Really grateful. Works great on all boards I've tried so far (F722, F405, F411). |
This comment has been minimized.
This comment has been minimized.
} | ||
} | ||
|
||
let failedAttempts = 0; |
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.
Why define after use it into the function?
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.
The function is called in the setInterval
below. The function definition is above the call. No need for hoisting. Parameters are still initialized before calling the function.
src/js/protocols/stm32.js
Outdated
} | ||
|
||
let failedAttempts = 0; | ||
const dfuWaitInterval = setInterval(waitForDFU, 100); |
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.
Same here
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.
Same as above.
AUTOMERGE: (FAIL)
|
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.
nice!
looks good, but if there will be some change requests, plz rename
waitForDFU -> waitForDfu
c9338fd
to
249345b
Compare
Kudos, SonarCloud Quality Gate passed!
|
Do you want to test this code? Here you have an automated build: |
Rather than wait a full 5s to flash on my Mac, this code checks for a DFU connection every 100ms, then flashes when DFU is available.
Huge THANK YOU to @haslinghuis for re-factoring my original code so well, and for @limon for showing me the basics of how to do it! Very grateful for your help.
On my mac, most DFU connections take around 1.6 - 1.8s. Keen to hear how long it takes on Linux / Windows.
Typical console log at connect time.:
We could check only every second, I guess, but it's interesting to see how quickly different systems connect.