Skip to content

Commit

Permalink
Fix errors when adc fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Apr 29, 2024
1 parent 28c6e62 commit d6ccd42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/be.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,8 +1484,9 @@ def var(inpt: str): # variables setter / editor
pin_name = inpt[2][4:]
if be.devices["gpiochip"][0].is_free(pin_name):
tmp_gpio = be.devices["gpiochip"][0].adc(pin_name)
new_var += str(tmp_gpio.value)
tmp_gpio.deinit()
if tmp_gpio is not None: # ADC2 may fail on ESP32
new_var += str(tmp_gpio.value)
tmp_gpio.deinit()
else:
new_var += str(inpt[2])
if valid: # now do the actual set
Expand Down

0 comments on commit d6ccd42

Please sign in to comment.