Skip to content

Commit

Permalink
Fixed Type in Concentration
Browse files Browse the repository at this point in the history
  • Loading branch information
David Meier committed Mar 13, 2020
1 parent 61b1304 commit fc7fac9
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ uint8_t addEnergy(uint8_t channel, float value); // in kWh (3 decimals)
uint8_t addDirection(uint8_t channel, float value); // in degrees
uint8_t addSwitch(uint8_t channel, uint32_t value); // 0 or 1
uint8_t CayenneLPP::addConentration(uint8_t channel, uint32_t value); // 1 PPM unsigned - PPM means Parts per million 1PPM = 1 * 10 ^-6 = 0.000 001
uint8_t CayenneLPP::addConcentration(uint8_t channel, uint32_t value); // 1 PPM unsigned - PPM means Parts per million 1PPM = 1 * 10 ^-6 = 0.000 001
uint8_t CayenneLPP::addColour(uint8_t channel, uint8_t r, uint8_t g, uint8_t b); // R: 255 G: 255 B: 255
```

Expand Down
4 changes: 2 additions & 2 deletions decoders/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Frequency 3318 118 76 4 1 Hz Unsigned MSB
* Percentage 3320 120 78 1 1% Unsigned
* Altitude 3321 121 79 2 1m Signed MSB
* Conentration 3325 125 7D 2 1 PPM unsigned : 1pmm = 1 * 10 ^-6 = 0.000 001
* Concentration 3325 125 7D 2 1 PPM unsigned : 1pmm = 1 * 10 ^-6 = 0.000 001
* Power 3328 128 80 2 1 W Unsigned MSB
* Distance 3330 130 82 4 0.001m Unsigned MSB
* Energy 3331 131 83 4 0.001kWh Unsigned MSB
Expand Down Expand Up @@ -60,7 +60,7 @@ function lppDecode(bytes) {
118: {'size': 4, 'name': 'frequency', 'signed': false, 'divisor': 1},
120: {'size': 1, 'name': 'percentage', 'signed': false, 'divisor': 1},
121: {'size': 2, 'name': 'altitude', 'signed': true, 'divisor': 1},
125: {'size': 2, 'name': 'conentration', 'signed': false, 'divisor': 1},
125: {'size': 2, 'name': 'concentration', 'signed': false, 'divisor': 1},
128: {'size': 2, 'name': 'power', 'signed': false, 'divisor': 1},
130: {'size': 4, 'name': 'distance', 'signed': false, 'divisor': 1000},
131: {'size': 4, 'name': 'energy', 'signed': false, 'divisor': 1000},
Expand Down
2 changes: 1 addition & 1 deletion examples/Decode/Decode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void setup()
lpp.addDirection(1 , 90);
lpp.addSwitch(1 , 0);

lpp.addConentration(1 , 512);
lpp.addConcentration(1 , 512);
lpp.addColour(1 , 64, 128, 255);


Expand Down
2 changes: 1 addition & 1 deletion examples/DecodeTTN/DecodeTTN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void setup()
lpp.addDirection(1 , 90);
lpp.addSwitch(1 , 0);

lpp.addConentration(1 , 512);
lpp.addConcentration(1 , 512);
lpp.addColour(1 , 64, 128, 255);


Expand Down
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ addEnergy KEYWORD2
addDirection KEYWORD2
addSwitch KEYWORD2

addConentration KEYWORD2
addConcentration KEYWORD2
addColour KEYWORD2

getTypeName KEYWORD2
Expand Down
12 changes: 6 additions & 6 deletions src/CayenneLPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool CayenneLPP::isType(uint8_t type) {
if (LPP_GYROMETER == type) return true;
if (LPP_GPS == type) return true;
if (LPP_SWITCH == type) return true;
if (LPP_CONENTRATION == type) return true;
if (LPP_CONCENTRATION == type) return true;
if (LPP_COLOUR == type) return true;
return false;
}
Expand Down Expand Up @@ -96,7 +96,7 @@ const char * CayenneLPP::getTypeName(uint8_t type) {
if (LPP_GYROMETER == type) return "gyrometer";
if (LPP_GPS == type) return "gps";
if (LPP_SWITCH == type) return "switch";
if (LPP_CONENTRATION == type) return "conentration";
if (LPP_CONCENTRATION == type) return "concentration";
if (LPP_COLOUR == type) return "colour";
return 0;
}
Expand Down Expand Up @@ -126,7 +126,7 @@ uint8_t CayenneLPP::getTypeSize(uint8_t type) {
if (LPP_GYROMETER == type) return LPP_GYROMETER_SIZE;
if (LPP_GPS == type) return LPP_GPS_SIZE;
if (LPP_SWITCH == type) return LPP_SWITCH_SIZE;
if (LPP_CONENTRATION == type) return LPP_CONENTRATION_SIZE;
if (LPP_CONCENTRATION == type) return LPP_CONCENTRATION_SIZE;
if (LPP_COLOUR == type) return LPP_COLOUR_SIZE;
return 0;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ uint32_t CayenneLPP::getTypeMultiplier(uint8_t type) {
if (LPP_UNIXTIME == type) return LPP_UNIXTIME_MULT;
if (LPP_GYROMETER == type) return LPP_GYROMETER_MULT;
if (LPP_SWITCH == type) return LPP_SWITCH_MULT;
if (LPP_CONENTRATION == type) return LPP_CONENTRATION_MULT;
if (LPP_CONCENTRATION == type) return LPP_CONCENTRATION_MULT;
if (LPP_COLOUR == type) return LPP_COLOUR_MULT;
return 0;
}
Expand Down Expand Up @@ -306,8 +306,8 @@ uint8_t CayenneLPP::addSwitch(uint8_t channel, uint32_t value) {
return addField(LPP_SWITCH, channel, value);
}

uint8_t CayenneLPP::addConentration(uint8_t channel, uint32_t value) {
return addField(LPP_CONENTRATION, channel, value);
uint8_t CayenneLPP::addConcentration(uint8_t channel, uint32_t value) {
return addField(LPP_CONCENTRATION, channel, value);
}

uint8_t CayenneLPP::addColour(uint8_t channel, uint8_t r, uint8_t g, uint8_t b)
Expand Down
8 changes: 4 additions & 4 deletions src/CayenneLPP.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define LPP_FREQUENCY 118 // 4 bytes 1Hz unsigned
#define LPP_PERCENTAGE 120 // 1 byte 1-100% unsigned
#define LPP_ALTITUDE 121 // 2 byte 1m signed
#define LPP_CONENTRATION 125 // 2 bytes, 1 ppm unsigned
#define LPP_CONCENTRATION 125 // 2 bytes, 1 ppm unsigned
#define LPP_POWER 128 // 2 byte, 1W, unsigned
#define LPP_DISTANCE 130 // 4 byte, 0.001m, unsigned
#define LPP_ENERGY 131 // 4 byte, 0.001kWh, unsigned
Expand Down Expand Up @@ -61,7 +61,7 @@
#define LPP_GYROMETER_SIZE 6
#define LPP_GPS_SIZE 9
#define LPP_SWITCH_SIZE 1
#define LPP_CONENTRATION_SIZE 2
#define LPP_CONCENTRATION_SIZE 2
#define LPP_COLOUR_SIZE 3

// Multipliers
Expand Down Expand Up @@ -90,7 +90,7 @@
#define LPP_GPS_LAT_LON_MULT 10000
#define LPP_GPS_ALT_MULT 100
#define LPP_SWITCH_MULT 1
#define LPP_CONENTRATION_MULT 1
#define LPP_CONCENTRATION_MULT 1
#define LPP_COLOUR_MULT 1

#define LPP_ERROR_OK 0
Expand Down Expand Up @@ -142,7 +142,7 @@ class CayenneLPP {
uint8_t addEnergy(uint8_t channel, float value);
uint8_t addDirection(uint8_t channel, float value);
uint8_t addSwitch(uint8_t channel, uint32_t value);
uint8_t addConentration(uint8_t channel, uint32_t value);
uint8_t addConcentration(uint8_t channel, uint32_t value);
uint8_t addColour(uint8_t channel, uint8_t r, uint8_t g, uint8_t b);

protected:
Expand Down
4 changes: 2 additions & 2 deletions test/aunit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ testF(EncoderTest, Altitude) {
compare(sizeof(expected), expected);
}

testF(EncoderTest, Conentration) {
lpp->addConentration(4, 4079);
testF(EncoderTest, Concentration) {
lpp->addConcentration(4, 4079);
uint8_t expected[] = {0x05,0x7D,0x0F,0xEF};
compare(sizeof(expected), expected);
}
Expand Down

0 comments on commit fc7fac9

Please sign in to comment.