diff --git a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/LICENSE.md b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/LICENSE.md index e64bd4ef35dab8bab46d8dfe2833a13d2e95b852..37238686da3d06815b45154961d5744d28516153 100644 --- a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/LICENSE.md +++ b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/LICENSE.md @@ -34,7 +34,7 @@ Code The MIT License (MIT) -Copyright (c) 2016 SparkFun Electronics +Copyright (c) 2020 SparkFun Electronics Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/README.md b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/README.md index 2f7c69c4c8967f95ba0ce8eaeafe8dd4e041dbcc..9be1a0eae22818145a733f66955603ef007c49a9 100644 --- a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/README.md +++ b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/README.md @@ -24,6 +24,7 @@ Thanks to! * [awatterott](https://github.com/awatterott) for adding [getAltitudeCompensation()](https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library/pull/18) * [jogi-k](https://github.com/jogi-k) for adding [teensy i2clib](https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library/pull/19) support * [paulvha](https://github.com/paulvha) for the suggestions and corrections in [his version of the library](https://github.com/paulvha/scd30) +* [yamamaya](https://github.com/yamamaya) for the [3ms delay](https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library/pull/24) Repository Contents ------------------- @@ -43,8 +44,6 @@ License Information This product is _**open source**_! -Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round! - Please use, reuse, and modify these files as you see fit. Please maintain attribution to SparkFun Electronics and release anything derivative under the same license. Distributed as-is; no warranty is given. diff --git a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/library.properties b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/library.properties index a02d23554f4380fc445fdcbd48bf4c680da0bf9a..1e004493e332a8dcc2af1dce00ee7aab8e3bdc72 100644 --- a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/library.properties +++ b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/library.properties @@ -1,5 +1,5 @@ name=SparkFun SCD30 Arduino Library -version=1.0.11 +version=1.0.13 author=SparkFun Electronics maintainer=SparkFun Electronics <sparkfun.com> sentence=Library for the Sensirion SCD30 CO2 Sensor diff --git a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.cpp b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.cpp index c2a4230c587db68fdd8cf2fc69877d683cf5ce67..3d4ed4558b8e321a5308c9f195212e2382ac0e63 100644 --- a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.cpp +++ b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.cpp @@ -266,6 +266,8 @@ bool SCD30::readMeasurement() if (_i2cPort->endTransmission() != 0) return (0); //Sensor did not ACK + delay(3); + const uint8_t receivedBytes = _i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)18); bool error = false; if (_i2cPort->available()) @@ -358,6 +360,8 @@ bool SCD30::getSettingValue(uint16_t registerAddress, uint16_t *val) if (_i2cPort->endTransmission() != 0) return (false); //Sensor did not ACK + delay(3); + _i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)3); // Request data and CRC if (_i2cPort->available()) { @@ -389,6 +393,8 @@ uint16_t SCD30::readRegister(uint16_t registerAddress) if (_i2cPort->endTransmission() != 0) return (0); //Sensor did not ACK + delay(3); + _i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)2); if (_i2cPort->available()) { diff --git a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h index 3f39996a2c3800794c533df04b3a542f9a43fe14..0104d092167cac83b806c41fdc8694e504b607d2 100644 --- a/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h +++ b/ampel-firmware/src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h @@ -57,9 +57,10 @@ #define COMMAND_STOP_MEAS 0x0104 #define COMMAND_READ_FW_VER 0xD100 -typedef union { - byte array[4]; - float value; +typedef union +{ + byte array[4]; + float value; } ByteToFl; // paulvha class SCD30 @@ -69,9 +70,9 @@ public: bool begin(bool autoCalibrate) { return begin(Wire, autoCalibrate); } #ifdef USE_TEENSY3_I2C_LIB - bool begin(i2c_t3 &wirePort = Wire, bool autoCalibrate=true, bool measBegin=true); //By default use Wire port + bool begin(i2c_t3 &wirePort = Wire, bool autoCalibrate = false, bool measBegin = true); //By default use Wire port #else - bool begin(TwoWire &wirePort = Wire, bool autoCalibrate=true, bool measBegin=true); //By default use Wire port + bool begin(TwoWire &wirePort = Wire, bool autoCalibrate = false, bool measBegin = true); //By default use Wire port #endif void enableDebugging(Stream &debugPort = Serial); //Turn on debug printing. If user doesn't specify then Serial will be used. @@ -82,11 +83,11 @@ public: // based on paulvha bool getSettingValue(uint16_t registerAddress, uint16_t *val); - bool getForcedRecalibration(uint16_t *val) {return(getSettingValue(COMMAND_SET_FORCED_RECALIBRATION_FACTOR, val));} - bool getMeasurementInterval(uint16_t *val) {return(getSettingValue(COMMAND_SET_MEASUREMENT_INTERVAL, val));} - bool getTemperatureOffset(uint16_t *val) {return(getSettingValue(COMMAND_SET_TEMPERATURE_OFFSET, val));} - bool getAltitudeCompensation(uint16_t *val) {return(getSettingValue(COMMAND_SET_ALTITUDE_COMPENSATION, val));} - bool getFirmwareVersion(uint16_t *val) {return(getSettingValue(COMMAND_READ_FW_VER, val));} + bool getForcedRecalibration(uint16_t *val) { return (getSettingValue(COMMAND_SET_FORCED_RECALIBRATION_FACTOR, val)); } + bool getMeasurementInterval(uint16_t *val) { return (getSettingValue(COMMAND_SET_MEASUREMENT_INTERVAL, val)); } + bool getTemperatureOffset(uint16_t *val) { return (getSettingValue(COMMAND_SET_TEMPERATURE_OFFSET, val)); } + bool getAltitudeCompensation(uint16_t *val) { return (getSettingValue(COMMAND_SET_ALTITUDE_COMPENSATION, val)); } + bool getFirmwareVersion(uint16_t *val) { return (getSettingValue(COMMAND_READ_FW_VER, val)); } uint16_t getCO2(void); float getHumidity(void); @@ -115,12 +116,11 @@ public: uint8_t computeCRC8(uint8_t data[], uint8_t len); private: - //Variables #ifdef USE_TEENSY3_I2C_LIB i2c_t3 *_i2cPort; //The generic connection to user's chosen I2C hardware #else - TwoWire *_i2cPort; //The generic connection to user's chosen I2C hardware + TwoWire *_i2cPort; //The generic connection to user's chosen I2C hardware #endif //Global main datums float co2 = 0; @@ -136,6 +136,5 @@ private: //Debug Stream *_debugPort; //The stream to send debug messages to if enabled. Usually Serial. boolean _printDebug = false; //Flag to print debugging variables - }; #endif