diff --git a/.arduino-ci.yml b/.arduino-ci.yml index cecf585..6925b23 100644 --- a/.arduino-ci.yml +++ b/.arduino-ci.yml @@ -1,3 +1,18 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: @@ -9,3 +24,6 @@ compile: - esp32 # - esp8266 # - mega2560 + - rpipico + + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..15e6206 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,111 @@ +# Change Log MS5611 + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [0.3.9] - 2022-10-26 +- add RP2040 support to build-CI +- add CHANGELOG.md +- add getManufacturer() +- add getSerialCode() +- add parameter mathMode to **reset()** to switch between pressure math. + - see readme for details. + +## [0.3.8] - 2022-01-24 +- reset() returns bool indicating successful ROM read +- get/setCompensation() to enable/disable compensation. + +## [0.3.7] - 2022-01-22 +- fix #26 added getPromHash() == **getDeviceID()** + - add getDeviceID(), to provide a sort of unique device ID (experimental) based +upon uniqueness of the factory calibration values. +- fix #24 default all examples address 0x77 +- default address for constructor, can be set as define on the command line. +MS5611_DEFAULT_ADDRESS. + +## [0.3.6] - 2022-01-15 +- add setOffset functions; minor refactor; +- The timing for convert is adjusted from TYPICAL to MAX + - datasheet page 3. - see issue #23 +- The **write(0)** in **isConnected()** is made conditional explicit for the NANO 33 BLE. + +## [0.3.5] - 2022-01-13 +- fix isConnected() for NANO 33 BLE + +## [0.3.4] - 2021-12-29 +- fix #16 compilation for MBED + +## [0.3.3] - 2021-12-25 +- Update oversampling timings to reduce time spent waiting + +## [0.3.2] - 2021-12-24 +- add get/set oversampling, read() (thanks to LyricPants66133) + +## [0.3.1] - 2021-12-21 +- update library.json, readme, license, minor edits + +## [0.3.0] - 2021-01-27 +- fix #9 math error (thanks to Emiel Steerneman) + - previous versions ==> **obsolete**. + - temperature is a float expressed in degrees Celsius. + - pressure is a float expressed in mBar. +- add Wire1..WireN support (e.g. teensy) +- changed getTemperature() and getPressure() +- add reset() + +---- + +## [0.2.2] - 2021-01-01 +- add Arduino-CI + unit tests + isConnected() + +## [0.2.1] - 2020-06-28 +- fix #1 min macro compile error + +## [0.2.0] - 2020-06-21 +- refactor; #pragma once; + +---- + +## [0.1.8] - 2018-07-01 +- fix #109 incorrect constants (thanks to flauth) + +## [0.1.7] = 2017-07-26 +- revert double to float (issue 33) + +## [0.1.6] - 2015-07-12 +- refactor + +## [0.1.05] - 2015-03-07 +- moved 6 float multiplies to init() ==> adds ~70 bytes !!! +- moved the MS5611_LIB_VERSION to PROGMEM + +## [0.1.04] - 2014-10-19 +- changed float to double (for platforms which support it) +- changed divisions in multiplications +- fixed uint32_t readADC() +- reduced size of C array by 1 float +- added second order temperature compensation + +## [0.1.03] - 2014-10-17 +- changed math to float (test version) + +## [0.1.02] - 2014-10-17 +- fixed bug return value read() +- fixed bug #bits D2 +- added MS5611_READ_OK +- added inline getters for temp & pres & lastResult. +- adjusted delay's based on datasheet +- merged convert functions +- fixed offset in readProm() + +## [0.1.01] - 2014-10-16 +- small refactoring + +## [0.1.00] +- added temperature and Pressure code + +## [0.0.00] - 2014-10-15 +- initial version \ No newline at end of file diff --git a/MS5611.cpp b/MS5611.cpp index f23f5f0..fbc91c9 100644 --- a/MS5611.cpp +++ b/MS5611.cpp @@ -2,52 +2,11 @@ // FILE: MS5611.cpp // AUTHOR: Rob Tillaart // Erni - testing/fixes -// VERSION: 0.3.8 +// VERSION: 0.3.9 // PURPOSE: MS5611 Temperature & Humidity library for Arduino // URL: https://github.com/RobTillaart/MS5611 // -// HISTORY: -// 0.3.8 2022-01-24 reset() returns bool -// get/setCompensation() -// 0.3.7 2022-01-22 fix #26 added getPromHash() -// fix #24 default all examples address 0x77 -// 0.3.6 2022-01-15 add setOffset functions; minor refactor; -// adjust convert timing to max - see issue #23 -// 0.3.5 2022-01-13 fix isConnected() for NANO 33 BLE -// 0.3.4 2021-12-29 fix #16 compilation for MBED -// 0.3.3 2021-12-25 Update oversampling timings to reduce time spent waiting -// 0.3.2 2021-12-24 add get/set oversampling, read() (thanks to LyricPants66133) -// 0.3.1 2021-12-21 update library.json, readme, license, minor edits -// 0.3.0 2021-01-27 fix #9 math error (thanks to Emiel Steerneman) -// add Wire1..WireN support (e.g. teensy) -// changed getTemperature() and getPressure() -// add reset() -// -// 0.2.2 2021-01-01 add Arduino-CI + unit tests + isConnected() -// 0.2.1 2020-06-28 fix #1 min macro compile error -// 0.2.0 2020-06-21 refactor; #pragma once; -// -// 0.1.8 fix #109 incorrect constants (thanks to flauth) -// 0.1.7 revert double to float (issue 33) -// 0.1.6 2015-07-12 refactor -// 0.1.05 moved 6 float multiplies to init [adds ~70 bytes !!!] -// moved the MS5611_LIB_VERSION to PROGMEM -// 0.1.04 changed float to double (for platforms which support it) -// changed divisions in multiplications -// fixed uint32_t readADC() -// reduced size of C array by 1 float -// added second order temperature compensation -// 0.1.03 changed math to float [test version] -// 0.1.02 fixed bug return value read() -// fixed bug #bits D2 -// added MS5611_READ_OK -// added inline getters for temp & pres & lastResult. -// adjusted delay's based on datasheet -// merged convert functions -// fixed offset in readProm() -// 0.1.01 small refactoring -// 0.1.00 added temperature and Pressure code -// 0.0.00 initial version by Rob Tillaart (15-okt-2014) +// HISTORY see changelog.md #include "MS5611.h" @@ -63,7 +22,7 @@ ///////////////////////////////////////////////////// // -// PUBLIC +// PUBLIC // MS5611::MS5611(uint8_t deviceAddress) { @@ -121,38 +80,34 @@ bool MS5611::isConnected() } -bool MS5611::reset() +bool MS5611::reset(uint8_t mathMode) { command(MS5611_CMD_RESET); uint32_t start = micros(); - // while loop prevents blocking RTOS + + // while loop prevents blocking RTOS while (micros() - start < 2800) { yield(); delayMicroseconds(10); } - // constants that were multiplied in read() - // do this once and you save CPU cycles - C[0] = 1; - C[1] = 32768L; // SENSt1 = C[1] * 2^15 - C[2] = 65536L; // OFFt1 = C[2] * 2^16 - C[3] = 3.90625E-3; // TCS = C[3] / 2^6 - C[4] = 7.8125E-3; // TCO = C[4] / 2^7 - C[5] = 256; // Tref = C[5] * 2^8 - C[6] = 1.1920928955E-7; // TEMPSENS = C[6] / 2^23 - // read factory calibrations from EEPROM. + + // initialize the C[] array + initConstants(mathMode); + + // read factory calibrations from EEPROM. bool ROM_OK = true; for (uint8_t reg = 0; reg < 7; reg++) { - // used indices match datasheet. - // C[0] == manufacturer - read but not used; - // C[7] == CRC - skipped. + // used indices match datasheet. + // C[0] == manufacturer - read but not used; + // C[7] == CRC - skipped. uint16_t tmp = readProm(reg); C[reg] *= tmp; - // _deviceID is a simple SHIFT XOR merge of PROM data + // _deviceID is a SHIFT XOR merge of 7 PROM registers, reasonable unique _deviceID <<= 4; _deviceID ^= tmp; - // Serial.println(readProm(reg)); + // Serial.println(readProm(reg)); if (reg > 0) { ROM_OK = ROM_OK && (tmp != 0); @@ -164,12 +119,12 @@ bool MS5611::reset() int MS5611::read(uint8_t bits) { - // VARIABLES NAMES BASED ON DATASHEET - // ALL MAGIC NUMBERS ARE FROM DATASHEET + // VARIABLES NAMES BASED ON DATASHEET + // ALL MAGIC NUMBERS ARE FROM DATASHEET convert(MS5611_CMD_CONVERT_D1, bits); if (_result) return _result; - // NOTE: D1 and D2 seem reserved in MBED (NANO BLE) + // NOTE: D1 and D2 seem reserved in MBED (NANO BLE) uint32_t _D1 = readADC(); if (_result) return _result; @@ -178,14 +133,14 @@ int MS5611::read(uint8_t bits) uint32_t _D2 = readADC(); if (_result) return _result; - // Serial.println(_D1); - // Serial.println(_D2); + // Serial.println(_D1); + // Serial.println(_D2); // TEST VALUES - comment lines above - // uint32_t _D1 = 9085466; - // uint32_t _D2 = 8569150; + // uint32_t _D1 = 9085466; + // uint32_t _D2 = 8569150; - // TEMP & PRESS MATH - PAGE 7/20 + // TEMP & PRESS MATH - PAGE 7/20 float dT = _D2 - C[5]; _temperature = 2000 + dT * C[6]; @@ -194,16 +149,16 @@ int MS5611::read(uint8_t bits) if (_compensation) { - // SECOND ORDER COMPENSATION - PAGE 8/20 - // COMMENT OUT < 2000 CORRECTION IF NOT NEEDED - // NOTE TEMPERATURE IS IN 0.01 C + // SECOND ORDER COMPENSATION - PAGE 8/20 + // COMMENT OUT < 2000 CORRECTION IF NOT NEEDED + // NOTE TEMPERATURE IS IN 0.01 C if (_temperature < 2000) { float T2 = dT * dT * 4.6566128731E-10; float t = (_temperature - 2000) * (_temperature - 2000); float offset2 = 2.5 * t; float sens2 = 1.25 * t; - // COMMENT OUT < -1500 CORRECTION IF NOT NEEDED + // COMMENT OUT < -1500 CORRECTION IF NOT NEEDED if (_temperature < -1500) { t = (_temperature + 1500) * (_temperature + 1500); @@ -214,7 +169,7 @@ int MS5611::read(uint8_t bits) offset -= offset2; sens -= sens2; } - // END SECOND ORDER COMPENSATION + // END SECOND ORDER COMPENSATION } _pressure = (_D1 * sens * 4.76837158205E-7 - offset) * 3.051757813E-5; @@ -243,14 +198,26 @@ float MS5611::getPressure() const return _pressure * 0.01 + _pressureOffset; }; +// EXPERIMENTAL +uint16_t MS5611::getManufacturer() +{ + return readProm(0); +} + +// EXPERIMENTAL +uint16_t MS5611::getSerialCode() +{ + return readProm(7) >> 4; +} + ///////////////////////////////////////////////////// // -// PRIVATE +// PRIVATE // void MS5611::convert(const uint8_t addr, uint8_t bits) { - // values from page 3 datasheet - MAX column (rounded up) + // values from page 3 datasheet - MAX column (rounded up) uint16_t del[5] = {600, 1200, 2300, 4600, 9100}; uint8_t index = bits; @@ -262,7 +229,7 @@ void MS5611::convert(const uint8_t addr, uint8_t bits) uint16_t waitTime = del[index]; uint32_t start = micros(); - // while loop prevents blocking RTOS + // while loop prevents blocking RTOS while (micros() - start < waitTime) { yield(); @@ -273,7 +240,7 @@ void MS5611::convert(const uint8_t addr, uint8_t bits) uint16_t MS5611::readProm(uint8_t reg) { - // last EEPROM register is CRC - Page 13 datasheet. + // last EEPROM register is CRC - Page 13 datasheet. uint8_t promCRCRegister = 7; if (reg > promCRCRegister) return 0; @@ -325,5 +292,29 @@ int MS5611::command(const uint8_t command) } +void MS5611::initConstants(uint8_t mathMode) +{ + // constants that were multiplied in read() - datasheet page 8 + // do this once and you save CPU cycles + // + // datasheet ms5611 | appNote + // mode = 0; | mode = 1 + C[0] = 1; + C[1] = 32768L; // SENSt1 = C[1] * 2^15 | * 2^16 + C[2] = 65536L; // OFFt1 = C[2] * 2^16 | * 2^17 + C[3] = 3.90625E-3; // TCS = C[3] / 2^8 | / 2^7 + C[4] = 7.8125E-3; // TCO = C[4] / 2^7 | / 2^6 + C[5] = 256; // Tref = C[5] * 2^8 | * 2^8 + C[6] = 1.1920928955E-7; // TEMPSENS = C[6] / 2^23 | / 2^23 + + if (mathMode == 1) // Appnote version for pressure. + { + C[1] = 65536L; // SENSt1 + C[2] = 131072L; // OFFt1 + C[3] = 7.8125E-3; // TCS + C[4] = 1.5625e-2; // TCO + } +} + // -- END OF FILE -- diff --git a/MS5611.h b/MS5611.h index 07e7dd1..17b5ec8 100644 --- a/MS5611.h +++ b/MS5611.h @@ -3,7 +3,7 @@ // FILE: MS5611.h // AUTHOR: Rob Tillaart // Erni - testing/fixes -// VERSION: 0.3.8 +// VERSION: 0.3.9 // PURPOSE: Arduino library for MS5611 temperature and pressure sensor // URL: https://github.com/RobTillaart/MS5611 @@ -30,14 +30,14 @@ // CS to GND ==> 0x77 -#define MS5611_LIB_VERSION (F("0.3.8")) +#define MS5611_LIB_VERSION (F("0.3.9")) #ifndef MS5611_DEFAULT_ADDRESS #define MS5611_DEFAULT_ADDRESS 0x77 #endif #define MS5611_READ_OK 0 -#define MS5611_ERROR_2 2 // low level I2C error +#define MS5611_ERROR_2 2 // low level I2C error #define MS5611_NOT_READ -999 @@ -62,26 +62,27 @@ class MS5611 bool begin(TwoWire *wire = &Wire); bool isConnected(); - // reset command + get constants - // returns false if ROM constants == 0; - bool reset(); + // reset command + get constants + // mathMode = 0 (default), 1 = factor 2 fix. + // returns false if ROM constants are 0; + bool reset(uint8_t mathMode = 0); - // the actual reading of the sensor; - // returns MS5611_READ_OK upon success + // the actual reading of the sensor; + // returns MS5611_READ_OK upon success int read(uint8_t bits); - // wrapper, uses the preset oversampling rate. + // wrapper, uses the preset oversampling rate. inline int read() { return read( (uint8_t) _samplingRate); }; - // sets oversampling to a value between 8 and 12 + // sets oversampling to a value between 8 and 12 void setOversampling(osr_t samplingRate); - // oversampling rate is in osr_t + // oversampling rate is in osr_t osr_t getOversampling() const { return (osr_t) _samplingRate; }; - // temperature is in ²C + // temperature is in ²C float getTemperature() const; - // pressure is in mBar + // pressure is in mBar float getPressure() const; // OFFSET - 0.3.6 @@ -90,30 +91,36 @@ class MS5611 void setTemperatureOffset(float offset = 0) { _temperatureOffset = offset; }; float getTemperatureOffset() { return _temperatureOffset; }; - // to check for failure + // to check for failure int getLastResult() const { return _result; }; - // last time in millis() when the sensor has been read. + // last time in millis() when the sensor has been read. uint32_t lastRead() const { return _lastRead; }; + // _deviceID is a SHIFT XOR merge of 7 PROM registers, reasonable unique uint32_t getDeviceID() const { return _deviceID; }; void setCompensation(bool flag = true) { _compensation = flag; }; bool getCompensation() { return _compensation; }; - // develop functions. + // develop functions. /* void setAddress(uint8_t address) { _address = address; }; // RANGE CHECK + isConnected() ! uint8_t getAddress() const { return _address; }; uint8_t detectAddress() { todo }; // works with only one on the bus? */ + // EXPERIMENTAL + uint16_t getManufacturer(); + uint16_t getSerialCode(); -private: + +protected: void convert(const uint8_t addr, uint8_t bits); uint32_t readADC(); uint16_t readProm(uint8_t reg); int command(const uint8_t command); + void initConstants(uint8_t mathMode); uint8_t _address; uint8_t _samplingRate; diff --git a/README.md b/README.md index 12d5678..7cc9ee1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Arduino library for MS5611 pressure (and temperature) sensor. ## Description -The MS5611 is a high resolution pressure (and temperature) sensor a.k.a GY-63. +The MS5611-01BA03 is a high resolution pressure (and temperature) sensor a.k.a GY-63. The high resolution is made possible by oversampling many times. The device address is 0x76 or 0x77 depending on the CSB/CSO pin. @@ -24,6 +24,13 @@ An experimental SPI version of the library can be found here - https://github.com/RobTillaart/MS5611_SPI +#### Compatibility + +The library should be compatible with MS56XX, MS57xx and MS58xx devices (to be tested). +Some device types will returns only 50% of the pressure value. +This is solved in 0.3.9 by calling **reset(1)** to select the math used. + + #### Self heating In some configurations especially when using SPI the sensor showed a self heating. @@ -80,13 +87,13 @@ For pressure conversions see - https://github.com/RobTillaart/pressure For temperature conversions see - https://github.com/RobTillaart/Temperature -## Release Notes +## Release Notes (major) #### 0.3.0 breaking change -1. fixed math error so previous versions are **obsolete**. -2. temperature is a float expressed in degrees Celsius. -3. pressure is a float expressed in mBar. +- fixed math error so previous versions are **obsolete**. +- temperature is a float expressed in degrees Celsius. +- pressure is a float expressed in mBar. #### 0.3.5 NANO 33 BLE @@ -98,25 +105,18 @@ Adding a **wire->write(0x00)** in **isConnected()** fixes the problem, however more investigation is needed to understand the root cause. -#### 0.3.6 - -The **write(0)** in **isConnected()** is made conditional explicit for the NANO 33 BLE. - -The timing for convert is adjusted from TYPICAL to MAX - datasheet page 3. - - -#### 0.3.7 +#### 0.3.9 pressure math -- default address for constructor, can be set as define on the command line. -MS5611_DEFAULT_ADDRESS -- added getDeviceID(), to provide a sort of unique device ID (experimental) based -upon uniqueness of the factory calibration values. +There are MS5611 compatibles for which the math for the pressure is different. +See **AN520__004: C-code example for MS56xx, MS57xx (except analog sensor), and MS58xx series pressure sensors** +The difference is in the constants (powers of 2) used to calculate the pressure. +The library implements **reset(uint8_t mathMode = 0)** to select the mathMode. +- mathMode = 0 ==> datasheet type math (default) +- mathMode = 1 ==> Application notes type math. +- other values will act as 0 -#### 0.3.8 - -- reset() returns bool indicating succesful ROM read -- get/setCompensation() to enable/disable compensation. +See issue #33. ## Interface @@ -133,8 +133,10 @@ Initializes internals by calling reset(). Return false indicates either isConnected() error or reset() error. - **bool isConnected()** checks availability of device address on the I2C bus. (see note above NANO 33 BLE). -- **bool reset()** resets the chip and loads constants from its ROM. +- **bool reset(uint8_t mathMode = 0)** resets the chip and loads constants from its ROM. Returns false if ROM could not be read. + - mathMode = 0 follows the datasheet math (default). + - mathMode = 1 will adjust for a factor 2 in the pressure math. - **int read(uint8_t bits)** the actual reading of the sensor. Number of bits determines the oversampling factor. Returns MS5611_READ_OK upon success. - **int read()** wraps the **read()** above, uses the preset oversampling (see below). @@ -201,6 +203,13 @@ Having a device-ID can be used in many ways: Note: this is not an official ID from the device / datasheet, it is made up from calibration data. +#### getManufacturer + +The meaning of the manufacturer and serialCode value is unclear. +- **uint16_t getManufacturer()** returns manufacturer private info. +- **uint16_t getSerialCode()** returns serialCode from the PROM\[6]. + + #### 2nd order pressure compensation - **setCompensation(bool flag = true)** to enable/desirable the 2nd order compensation. @@ -216,9 +225,15 @@ See examples ## Future +#### must - update documentation - - separate release notes? + +#### should - proper error handling. +- move all code to .cpp + +#### could - redo lower level functions? -- handle the read + math of temperature first? +- handle the read + math of temperature first? + diff --git a/examples/MS5611_adjust_pressure_math/MS5611_adjust_pressure_math.ino b/examples/MS5611_adjust_pressure_math/MS5611_adjust_pressure_math.ino new file mode 100644 index 0000000..f622267 --- /dev/null +++ b/examples/MS5611_adjust_pressure_math/MS5611_adjust_pressure_math.ino @@ -0,0 +1,139 @@ +// +// FILE: MS5611_adjust_pressure_math.ino +// AUTHOR: Rob Tillaart +// PURPOSE: demo application +// DATE: 2022-10-27 +// URL: https://github.com/RobTillaart/MS5611 + + +#include "MS5611.h" + +// BREAKOUT MS5611 aka GY63 - see datasheet +// +// SPI I2C +// +--------+ +// VCC VCC | o | +// GND GND | o | +// SCL | o | +// SDI SDA | o | +// CSO | o | +// SDO | o L | L = led +// PS | o O | O = opening PS = protocol select +// +--------+ +// +// PS to VCC ==> I2C (GY-63 board has internal pull up, so not needed) +// PS to GND ==> SPI +// CS to VCC ==> 0x76 +// CS to GND ==> 0x77 + +MS5611 MS5611(0x77); + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif + +uint32_t start, stop; + + +void setup() +{ + Serial.begin(115200); + while (!Serial); + + pinMode(LED_BUILTIN, OUTPUT); + + Serial.println(); + Serial.println(__FILE__); + Serial.print("MS5611_LIB_VERSION: "); + Serial.println(MS5611_LIB_VERSION); + + if (MS5611.begin() == true) + { + Serial.println("MS5611 found."); + } + else + { + Serial.println("MS5611 not found. halt."); + while (1) + { + digitalWrite(LED_BUILTIN, HIGH); + delay(1000); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + } + } + // use adjusted math for pressure. + MS5611.reset(1); + + Serial.println(); +} + + +/* + There are 5 oversampling settings, each corresponding to a different amount of milliseconds + The higher the oversampling, the more accurate the reading will be, however the longer it will take. + OSR_ULTRA_HIGH -> 8.22 millis + OSR_HIGH -> 4.11 millis + OSR_STANDARD -> 2.1 millis + OSR_LOW -> 1.1 millis + OSR_ULTRA_LOW -> 0.5 millis Default = backwards compatible +*/ +void loop() +{ + digitalWrite(LED_BUILTIN, HIGH); + MS5611.setOversampling(OSR_ULTRA_LOW); + test(); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + + digitalWrite(LED_BUILTIN, HIGH); + MS5611.setOversampling(OSR_LOW); + test(); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + + digitalWrite(LED_BUILTIN, HIGH); + MS5611.setOversampling(OSR_STANDARD); + test(); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + + digitalWrite(LED_BUILTIN, HIGH); + MS5611.setOversampling(OSR_HIGH); + test(); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + + digitalWrite(LED_BUILTIN, HIGH); + MS5611.setOversampling(OSR_ULTRA_HIGH); + test(); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + Serial.println(); +} + + +void test() +{ + start = micros(); + int result = MS5611.read(); + stop = micros(); + if (result != MS5611_READ_OK) + { + Serial.print("Error in read: "); + Serial.println(result); + } + else + { + Serial.print("T:\t"); + Serial.print(MS5611.getTemperature(), 2); + Serial.print("\tP:\t"); + Serial.print(MS5611.getPressure(), 2); + Serial.print("\tt:\t"); + Serial.print(stop - start); + Serial.println(); + } +} + + +// -- END OF FILE -- diff --git a/keywords.txt b/keywords.txt index d2cf00d..d3c7b50 100644 --- a/keywords.txt +++ b/keywords.txt @@ -26,6 +26,12 @@ getPressureOffset KEYWORD2 getDeviceID KEYWORD2 +setCompensation KEYWORD2 +getCompensation KEYWORD2 + +getManufacturer KEYWORD2 +getSerialCode KEYWORD2 + # Instances (KEYWORD2) diff --git a/library.json b/library.json index 75ff4c6..7df0cf9 100644 --- a/library.json +++ b/library.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/RobTillaart/MS5611.git" }, - "version": "0.3.8", + "version": "0.3.9", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/library.properties b/library.properties index 493f22c..b13666b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=MS5611 -version=0.3.8 +version=0.3.9 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for MS5611 temperature and pressure sensor