From 892176905d4981f612ef12e70e58c5f10f931d5a Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Fri, 17 May 2024 22:06:03 -0600 Subject: [PATCH] Fixes for issue #248. - change return type for queryPID() methods - update code comments for queryPID() - update README document - update code comments for conditionResponse() --- README.md | 4 ++-- src/ELMduino.cpp | 20 ++++++++------------ src/ELMduino.h | 4 ++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index efd16c2..7a50b20 100644 --- a/README.md +++ b/README.md @@ -123,8 +123,8 @@ bool begin(Stream& stream, const bool& debug = false, const uint16_t& timeout = bool initializeELM(const char& protocol = '0', const byte& dataTimeout = 0); void flushInputBuff(); uint64_t findResponse(); -bool queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses = 1); -bool queryPID(char queryStr[]); +void queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses = 1); +void queryPID(char queryStr[]); float processPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses, const uint8_t& numExpectedBytes, const float& scaleFactor = 1, const float& bias = 0); void sendCommand(const char *cmd); int8_t sendCommand_Blocking(const char *cmd); diff --git a/src/ELMduino.cpp b/src/ELMduino.cpp index a046339..f2aff29 100644 --- a/src/ELMduino.cpp +++ b/src/ELMduino.cpp @@ -441,7 +441,7 @@ int8_t ELM327::nextIndex(char const *str, ------- * uint64_t response - ELM327's response * uint8_t numExpectedBytes - Number of valid bytes from the response to process - * float scaleFactor - Amount to scale the response by + * double scaleFactor - Amount to scale the response by * float bias - Amount to bias the response by Return: @@ -557,7 +557,7 @@ void ELM327::flushInputBuff() } /* - bool ELM327::queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses) + void ELM327::queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses) Description: ------------ @@ -574,18 +574,16 @@ void ELM327::flushInputBuff() Return: ------- - * bool - Whether or not the query was submitted successfully + * void */ -bool ELM327::queryPID(const uint8_t &service, const uint16_t &pid, const uint8_t &num_responses) +void ELM327::queryPID(const uint8_t &service, const uint16_t &pid, const uint8_t &num_responses) { formatQueryArray(service, pid, num_responses); sendCommand(query); - - return connected; } /* - bool ELM327::queryPID(char queryStr[]) + void ELM327::queryPID(char queryStr[]) Description: ------------ @@ -597,9 +595,9 @@ bool ELM327::queryPID(const uint8_t &service, const uint16_t &pid, const uint8_t Return: ------- - * bool - Whether or not the query was submitted successfully + * void */ -bool ELM327::queryPID(char queryStr[]) +void ELM327::queryPID(char queryStr[]) { if (strlen(queryStr) <= 4) longQuery = false; @@ -607,8 +605,6 @@ bool ELM327::queryPID(char queryStr[]) longQuery = true; sendCommand(queryStr); - - return connected; } /* @@ -632,7 +628,7 @@ bool ELM327::queryPID(char queryStr[]) Return: ------- - * float - The PID value if successfully received, else 0.0 + * double - The PID value if successfully received, else 0.0 */ double ELM327::processPID(const uint8_t &service, const uint16_t &pid, const uint8_t &num_responses, const uint8_t &numExpectedBytes, const double &scaleFactor, const float &bias) { diff --git a/src/ELMduino.h b/src/ELMduino.h index b0759a6..9d36855 100644 --- a/src/ELMduino.h +++ b/src/ELMduino.h @@ -323,8 +323,8 @@ class ELM327 bool initializeELM(const char& protocol = '0', const byte& dataTimeout = 0); void flushInputBuff(); uint64_t findResponse(const uint8_t &service, const uint8_t &pid); - bool queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses = 1); - bool queryPID(char queryStr[]); + void queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses = 1); + void queryPID(char queryStr[]); double processPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses, const uint8_t& numExpectedBytes, const double& scaleFactor = 1, const float& bias = 0); void sendCommand(const char *cmd); int8_t sendCommand_Blocking(const char *cmd);