Skip to content

Commit 8b27290

Browse files
committed
Fix compiling issues introduced by last patch
1 parent 328c51c commit 8b27290

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=MQ131 gas sensor
2-
version=1.5.0
2+
version=1.5.1
33
author=Olivier Staquet
44
maintainer=Olivier Staquet
55
sentence=Library for measuring ozone (O3) concentration with sensor MQ131

src/MQ131.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ MQ131Class::~MQ131Class() {
6868
case HIGH_CONCENTRATION :
6969
setR0(MQ131_DEFAULT_HI_CONCENTRATION_R0);
7070
setTimeToRead(MQ131_DEFAULT_HI_CONCENTRATION_TIME2READ);
71+
break;
72+
case SN_O2_LOW_CONCENTRATION:
73+
// Not tested by @ostaquet (I don't have this type of sensor)
74+
setR0(MQ131_DEFAULT_LO_CONCENTRATION_R0);
75+
setTimeToRead(MQ131_DEFAULT_LO_CONCENTRATION_TIME2READ);
7176
break;
72-
73-
case SN_O2_LOW_CONCENTRATION:
74-
ratio = 12.15* lastValueRs / valueR0 * getEnvCorrectRatio();
75-
return convert(26.941*pow(ratio,-1.16),PPB,unit); // r^2 = 0.9956
76-
break;
77-
7877
}
7978

8079
// Setup pin mode
@@ -216,6 +215,7 @@ MQ131Class::~MQ131Class() {
216215
// R^2 = 0.9986 but nearly impossible to have 0ppb
217216
// Use this if you are constantly monitoring high concentration of O3
218217
// return convert((10.66435681 * pow(ratio, 2.25889394) - 10.66435681), PPB, unit);
218+
219219
case HIGH_CONCENTRATION :
220220
// Use the equation to compute the O3 concentration in ppm
221221

@@ -228,6 +228,14 @@ MQ131Class::~MQ131Class() {
228228
// R^2 = 0.9985 but nearly impossible to have 0ppm
229229
// Use this if you are constantly monitoring high concentration of O3
230230
// return convert((8.37768358 * pow(ratio, 2.30375446) - 8.37768358), PPM, unit);
231+
232+
case SN_O2_LOW_CONCENTRATION:
233+
// NOT TESTED BY @ostaquet (I don't have this type of sensor)
234+
ratio = 12.15* lastValueRs / valueR0 * getEnvCorrectRatio();
235+
// r^2 = 0.9956
236+
return convert(26.941 * pow(ratio,-1.16),PPB,unit);
237+
break;
238+
231239
default :
232240
return 0.0;
233241
}

0 commit comments

Comments
 (0)