I have 7´´ enhanced display.
And I need to save user data to eeprom
default value tm0.tim=20000
save new user value to eeprom - wepo 1000,10
but read doesnt work :( any solution ? or help
i tried to put here
tm0 - event - repo x.val,10 dim=20
postinitialize event - repo x.val,10 tm0.tim=x.val
but page still dimm after 20s :( not new user save 10s
You may need to re-describe your goal and hurdle
Nextion Instruction Set :: wepo
add: storage address in EEPROM
wepo 1000,10 stores value 1000 at address starting 10
bytes 10,11,12,13 is used for storing numeric value of 1000
add: storage address in EEPROM
repo x.val,10 reads numeric (.val) 4 bytes from address 10 into x.val
bytes 10,11,12,13 are read and placed into x.val
So here are a few questions:
are you trying to save user data when timer is up
or are you trying to get value for timer interval
You only posted 1 dim command .... dim=20
if there is no other dim command to make brighter
then dim should maybe still be 20 until new dim assigned
Timer was set to 20s ...tm0.tim=20000
- where is 10s assignment
- repo x.val,10 pulls 1000 from address 10
- tm0.tim=x.val puts value 1000 in tm0.tim ... is 1s
Take a breath, work out when what is saved
- when value at address needs to be reused.
Also if brightness is value stored, why not dims command?
thank you for fast answer.
1. Iam trying to get value for timer interval
2. I have in touchrelease event reset timer tim0.tim=20000 dim=100 but I need user value how tim after to dim screen if no touch
3.I put manual wepo t0.txt,10 where t0.txt is 10000 i checked what is saved in eeprom repo t2.txt,10
4. I used dims for alltime but I need brightness down if no touch after x.val
So in trying to get value for timer interval
- there is a setup for such where value is stored
- wepo x.val,10 is only needed during the setup set event.
In PostInitialize Event after page default values (as set in static HMI loads)
- repo x.val,10 // to retrieve this from eeprom, effective for current page.
- tm0.tim=x.val // set timer to value retrieved into x.val
- alternatively, if dim to occur after every 10s/20s regardless read directly into
Your logic is reverse, on no touch, then dim
- this means running a timer (call it tm0) that at the end dims low.
in timer event when time has expired dim=20
- however, this means that every spot where touch can occur
those touch events need to reset the timer.
- On press ...
tm0.en=0 // stop the timer from dimming
dim=100 // bring the brightness back up
- On release ..
tm0.en=1 // restart the timer
Alternatively, to coding all touch spots with the above
this is very very close to sleep
thup=1 // allows touch to wake Nextion device
repo thsp,10 // read value from add 10 eeprom into thsp
// where thsp is time in seconds NOT milliseconds until sleep.
// wepo value store at 10 needs to be number of seconds
I tried again again again but same result :( please check my HMI test files
You have stored t3.txt at address 10
- value of t3 is .txt 5000
- txt-maxl of t3 is 10
- therefore 11 bytes (txt-maxl) of eeprom will be used
- bytes 10,11,12,13,14,15,16,17,18,19 and 20
- next eeprom usable address 21
- bytes stored as bytes (let's convert ascii to hex to view)
0x35 0x30 0x30 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00
repo then reads x.val of 4 bytes from address 10
0x35 0x30 0x30 0x30
This is in little endian order smallest byte first
- the math on this is byte0*1+byte1*256+byte2*65536+byte3*16777216
in decimal 53*1+48*256+48*65536+48*16777216 or 808464437
- we could verify this by printing x.val out to debug from the MCU
but this becomes undefined when timer is 2 byte limited
could be 12341, could have failed totally
again, we could print out tm0.tim to debug from the MCU
So, you see where what such code has done
In your write e you can convert .txt before hand then store .val
- add line above the wepo command
- then change the wepo command to store x.val at address 10
- change repo in read eeprom to a number, and cov this into t1
Now when you read a number in from address 10, it is the as same stored
- 0x88 0x13 0x00 0x00 or 5000 in decimal
Many roads lead to Rome, you could also have used Number Components
delete t3 and replace with n0 - set n0 to 5000
delete t1 and replace with n1
then in t2 write e
then in t0 read eeprom
Awesome thank you for exhaustive and detailed answer finally I understood really thank you