Skip to content

Commit cf73af1

Browse files
GrahldgGrahldg
authored andcommitted
Oversampling
Corrected error where oversampling rates were being stored to registers instead of the codes corresponding to those rates.
1 parent fdc9cd3 commit cf73af1

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/SparkFunBME280.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,28 @@ uint8_t BME280::checkSampleValue(uint8_t userValue)
321321
{
322322
switch(userValue)
323323
{
324-
case(0): break; //Valid
325-
case(1): break; //Valid
326-
case(2): break; //Valid
327-
case(4): break; //Valid
328-
case(8): break; //Valid
329-
case(16): break; //Valid
324+
case(0):
325+
return 0;
326+
break; //Valid
327+
case(1):
328+
return 1;
329+
break; //Valid
330+
case(2):
331+
return 2;
332+
break; //Valid
333+
case(4):
334+
return 3;
335+
break; //Valid
336+
case(8):
337+
return 4;
338+
break; //Valid
339+
case(16):
340+
return 5;
341+
break; //Valid
330342
default:
331-
userValue = 1; //Default to 1x
343+
return 1; //Default to 1x
332344
break; //Good
333345
}
334-
return(userValue);
335346
}
336347

337348
//Set the global setting for the I2C address we want to communicate with

0 commit comments

Comments
 (0)