-
Notifications
You must be signed in to change notification settings - Fork 178
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
Add capability to force stay in DFU (and erase app) with button if #294
Open
ccrome
wants to merge
1
commit into
adafruit:master
Choose a base branch
from
ccrome:button-stay-in-dfu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this is a good idea, though we should only erase app if button is hold long enough e.g 5 seconds, there would be an sequence of indicator e.g
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.
I'm thinking about how to implement this, and I'm not 100% sure.
The system timer ticks fire at different intervals depending on what state things are in. Does it make sense to have a 1ms tick, and base everything off of that? That would make timing specific times like 5 seconds for erase a little more straightforward.
The alternative is to keep track of the current tick interval, and use that to count. But that will fail if the ticks are turned off during any time you want to keep track of time intervals.
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.
I would add a new indicator state for holding button, that would make thing in sync with other. The timer interval could be choose to be a bit different than other state (along with RGB) mostly to inform user.
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.
I'm actually working on 2 separate projects: 1 deeply embedded with no access to buttons, and one handheld with too-easy access to buttons. The latter case has exactly 2 buttons total, one of which is used for the DFU mode as well as a standard meaning once the app starts.
Here's the scenario:
So, here's my proposed behavior that I think works for everything:
check_dfu_mode()
, then stay in DFU modeIs there really any point in staying in the DFU and not erasing the app? I can't really imagine why you'd want to force an 'enter DFU state' but not erase the app.
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.
I just pushed a version with my proposed behavior. It's a bit more of a change than I thought it would be -- but I'm not sure I could make it a whole lot simpler -- just the way all the bits interact seem to reach into a few more places than expected.
I also updated the LED specifications so the timer interval is specified in the same spot as the RGB colors. I hope that's okay. If not, I can revert it back.