mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2026-08-15 04:21:36 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92f3c30e82 | ||
|
|
c927504bf5 |
@@ -12,6 +12,8 @@ Please delete options that are not relevant.
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
- [ ] I have updated the version in `library.properties` to reflect my changes (advance by 0.01 for minor changes, or a whole number for new features)
|
||||
- [ ] I have submitted the pull request
|
||||
|
||||
# How Has This Been Tested?
|
||||
|
||||
|
||||
@@ -20,3 +20,7 @@ Pull request will be check by three main authors who are linked in
|
||||
[REAMDE.md](https://github.com/miguel5612/MQSensorsLib/README.md) and they determine to merge to
|
||||
master branch. Later than assessment and debbuging procedures was completed, the contribution
|
||||
will be released.
|
||||
|
||||
## Versioning
|
||||
|
||||
When making a pull request, please remember to update the `library.properties` file to reflect the changes you've made. If your change is minor, consider advancing the version by 0.01. If you're adding a new feature, you may want to advance the version by a whole number.
|
||||
@@ -142,10 +142,14 @@ float MQUnifiedsensor::validateEcuation(float ratioInput)
|
||||
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
|
||||
{
|
||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||
float voltageResolution = _VOLT_RESOLUTION;
|
||||
if(isMQ303A) {
|
||||
_VOLT_RESOLUTION = _VOLT_RESOLUTION - 0.45; //Calculations for RS using mq303a sensor look wrong #42
|
||||
// Issue #42: MQ303A requires a 0.45V offset for the RS calculation. The
|
||||
// previous implementation permanently decreased _VOLT_RESOLUTION every time
|
||||
// the sensor was read which produced incorrect results after multiple calls.
|
||||
voltageResolution -= 0.45;
|
||||
}
|
||||
_RS_Calc = ((_VOLT_RESOLUTION*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
||||
_RS_Calc = ((voltageResolution*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
||||
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
||||
if(!injected) _ratio = _RS_Calc / this->_R0; // Get ratio RS_gas/RS_air
|
||||
_ratio += correctionFactor;
|
||||
|
||||
Reference in New Issue
Block a user