We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 498eb5b commit 72223b6Copy full SHA for 72223b6
internal_filesystem/lib/mpos/battery_voltage.py
@@ -1,4 +1,3 @@
1
-from machine import ADC, Pin
2
import time
3
4
MIN_VOLTAGE = 3.15
@@ -11,8 +10,8 @@
11
10
def init_adc(pinnr, sf):
12
global adc, scale_factor
13
try:
14
- from machine import ADC, Pin
15
print(f"Initializing ADC pin {pinnr} with scale_factor {scale_factor}")
+ from machine import ADC, Pin # do this inside the try because it will fail on desktop
16
adc = ADC(Pin(pinnr))
17
# Set ADC to 11dB attenuation for 0–3.3V range (common for ESP32)
18
adc.atten(ADC.ATTN_11DB)
0 commit comments