Move python-specific imports into a guard.
This commit is contained in:
parent
0a34a8c89e
commit
19f68971f2
|
@ -1,14 +1,21 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import board
|
|
||||||
import busio
|
|
||||||
import json
|
import json
|
||||||
import adafruit_ms8607 as ms8607
|
import platform
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
DELAY = 0.1
|
DELAY = 0.1
|
||||||
|
|
||||||
|
|
||||||
|
def is_raspberry_pi() -> bool:
|
||||||
|
return platform.machine() in ("armv7l", "armv6l")
|
||||||
|
|
||||||
|
|
||||||
|
if is_raspberry_pi():
|
||||||
|
import board
|
||||||
|
import busio
|
||||||
|
import adafruit_ms8607 as ms8607
|
||||||
|
|
||||||
|
|
||||||
class Reading:
|
class Reading:
|
||||||
def __init__(self, t, p, h, normal=False):
|
def __init__(self, t, p, h, normal=False):
|
||||||
if not normal:
|
if not normal:
|
||||||
|
|
Loading…
Reference in New Issue