Skip to content

Commit

Permalink
Removes issue comment and fixes lost (rebasing) config backwards comp…
Browse files Browse the repository at this point in the history
…atibility for feature toggle
  • Loading branch information
Pascal Kern committed Feb 5, 2023
1 parent 66a5c68 commit be9efad
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions enviro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,6 @@ def stop_activity_led():
# read the state of vbus to know if we were woken up by USB
vbus_present = Pin("WL_GPIO2", Pin.IN).value()

#BUG Temporarily disabling battery reading, as it seems to cause issues when connected to Thonny
"""
# read battery voltage - we have to toggle the wifi chip select
# pin to take the reading - this is probably not ideal but doesn't
# seem to cause issues. there is no obvious way to shut down the
# wifi for a while properly to do this (wlan.disonnect() and
# wlan.active(False) both seem to mess things up big style..)
old_state = Pin(WIFI_CS_PIN).value()
Pin(WIFI_CS_PIN, Pin.OUT, value=True)
sample_count = 10
battery_voltage = 0
for i in range(0, sample_count):
battery_voltage += (ADC(29).read_u16() * 3.3 / 65535) * 3
battery_voltage /= sample_count
battery_voltage = round(battery_voltage, 3)
Pin(WIFI_CS_PIN).value(old_state)
"""

# set up the button, external trigger, and rtc alarm pins
rtc_alarm_pin = Pin(RTC_ALARM_PIN, Pin.IN, Pin.PULL_DOWN)
# BUG This should only be set up for Enviro Camera
Expand Down Expand Up @@ -355,7 +337,7 @@ def get_sensor_readings():


readings = get_board().get_sensor_readings(seconds_since_last)
if config.enable_battery_voltage:
if hasattr(config, 'enable_battery_voltage') and config.enable_battery_voltage:
readings["voltage"] = get_battery_voltage()


Expand Down

0 comments on commit be9efad

Please sign in to comment.