M5StickC Plus EEPROM Issue UIFLOW
-
Hi,
I'm using the EEPROM block from UIFLOW but i cant get it to work.
Is there a bug? Or am i doing something wrong?
This is the python:
from m5stack import *
from m5ui import *
from uiflow import *
import nvs
from easyIO import *
import timesetScreenColor(0x111111)
malas = None
timer = None
count = Nonec = M5TextBox(21, 64, "CURRENT", lcd.FONT_DejaVu18, 0xc7fadf, rotate=0)
counter = M5TextBox(21, 91, "0", lcd.FONT_DejaVu40, 0x30ff23, rotate=0)
label0 = M5TextBox(31, 167, "MALA'S", lcd.FONT_DejaVu18, 0x1fbef1, rotate=0)
malac = M5TextBox(29, 199, "0", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
BATTPERCENT = M5TextBox(3, 6, "BATTERY:", lcd.FONT_DefaultSmall, 0xFFFFFF, rotate=0)
BATTIND = M5TextBox(57, 6, "0", lcd.FONT_DefaultSmall, 0xFFFFFF, rotate=0)
timerx = M5TextBox(118, 6, "0", lcd.FONT_DefaultSmall, 0x676363, rotate=0)from numbers import Number
def buttonA_wasPressed():
global malas, timer, count
timer = 61
BATTIND.setText(str((str((map_value((axp.getBatVoltage()), 3.7, 4.1, 0, 100))) + str('%'))))
count = (count if isinstance(count, Number) else 0) + 1
counter.setText(str(count))
malac.setText(str(malas))
speaker.tone(500, 100)
if count == 108:
malas = (malas if isinstance(malas, Number) else 0) + 1
malac.setText(str(malas))
speaker.tone(500, 100)
wait_ms(200)
speaker.tone(500, 100)
speaker.setVolume(5)
speaker.sing(831, 2)
speaker.sing(622, 2)
speaker.setVolume(3)
count = 0
malac.setText(str(malas))
pass
btnA.wasPressed(buttonA_wasPressed)def buttonB_pressFor():
global malas, timer, count
count = 0
malas = 0
nvs.write(str('malas'), malas)
counter.setText(str(count))
malac.setText(str(malas))
pass
btnB.pressFor(0.8, buttonB_pressFor)axp.setLcdBrightness(50)
malas = nvs.read_str('malas')
speaker.setVolume(3)
BATTIND.setText(str((str((map_value((axp.getBatVoltage()), 3.7, 4.1, 0, 100))) + str('%'))))
counter.setText(str(count))
malac.setText(str(malas))
timer = 61
while True:
timerx.setText(str((str(timer) + str(''))))
malac.setText(str(malas))
timer = (timer if isinstance(timer, Number) else 0) + -1
if timer == 0:
nvs.write(str('malas'), malas)
wait_ms(3)
axp.powerOff()
wait(1)
wait_ms(2) -
@kunal
What is the real problem? Please explain in detail, we have tested it and it works on my side