forked from spadival/headunit
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Adding code that checks if the nav sd card is installed, and if it is… #123
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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.
Although stat() is super cheap, how often does this method get called? Can we perhaps cache the existence / non-existence of the directory and just check a variable here instead? Too many syscalls can be performance impacting and these CMUs are already mighty weak.
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.
Every second. The problem with caching it is if you pull it out while running it will reverse. This code allows you to plug and unplug the sdcard while running google maps
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 understand this -- is that really an important use case to cover, though? My understanding is that people will either have an SD card or not.
I think you're on the right track here, but I'd rather not add another syscall to perform every second. Can we check periodically and flip a flag if needed? A check every 30 seconds? People pulling out and putting their SD card back in seems very edge case-y. I know it's great for testing though :)
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 mean, we could always just tell users they have to restart AA if they're going to pull out or re-insert their Mazda Nav SD card -- that doesn't sound unreasonable to me. And it makes the engineering solution simpler. My personal philosophy is that sometimes it's better to set clear product requirements than to engineer for edge cases, especially if it costs any performance
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.
That's definitely a better idea. I'd have to do some more investigating to do a timer.
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.
Yea I did a test and the performance impact from that check is definitely noticeable and funny thing is it didn't even flip my heading the wrong way even when I took out the check.
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.
You have to wait for a bit for it to flip. But interesting.
I will install a version without the check soon. Did you push your changes to any branch?
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.
no but I only used lines 125, 129-133 & 140 thats why its so funny because its definitely +-180 off but it somehow still knows how to correct itself.
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.
After 2 days still works perfectly for me without flipping the heading or any other unexpected issues with or without a Nav SD card connected. Tested it on some other people too and nobody reported a reversed heading whether they had the issue to begin with or not. Its very strange that it wouldn't flip the heading for those that didn't have the issue to begin with but so far thats what its looking like. I would say if you push a few changes like just poll for the Nav SD card once at the start that would be sufficient and if after some more testing it is confirmed that it doesn't cause an issue for anyone then I would say merge it because it definitely fixes the issue for those who have it, that has pretty much been confirmed by several people.
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've merged this code with my config file combination:
Peck07@b26e717