Skip to content

Commit

Permalink
Use extracted bytes for FromHeader/FromHeaderBody functions
Browse files Browse the repository at this point in the history
  • Loading branch information
domnulvlad committed Nov 2, 2024
1 parent ccb38d0 commit 84f90a9
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 144 deletions.
1 change: 1 addition & 0 deletions KEYWORDS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ getMeasurementDecimals KEYWORD2

getFormulaFromHeader KEYWORD2
getNWbFromHeader KEYWORD2
getMWbFromBody KEYWORD2
getDataTableFromHeader KEYWORD2
getDataTableLengthFromHeader KEYWORD2

Expand Down
23 changes: 13 additions & 10 deletions examples/02.Fault_code_test/02.Fault_code_test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ void setup()

// Connect to the module.
/*
*There is an optional argument for connect()/attemptConnect(), which, if set to false, will make it so extra identification will not be requested
-There is an optional argument for connect()/attemptConnect(), which, if set to false, will make it so extra identification will not be requested
if the module supports it.
*This would save almost one second of the connection time, with the downside being that getExtraIdentification() will return an empty string.
*It has no effect if the module doesn't support extra identification.
-This would save almost one second of the connection time, with the downside being that getExtraIdentification() will return an empty string.
-It has no effect if the module doesn't support extra identification.
*/
diag.connect(connect_to_module, module_baud_rate, false);

Expand All @@ -110,10 +110,10 @@ void setup()

// Disconnect from the module.
/*
*There is an optional argument for disconnect(), which, if set to false, will make it so the library doesn't wait for a response.
*When disconnecting, some modules send a response, some don't.
*If the module doesn't send a response, not waiting saves [diag.responseTimeout] milliseconds, by default 2 seconds.
*If the module sends a response, not waiting for it shouldn't really have consequences.
-There is an optional argument for disconnect(), which, if set to false, will make it so the library doesn't wait for a response.
-When disconnecting, some modules send a response, some don't.
-If the module doesn't send a response, not waiting saves [diag.responseTimeout] milliseconds, by default 2 seconds.
-If the module sends a response, not waiting for it shouldn't really have consequences.
*/
diag.disconnect(false);
Serial.println("Disconnected.");
Expand All @@ -133,9 +133,12 @@ void showDTCs()
Always check the return value of functions!
The readFaults() function can return:
*KLineKWP1281Lib::SUCCESS - received fault codes
*KLineKWP1281Lib::FAIL - the module doesn't support fault codes
*KLineKWP1281Lib::ERROR - communication error
KLineKWP1281Lib::SUCCESS - received fault codes
KLineKWP1281Lib::FAIL - the module doesn't support fault codes
KLineKWP1281Lib::ERROR - communication error
Technically, there are 3 more values defined for the KLineKWP1281Lib::executionStatus data type,
but they only apply to the readGroup() function, so they will never be returned by other functions.
*/

// If fault codes were read successfully, display them.
Expand Down
9 changes: 6 additions & 3 deletions examples/06.Output_tests/06.Output_tests.ino
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ void performOutputTests()

/*
The outputTests() function can return:
*KLineKWP1281Lib::SUCCESS - performed next output test
*KLineKWP1281Lib::FAIL - the module doesn't support output tests / reached end of output tests
*KLineKWP1281Lib::ERROR - communication error
KLineKWP1281Lib::SUCCESS - performed next output test
KLineKWP1281Lib::FAIL - the module doesn't support output tests / reached end of output tests
KLineKWP1281Lib::ERROR - communication error
Technically, there are 3 more values defined for the KLineKWP1281Lib::executionStatus data type,
but they only apply to the readGroup() function, so they will never be returned by other functions.
*/

// Run the first output test and store the return value.
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=KLineKWP1281Lib
version=2.2.0
version=2.2.1
author=domnulvlad <https://github.com/domnulvlad>
maintainer=domnulvlad <https://github.com/domnulvlad>
sentence=Library for interfacing with the VAG KWP1281 protocol, via the K-line.
Expand Down
Loading

0 comments on commit 84f90a9

Please sign in to comment.