Skip to content

Commit

Permalink
v1.0.3 Fixed setODR() bug
Browse files Browse the repository at this point in the history
  • Loading branch information
reefwing committed Feb 20, 2023
1 parent 289a961 commit 7011f2c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
5 changes: 3 additions & 2 deletions examples/readAltitude/readAltitude.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Acquires temperature and pressure readings from the LPS22HB
Pressure Sensor mounted on the Arduino Nano 33 BLE Sense
Expand Down
5 changes: 3 additions & 2 deletions examples/readPressureUnits/readPressureUnits.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Acquires temperature and pressure readings from the LPS22HB
Pressure Sensor mounted on the Arduino Nano 33 BLE Sense
Expand Down
5 changes: 3 additions & 2 deletions examples/readTempAndPressure/readTempAndPressure.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Acquires temperature and pressure readings from the LPS22HB
Pressure Sensor mounted on the Arduino Nano 33 BLE Sense
Expand Down
5 changes: 3 additions & 2 deletions examples/setODR/setODR.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Acquires temperature and pressure readings from the LPS22HB
Pressure Sensor mounted on the Arduino Nano 33 BLE Sense
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=ReefwingLPS22HB
version=1.0.2
version=1.0.3
author=David Such <[email protected]>
maintainer=David Such <[email protected]>
sentence=Arduino Library for the LPS22HB Pressure Sensor.
Expand Down
9 changes: 5 additions & 4 deletions src/ReefwingLPS22HB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Credit - Some code used from the LPS22HB Absolute Digital Barometer
class by Adrien Chapelet for IoThings.
Expand Down Expand Up @@ -114,7 +115,7 @@ void ReefwingLPS22HB::setODR(Rate rate) {
_rate = (uint8_t)rate;

// Set ODR bits 4, 5 & 6 (_rate & 0x07) << 4 and BDU 0x02
write(LPS22HB_CTRL_REG1, ((_rate & 0x07) << 4) & 0x02);
write(LPS22HB_CTRL_REG1, ((_rate & 0x07) << 4) | 0x02);
}

void ReefwingLPS22HB::setQNH(float q) {
Expand Down Expand Up @@ -184,7 +185,7 @@ int16_t ReefwingLPS22HB::twosCompToInteger(uint16_t two_compliment_val) {
uint16_t sign_mask = 0x8000;

if ( (two_compliment_val & sign_mask) == 0 ) {
// if positive
// positive number - do nothing
return two_compliment_val;
}
else {
Expand Down
5 changes: 3 additions & 2 deletions src/ReefwingLPS22HB.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@copyright Please see the accompanying LICENSE file.
Code: David Such
Version: 1.0.2
Date: 20/02/23
Version: 1.0.3
Date: 21/02/23
1.0.1 Original Release. 11/02/23
1.0.2 Added 2's comp for temperature 20/02/23
1.0.3 Fixed setODR() bug 21/02/23
Credit - Some code used from the LPS22HB Absolute Digital Barometer
class by Adrien Chapelet for IoThings.
Expand Down

0 comments on commit 7011f2c

Please sign in to comment.