Skip to content

Commit

Permalink
display calibration value in install mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Jul 3, 2024
1 parent 4f61a19 commit 6a31329
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion services/pixljs_alert/zero_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,16 @@ def get_rpi_status():
mic_out = subprocess.check_output(("arecord", "-L"), timeout=1)
for line in mic_out.decode("utf8").splitlines():
if "plughw" in line:
mic = line
calibration_file = "/home/pi/zeroindicators.json"
sensitivity = "NO CALIB"
try:
if os.path.exists(calibration_file):
with open(calibration_file, "r") as calib:
json_doc = json.load(calib)
sensitivity = "%.2f dBFS@94dB" % json_doc["sensitivity"]
except json.JSONDecodeError as e:
pass
mic = "OK (%s)" % sensitivity
break
except subprocess.CalledProcessError as e:
pass
Expand Down

0 comments on commit 6a31329

Please sign in to comment.