Today, I updated the UIFlow to V2.3.4, and burned V2.3.4 firmware as well. Then I tested that image component again with M5GFX in UIFlow 2.3.4. But the issue still exists. After I switch two JPG pics with one image component for sometime, the memory will reduced continiously. Finally, the system will break out. And I try to use gc.collect() after every drawImage(), but it's not useful.
Here is my design and python code:
import os, sys, io, gc
import M5
from M5 import *
ImageSwitchFlag = None
def GcCollectAndPrint():
global ImageSwitchFlag
gc.collect()
print(gc.mem_free())
pass
def btnA_wasClicked_event(state):
global ImageSwitchFlag
if ImageSwitchFlag == 0:
M5.Lcd.drawImage("/flash/res/img/RotaryBGBacklight.jpg", 0, 0)
GcCollectAndPrint()
ImageSwitchFlag = 1
elif ImageSwitchFlag == 1:
M5.Lcd.drawImage("/flash/res/img/RotaryBGBT.jpg", 0, 0)
GcCollectAndPrint()
ImageSwitchFlag = 0
def setup():
global ImageSwitchFlag
M5.begin()
Widgets.fillScreen(0x000000)
BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)
ImageSwitchFlag = 0
def loop():
global ImageSwitchFlag
M5.update()
if name == 'main':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")******
b442ffec-d9ce-4445-898c-4b8ffc3caa82-image.png