Skip to content

Commit 5e0ed5c

Browse files
Fri3d 2026: battery voltage (commented out)
1 parent 4e3081f commit 5e0ed5c

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

internal_filesystem/lib/mpos/board/fri3d_2024.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ def adc_to_voltage(adc_value):
332332
# Initialize 5 NeoPixel LEDs (GPIO 12)
333333
LightsManager.init(neopixel_pin=12, num_leds=5)
334334

335-
print("Fri3d hardware: Audio, LEDs, and sensors initialized")
336-
337335
# === STARTUP "WOW" EFFECT ===
338336
import time
339337
import _thread

internal_filesystem/lib/mpos/board/fri3d_2026.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ def install_expander_firmware(filename):
159159
except Exception as e:
160160
print("Could not check CH32 firmware version after install, many things, including LCD RESET, won't work!")
161161

162+
'''
163+
# Quick and dirty patch of BatteryManager to use the CH32 battery level:
164+
# mpos.io_expander.analog causes keypresses
165+
def get_voltage(force_refresh=False, raw_adc_value=None):
166+
return (0.001651 * mpos.io_expander.analog[2] + 0.08709) # copied from fri3d_2024.py
167+
from mpos import BatteryManager
168+
BatteryManager.read_raw_adc = lambda *args: mpos.io_expander.analog[2]
169+
BatteryManager.has_battery = lambda *args: True
170+
BatteryManager.read_battery_voltage = get_voltage
171+
'''
172+
162173
# quick and dirty way to make accessible later:
163174
mpos.io_expander = expander
164175

0 commit comments

Comments
 (0)