File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
internal_filesystem/lib/mpos Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1+ from machine import ADC , Pin
12import time
23
34MIN_VOLTAGE = 3.15
78scale_factor = 0
89
910# This gets called by (the device-specific) boot*.py
10- def init_adc (pinnr , scale_factor ):
11- global adc
11+ def init_adc (pinnr , sf ):
12+ global adc , scale_factor
1213 try :
1314 from machine import ADC , Pin
14- print ("Initializing ADC pin {pinnr} with scale_factor {scale_factor}" )
15+ print (f "Initializing ADC pin { pinnr } with scale_factor { scale_factor } " )
1516 adc = ADC (Pin (pinnr ))
1617 # Set ADC to 11dB attenuation for 0–3.3V range (common for ESP32)
1718 adc .atten (ADC .ATTN_11DB )
19+ scale_factor = sf
1820 except Exception as e :
1921 print ("Info: this platform has no ADC for measuring battery voltage" )
2022
You can’t perform that action at this time.
0 commit comments