You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
BatteryManageR: add has_battery()
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
||||
0.7.2
|
||||
0.8.0
|
||||
=====
|
||||
|
||||
Builtin Apps:
|
||||
- Launcher: fit at least 3 apps per row on a 240px display
|
||||
- OSUpdate: replace "force update" checkbox with improved button labels
|
||||
- OSUpdate: replace 'force update' checkbox with improved button labels
|
||||
|
||||
Frameworks:
|
||||
- SDCard: add support for SDIO/SD/MMC mode
|
||||
@@ -11,7 +11,7 @@ Frameworks:
|
||||
|
||||
OS:
|
||||
- Scale MicroPythonOS boot logo down if necessary
|
||||
- Additional board support: MaTouch ESP32-S3 SPI IPS 2.8" with Camera OV3660
|
||||
- Add board support: MaTouch ESP32-S3 SPI IPS 2.8' with Camera OV3660
|
||||
|
||||
0.7.1
|
||||
=====
|
||||
|
||||
@@ -67,6 +67,16 @@ class BatteryManager:
|
||||
initial_adc_value = BatteryManager.read_raw_adc()
|
||||
print(f"Reading ADC at init to fill cache: {initial_adc_value} => {BatteryManager.read_battery_voltage(raw_adc_value=initial_adc_value)}V => {BatteryManager.get_battery_percentage(raw_adc_value=initial_adc_value)}%")
|
||||
|
||||
@staticmethod
|
||||
def has_battery():
|
||||
"""
|
||||
Check if battery monitoring is initialized.
|
||||
|
||||
Returns:
|
||||
bool: True if init_adc() was called, False otherwise
|
||||
"""
|
||||
return _adc_pin is not None
|
||||
|
||||
@staticmethod
|
||||
def read_raw_adc(force_refresh=False):
|
||||
"""
|
||||
|
||||
@@ -82,7 +82,7 @@ try:
|
||||
i2c_bus = i2c.I2C.Bus(host=0, scl=38, sda=39)
|
||||
import mpos.indev.gt911 as gt911
|
||||
touch_dev = i2c.I2C.Device(bus=i2c_bus, dev_id=gt911.I2C_ADDR, reg_bits=gt911.BITS)
|
||||
indev = gt911.GT911(touch_dev, reset_pin=1, interrupt_pin=40, debug=True) # remove debug because it's slower
|
||||
indev = gt911.GT911(touch_dev, reset_pin=1, interrupt_pin=40, debug=False) # debug makes it slower
|
||||
from mpos import InputManager
|
||||
InputManager.register_indev(indev)
|
||||
except Exception as e:
|
||||
|
||||
@@ -92,7 +92,6 @@ class CameraActivity(Activity):
|
||||
snap_label.set_text(lv.SYMBOL.OK)
|
||||
snap_label.center()
|
||||
|
||||
|
||||
self.status_label_cont = lv.obj(self.main_screen)
|
||||
width = mpos_ui.DisplayMetrics.pct_of_width(70)
|
||||
height = mpos_ui.DisplayMetrics.pct_of_width(60)
|
||||
@@ -356,4 +355,3 @@ class CameraActivity(Activity):
|
||||
if buffer.startswith(bom):
|
||||
return buffer[3:]
|
||||
return buffer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user