Skip to content

Commit

Permalink
Tightened up "NO DATA"-handling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackFreedman committed Dec 26, 2013
1 parent dc21f23 commit 8181a46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Binary file not shown.
24 changes: 19 additions & 5 deletions src/com/voidstar/glass/autohud/ObdManager.java
Expand Up @@ -337,15 +337,29 @@ else if (words[1].equals("10")) {
notifyMpgChanged();
nextStatToUpdate = TACH;
}
} else if (words[0].equals("NO")) {
} else if (words[0].equals("NO") && words[1].equals("DATA")) {
Log.e("AutoHud", "NO DATA returned for stat " + Integer.toString(nextStatToUpdate));

// NO DATA. going to bump to the next thing to read.
// other options.. do this in all above cycles..
// other: make an array and next the array maybe
nextStatToUpdate = (nextStatToUpdate<<1)%32;
// quick hack - if it's looped due to mod, don't do capabilites, lets go to 1 instead.
if (nextStatToUpdate == 0) {
nextStatToUpdate = 1;
nextStatToUpdate = (nextStatToUpdate << 1) % 32;

// If it ends up on an invalid stat, or one that shouldn't be read multiple times,
// loop back to reading the tachometer
if (nextStatToUpdate != TACH &&
nextStatToUpdate != SPEED &&
nextStatToUpdate != FUEL &&
nextStatToUpdate != MAF) {
nextStatToUpdate = TACH;
}

// TODO: Switch nextStatToUpdate to an enum and/or dictionary with strings
// TODO: Take advantage of deterministic behavior of ELM327 to simplify flow
// TODO: Add error checking and timeouts to figure out when OBD connection drops
// TODO: Add conditions to find Bluetooth connection drops
// TODO: Check Capabilities bits to figure out in advance if each stat will work
// TODO: Add error handling if Capabilities or Protocol return NO DATA
}

Sentences.remove(0);
Expand Down

4 comments on commit 8181a46

@knosalaa
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Zack, i know this is fairly old project. I just got google glass and would love to use this app with my OBDII (BT). The glass is on XE23. When installed (via ADB) i get no show dashboard in Ok Glass. Any suggestion why? I know you have put in a lot of work into this app and I could still use it if possible. Please let me know.
Thanks a lot

@ZackFreedman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey man, always awesome to see some interest in older projects.

This app was built against a really old GDK. To enable the voice commands, you need to update the manifest and strings resource to comply with the newer API. See the GDK reference for unlisted voice commands.

@knosalaa
Copy link

@knosalaa knosalaa commented on 8181a46 Nov 3, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZackFreedman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Arthur, but I don't intend to develop this app any further.

The app doesn't rely on settings.apk at all - it was just the most straightforward way to pair the OBDII module when I wrote the Glassware. If you've managed to pair your module in a different way, this Glassware should still connect to it.

As for the manifest and resource changes, you can use the GDK platform sample projects as examples. If you do manage to get it to work, please submit a pull request!

Please sign in to comment.