Skip to content

Commit 45eeba9

Browse files
committed
Minor linting fixes to examples
1 parent 90fabf5 commit 45eeba9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

examples/compensated-temperature.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
import bme680
55
from subprocess import PIPE, Popen
66

7-
try:
8-
from smbus2 import SMBus
9-
except ImportError:
10-
from smbus import SMBus
117

128
print("""compensated-temperature.py - Use the CPU temperature to compensate temperature
139
readings from the BME680 sensor. Method adapted from Initial State's Enviro pHAT
@@ -31,12 +27,14 @@
3127
sensor.set_temperature_oversample(bme680.OS_8X)
3228
sensor.set_filter(bme680.FILTER_SIZE_3)
3329

30+
3431
# Gets the CPU temperature in degrees C
3532
def get_cpu_temperature():
3633
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
3734
output, _error = process.communicate()
3835
return float(output[output.index('=') + 1:output.rindex("'")])
3936

37+
4038
factor = 1.0 # Smaller numbers adjust temp down, vice versa
4139
smooth_size = 10 # Dampens jitter due to rapid CPU temp changes
4240

examples/temperature-offset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
sensor.set_temperature_oversample(bme680.OS_8X)
2323
sensor.set_filter(bme680.FILTER_SIZE_3)
2424

25+
2526
def display_data(offset=0):
2627
sensor.set_temp_offset(offset)
2728
sensor.get_sensor_data()
@@ -32,6 +33,7 @@ def display_data(offset=0):
3233
print(output)
3334
print('')
3435

36+
3537
print('Initial readings')
3638
display_data()
3739

0 commit comments

Comments
 (0)