Skip to content

Commit

Permalink
Fix negative_pow_10 array
Browse files Browse the repository at this point in the history
  • Loading branch information
domnulvlad committed Oct 28, 2024
1 parent 9d48a57 commit 1b7914a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/KLineKWP1281Lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5424,3 +5424,5 @@ int KLineKWP1281Lib::compare_keyed_structs(const void *a, const void *b)
int idB = struct_from_PGM.code;
return (idA - idB);
}

const double KLineKWP1281Lib::negative_pow_10[] = {1, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001};
5 changes: 3 additions & 2 deletions src/KLineKWP1281Lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

// Helper for determining the amount of elements in an array
#define ARRAYSIZE(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))

class KLineKWP1281Lib
{
public:
Expand Down Expand Up @@ -307,7 +307,8 @@ class KLineKWP1281Lib

private:
// Formula A0 needs 8 negative powers of 10 for calculation.
static constexpr double negative_pow_10[8] = {1, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001};
// They are defined at the bottom of the .cpp file.
static const double negative_pow_10[8];

///VARIABLES/TYPES
static const uint8_t KWP_ACKNOWLEDGE = 0x09; // the module has no more data to send
Expand Down

0 comments on commit 1b7914a

Please sign in to comment.