So cool ! and for M5Core2 please ;) i don't want to pass to another board just for a missing LCD driver :(
batPercentage = ( batVoltage < 3.2 ) ? 0 : ( batVoltage - 3.2 ) * 100;
micropython welcome :
batPercentage=0 if batVoltage<0 else round((batVoltage-3.2)*100) lcd.print(str(batPercentage)+"%",0,0)
i use the nice lvgl Lib to do That.
from m5stack import * from m5stack_ui import * from uiflow import * import lvgl as lv screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0x00000) lv.init() # create screen scr = lv.obj() # set Background screen scr.set_style_local_bg_color(scr.PART.MAIN, lv.STATE.DEFAULT, lv.color_hex(0x000000)) # create button btn = lv.btn(scr) btn.set_size(80, 80) # change style btn.set_style_local_bg_color(scr.PART.MAIN,lv.STATE.DEFAULT, lv.color_hex(0x0000ff)) styleButton = lv.style_t() # create style styleButton.set_bg_color(lv.STATE.DEFAULT, lv.color_hex(0x0000ff)) styleButton.set_radius(lv.STATE.DEFAULT, 0); styleButton.set_border_color(lv.STATE.DEFAULT, lv.color_hex(0x0000ff)) btn.add_style(btn.PART.MAIN,styleButton) #define this style # callback action def action(btn, event): global src if(event == lv.EVENT.CLICKED): btn.set_style_local_bg_color(btn.PART.MAIN, lv.STATE.DEFAULT, lv.color_hex(0xffffff)) btn.set_style_local_border_color(btn.PART.MAIN, lv.STATE.DEFAULT, lv.color_hex(0xffffff)) # define callback btn.set_event_cb(action) # load the screen lv.scr_load(scr)
after many tests, I finally understood the curiosity of the RTC of my core2 :
machine.RTC().datetime have not the same params that utime.localtime()
machine.RTC().datetime((2021, 3, 21, 0, 16, 37, 0, 0)) # Y,m,d,0,H,s,i,0 utime.sleep_ms(100) # breathe a little lcd.print(str(machine.RTC().datetime())+"\n") # print Y,m,d,w,H,s,i,timestamp lcd.print(str(utime.localtime())) # print Y,m,d,H,s,i,w,z
It's not the same thing that official micropython documentation,
to set RTC, use particular tuple (year , month, day, week=0, hour, minute, second, timestamp=0)
A kinda related, but strange question - could you please release the source code for the drivers of the various bits of hardware found in the UIFlow firmware? UIFlow is built upon MicroPython, and I would personally prefer to run a clean MicroPython build on a few devices of mine, however the lack of drivers makes it a bit harder than expected. I'm not interested in the UIFlow-related parts, just the low level Core/Unit/Module support drivers (e.g. for M5Paper, a driver for IT8951, a driver for the PMIC, SHT30, GT911). It would allow the community to build MicroPython images without proprietary code, and possibly result in faster updates as well. Plus, you could merge back community fixes into the official UIFlow firmware easily.
Same thing for me.
But I like uiFlow tool to test the code.
For example, Update the UIFlow-code project on git with core2 libs would be cool