Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit72223b6

Browse files
Fix battery_voltage on desktop builds
1 parent498eb5b commit72223b6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎internal_filesystem/lib/mpos/battery_voltage.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
frommachineimportADC,Pin
21
importtime
32

43
MIN_VOLTAGE=3.15
@@ -11,8 +10,8 @@
1110
definit_adc(pinnr,sf):
1211
globaladc,scale_factor
1312
try:
14-
frommachineimportADC,Pin
1513
print(f"Initializing ADC pin{pinnr} with scale_factor{scale_factor}")
14+
frommachineimportADC,Pin# do this inside the try because it will fail on desktop
1615
adc=ADC(Pin(pinnr))
1716
# Set ADC to 11dB attenuation for 0–3.3V range (common for ESP32)
1817
adc.atten(ADC.ATTN_11DB)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp