Skip to content

Commit

Permalink
Fixes for issue PowerBroker2#248.
Browse files Browse the repository at this point in the history
- change return type for queryPID() methods
- update code comments for queryPID()
- update README document
- update code comments for conditionResponse()
  • Loading branch information
jimwhitelaw committed May 18, 2024
1 parent 7dfd496 commit 8921769
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 8 additions & 12 deletions src/ELMduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
------------
Expand All @@ -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:
------------
Expand All @@ -597,18 +595,16 @@ 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;
else
longQuery = true;

sendCommand(queryStr);

return connected;
}

/*
Expand All @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ELMduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8921769

Please sign in to comment.