Update showbattery app

This commit is contained in:
Thomas Farstrike
2026-01-25 23:52:05 +01:00
parent 92905dccf3
commit e1d3f1a279
2 changed files with 8 additions and 10 deletions
@@ -3,15 +3,15 @@
"publisher": "MicroPythonOS",
"short_description": "Minimal app",
"long_description": "Demonstrates the simplest app.",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.helloworld/icons/com.micropythonos.helloworld_0.0.3_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.helloworld/mpks/com.micropythonos.helloworld_0.0.3.mpk",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.helloworld/icons/com.micropythonos.helloworld_0.1.0_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.helloworld/mpks/com.micropythonos.helloworld_0.1.0.mpk",
"fullname": "com.micropythonos.showbattery",
"version": "0.0.3",
"version": "0.1.0",
"category": "development",
"activities": [
{
"entrypoint": "assets/hello.py",
"classname": "Hello",
"entrypoint": "assets/show_battery.py",
"classname": "ShowBattery",
"intent_filters": [
{
"action": "main",
@@ -40,9 +40,9 @@ battery power:
import lvgl as lv
import time
from mpos import BatteryManager, Activity
from mpos import Activity, BatteryManager
class Hello(Activity):
class ShowBattery(Activity):
refresh_timer = None
@@ -60,14 +60,12 @@ class Hello(Activity):
super().onResume(screen)
def update_bat(timer):
#global l
r = BatteryManager.read_raw_adc()
v = BatteryManager.read_battery_voltage()
percent = BatteryManager.get_battery_percentage()
text = f"{time.localtime()}\n{r}\n{v}V\n{percent}%"
#text = f"{time.localtime()}: {r}"
print(text)
self.update_ui_threadsafe_if_foreground(self.raw_label.set_text, text)
self.raw_label.set_text(text)
self.refresh_timer = lv.timer_create(update_bat,1000,None) #.set_repeat_count(10)