Fix send delay for bluetooth/Raspberry Pi#162
Merged
Conversation
|
It works now with fast=false, and a no voltage check. Thank you! |
Author
|
@ajalberd glad to hear it! I also packaged it up as a Docker container to run on my Raspberry Pi Kubernetes cluster, along with Prometheus exporting, if you're curious: https://github.com/zaneclaes/node-pi-obd-monitor |
Collaborator
|
This looks fine to me. It won't interfere with already working systems but should help fix the RaspberryPi Bluetooth issue. |
alistair23
approved these changes
Nov 3, 2019
|
Can anyone please guide me ho to change "fast=False" I am using raspberry pi 4. But still I can't connect my bluetooth OBD adaper using python-obd connector. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This corrects the following issue, detected on a Raspberry Pi connecting via Bluetooth (though it may not be exclusive to this case): #160
The root cause was that the
sendcommand was attempting to retrieve responses from the OBD adapter before they were available for the startup commands (likely due to latency over Bluetooth or some slowness with the dongle itself). I verified that each ofATH1,ATL0, andAT RVwould not work on my Raspberry Pi 4 with bluetooth without using at least a 0.1 second delay.My first thought was to use the
fast=Falseconfiguration value to add a delay to__send(), but on experimentation I discovered that this created an artificial delay which was unnecessary for retrieving values later (such asSPEED). Instead, I modified the__send()function to retry theread()if the response was empty for up to one second. AFAIK, this should not be problematic in that a response is always expected by any monitoring commands sent to the OBDII adapter.... but I defer to the maintainers, as I only just started reading about the OBDII/ELM327 protocol specifics today.
// fyi @alistair23 @ajalberd