diff --git a/libraries/SHT85/.arduino-ci.yml b/libraries/SHT85/.arduino-ci.yml index 3e496624..b4ab412d 100644 --- a/libraries/SHT85/.arduino-ci.yml +++ b/libraries/SHT85/.arduino-ci.yml @@ -1,11 +1,27 @@ +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: - uno - - due - - zero - - leonardo + # - due + # - zero + # - leonardo - m4 - esp32 - esp8266 - - mega2560 + # - mega2560 + - rpipico diff --git a/libraries/SHT85/CHANGELOG.md b/libraries/SHT85/CHANGELOG.md new file mode 100644 index 00000000..c446dc44 --- /dev/null +++ b/libraries/SHT85/CHANGELOG.md @@ -0,0 +1,50 @@ +# Change Log SHT85 + +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.3] - 2022-11-24 +- Add RP2040 support to build-CI. +- Add CHANGELOG.md + + +## [0.3.2] - 2022-01-17 +- fix #8 add SHT_DEFAULT_ADDRESS + 2x begin() + +## [0.3.1] - 2021-12-28 +- update library.json +- update readme.md +- update license +- minor edits + +## [0.3.0] - 2021-10-20 +- Fix #6 image in documentation, +- pdate build-CI + +---- + +## [0.2.0] - 2021-08-24 +- split off base class +- create derived classes SHT85, 30, 31, 35 + +---- + +## [0.1.4] - 2021-08-24 +- prevent heater to switch on too fast. +- update readme + +## [0.1.3] - 2021-08-06 +- expose raw data from sensor + +## [0.1.2] - 2021-05-27 +- fix Arduino-lint + +## [0.1.1] - 2021-03-13 +- initial release + +## [0.1.0] - 2021-02-10 +- initial version + diff --git a/libraries/SHT85/README.md b/libraries/SHT85/README.md index f3e9a96a..c955a187 100644 --- a/libraries/SHT85/README.md +++ b/libraries/SHT85/README.md @@ -11,6 +11,8 @@ Arduino library for the SHT85 temperature and humidity sensor. Based upon the SHT31 library - https://github.com/RobTillaart/SHT31 +however this one will be leading in the future as it implements classes for the following SHT sensors: **SHT30, SHT31 and SHT35.** + **Warning:** to keep self-heating below 0.1°C, the SHT85 sensor should not be used for more than 10% of the time. @@ -197,15 +199,21 @@ See examples. - improve error handling / status. (all code paths) - add offsets for temperature and humidity. - like other sensors +- move code from .h to .cpp + #### could - investigate command ART (auto sampling at 4 Hz) - investigate command BREAK (stop auto sampling) - merge with other SHT sensors if possible +- separate release notes. + #### won't +- rename the library? to SHT ? or sensirion.h ? + - not on short term - create a SHT85 simulator - I2C slave sketch with e.g. a DHT22 sensor/ - not within this library. diff --git a/libraries/SHT85/SHT85.cpp b/libraries/SHT85/SHT85.cpp index 87faca5c..223cff14 100644 --- a/libraries/SHT85/SHT85.cpp +++ b/libraries/SHT85/SHT85.cpp @@ -1,27 +1,12 @@ // // FILE: SHT85.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.3.2 +// VERSION: 0.3.3 // DATE: 2021-02-10 // PURPOSE: Arduino library for the SHT85 temperature and humidity sensor // https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530 // URL: https://github.com/RobTillaart/SHT85 -// -// HISTORY: -// 0.1.0 2021-02-10 initial version -// 0.1.1 2021-03-13 initial release -// 0.1.2 2021-05-27 fix Arduino-lint -// 0.1.3 2021-08-06 expose raw data from sensor -// 0.1.4 2021-08-24 prevent heater to switch on too fast. -// update readme -// 0.2.0 2021-08-24 split off base class -// create derived classes SHT85, 30, 31, 35 -// -// 0.3.0 2021-10-20 Fix #6 image in documentation, -// update build-CI -// 0.3.1 2021-12-28 update library.json, readme, license, minor edits -// 0.3.2 2022-01-17 fix #8 add SHT_DEFAULT_ADDRESS + 2x begin() #include "SHT85.h" @@ -123,45 +108,45 @@ bool SHT::isConnected() } #ifdef doc -// bit - description -// ================== -// 15 Alert pending status -// '0': no pending alerts -// '1': at least one pending alert - default -// 14 Reserved β€˜0’ -// 13 Heater status -// '0’ : Heater OFF - default -// '1’ : Heater ON -// 12 Reserved '0’ -// 11 Humidity tracking alert -// '0’ : no alert - default -// '1’ : alert -// 10 Temp tracking alert -// '0’ : no alert - default -// '1’ : alert -// 9:5 Reserved '00000’ -// 4 System reset detected -// '0': no reset since last β€˜clear status register’ command -// '1': reset detected (hard or soft reset command or supply fail) - default -// 3:2 Reserved β€˜00’ -// 1 Command status -// '0': last command executed successfully -// '1': last command not processed. Invalid or failed checksum -// 0 Write data checksum status -// '0': checksum of last write correct -// '1': checksum of last write transfer failed +// bit - description +// ================== +// 15 Alert pending status +// '0': no pending alerts +// '1': at least one pending alert - default +// 14 Reserved β€˜0’ +// 13 Heater status +// '0’ : Heater OFF - default +// '1’ : Heater ON +// 12 Reserved '0’ +// 11 Humidity tracking alert +// '0’ : no alert - default +// '1’ : alert +// 10 Temp tracking alert +// '0’ : no alert - default +// '1’ : alert +// 9:5 Reserved '00000’ +// 4 System reset detected +// '0': no reset since last β€˜clear status register’ command +// '1': reset detected (hard or soft reset command or supply fail) - default +// 3:2 Reserved β€˜00’ +// 1 Command status +// '0': last command executed successfully +// '1': last command not processed. Invalid or failed checksum +// 0 Write data checksum status +// '0': checksum of last write correct +// '1': checksum of last write transfer failed #endif uint16_t SHT::readStatus() { uint8_t status[3] = { 0, 0, 0 }; - // page 13 datasheet + // page 13 datasheet if (writeCmd(SHT_READ_STATUS) == false) { return 0xFFFF; } - // 16 bit status + CRC + // 16 bit status + CRC if (readBytes(3, (uint8_t*) &status[0]) == false) { return 0xFFFF; @@ -184,7 +169,7 @@ bool SHT::reset(bool hard) { return false; } - delay(1); // table 4 datasheet + delay(1); // table 4 datasheet return true; } @@ -217,7 +202,7 @@ bool SHT::heatOn() bool SHT::heatOff() { - // always switch off the heater - ignore _heaterOn flag. + // always switch off the heater - ignore _heaterOn flag. if (writeCmd(SHT_HEAT_OFF) == false) { _error = SHT_ERR_HEATER_OFF; // can be serious! @@ -235,7 +220,7 @@ bool SHT::isHeaterOn() { return false; } - // did not exceed time out + // did not exceed time out if (millis() - _heaterStart < (_heatTimeout * 1000UL)) { return true; @@ -258,7 +243,7 @@ bool SHT::requestData() bool SHT::dataReady() { - return ((millis() - _lastRequest) > 15); // TODO MAGIC NR + return ((millis() - _lastRequest) > 15); // TODO MAGIC NR } @@ -355,7 +340,7 @@ bool SHT::readBytes(uint8_t n, uint8_t *val) //////////////////////////////////////////////////////// // -// DERIVED +// DERIVED // SHT30::SHT30() { @@ -381,4 +366,4 @@ SHT85::SHT85() }; -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/SHT85/SHT85.h b/libraries/SHT85/SHT85.h index b5201e4d..04b07957 100644 --- a/libraries/SHT85/SHT85.h +++ b/libraries/SHT85/SHT85.h @@ -2,35 +2,35 @@ // // FILE: SHT85.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.2 +// VERSION: 0.3.3 // DATE: 2021-02-10 // PURPOSE: Arduino library for the SHT85 temperature and humidity sensor // https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530 // URL: https://github.com/RobTillaart/SHT85 // -// keep lib in sync with https://github.com/RobTillaart/SHT31 +// keep lib in sync with https://github.com/RobTillaart/SHT31 // -// TOPVIEW SHT85 -// +-------+ -// +-----\ | SDA 4 ----- -// | +-+ ----+ GND 3 ----- -// | +-+ ----+ +5V 2 ----- -// +-----/ | SCL 1 ----- -// +-------+ +// TOPVIEW SHT85 +// +-------+ +// +-----\ | SDA 4 ----- +// | +-+ ----+ GND 3 ----- +// | +-+ ----+ +5V 2 ----- +// +-----/ | SCL 1 ----- +// +-------+ #include "Arduino.h" #include "Wire.h" -#define SHT_LIB_VERSION (F("0.3.2")) +#define SHT_LIB_VERSION (F("0.3.3")) #define SHT85_LIB_VERSION SHT_LIB_VERSION #ifndef SHT_DEFAULT_ADDRESS #define SHT_DEFAULT_ADDRESS 0x44 #endif -// fields readStatus +// fields readStatus #define SHT_STATUS_ALERT_PENDING (1 << 15) #define SHT_STATUS_HEATER_ON (1 << 13) #define SHT_STATUS_HUM_TRACK_ALERT (1 << 11) @@ -39,7 +39,7 @@ #define SHT_STATUS_COMMAND_STATUS (1 << 1) #define SHT_STATUS_WRITE_CRC_STATUS (1 << 0) -// error codes +// error codes #define SHT_OK 0x00 #define SHT_ERR_WRITECMD 0x81 #define SHT_ERR_READBYTES 0x82 @@ -59,11 +59,11 @@ public: #if defined(ESP8266) || defined(ESP32) bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin); - // use SHT_DEFAULT_ADDRESS + // use SHT_DEFAULT_ADDRESS bool begin(const uint8_t dataPin, const uint8_t clockPin); #endif bool begin(const uint8_t address, TwoWire *wire = &Wire); - // use SHT_DEFAULT_ADDRESS + // use SHT_DEFAULT_ADDRESS bool begin(TwoWire *wire = &Wire); uint8_t getType() { return _type; }; @@ -71,26 +71,26 @@ public: // blocks 15 milliseconds + actual read + math bool read(bool fast = true); - // check sensor is reachable over I2C + // check sensor is reachable over I2C bool isConnected(); - // details see datasheet; summary in SHT31.cpp file + // details see datasheet; summary in SHT85.cpp file uint16_t readStatus(); - // lastRead is in milliSeconds since start + // lastRead is in milliSeconds since start uint32_t lastRead() { return _lastRead; }; bool reset(bool hard = false); - // do not use heater for long periods, - // use it for max 3 minutes to heat up - // and let it cool down at least 3 minutes. + // do not use heater for long periods, + // use it for max 3 minutes to heat up + // and let it cool down at least 3 minutes. void setHeatTimeout(uint8_t seconds); uint8_t getHeatTimeout() { return _heatTimeout; }; bool heatOn(); bool heatOff(); - bool isHeaterOn(); // is the sensor still heating up? + bool isHeaterOn(); // is the sensor still heating up? float getHumidity() { return _rawHumidity * (100.0 / 65535); }; diff --git a/libraries/SHT85/library.json b/libraries/SHT85/library.json index d2273ca9..48ba621d 100644 --- a/libraries/SHT85/library.json +++ b/libraries/SHT85/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/SHT85" }, - "version": "0.3.2", + "version": "0.3.3", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/SHT85/library.properties b/libraries/SHT85/library.properties index be8c6adc..6a949363 100644 --- a/libraries/SHT85/library.properties +++ b/libraries/SHT85/library.properties @@ -1,5 +1,5 @@ name=SHT85 -version=0.3.2 +version=0.3.3 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for the SHT85, SHT30, SHT31, SHT35 Senserion temperature and humidity sensor diff --git a/libraries/SHT85/test/unit_test_001.cpp b/libraries/SHT85/test/unit_test_001.cpp index e527d44b..a1ecd1fb 100644 --- a/libraries/SHT85/test/unit_test_001.cpp +++ b/libraries/SHT85/test/unit_test_001.cpp @@ -35,7 +35,7 @@ #include "SHT85.h" -int expect; // TODO needed as there seems a problem with 8 bit comparisons (char?) +int expect; // TODO needed as there seems a problem with 8 bit comparisons (char?) uint32_t start, stop; @@ -95,7 +95,7 @@ unittest(test_begin) Serial.println(sht.getRawTemperature()); Serial.println(sht.getRawHumidity()); - // default value == 0 + // default value == 0 assertEqual(-45, sht.getTemperature()); assertEqual(0, sht.getHumidity()); assertEqual(0, sht.getRawTemperature());