Start a new topic
Solved

Nextion v0.40 timer component and waveform

Hi at all, It seems there is a bug in the new v0.40. I have placed on a page a statusline with a clock and a waveform to show some graph. Additional on this page is a timer component with 1000ms to show the clock in the status line. When I now send data via rs232 to the waveform component the timer stops immediately. When I cancel sending data to the waveform component the timer runs again normally. I have test the same hmi with v0.38 and there this problem is not shown. Cheers

Hi Electronix


Without having seen your project:

The addt command is going to hijack the processing until all byte values are received.

This behaviour should be deemed normal, and there is no method to inject a doevents command


If using a while or for statement,

inserting the doevents into the loop will allow for the timer and other events to be processed

If you are not using doevents,

the default and expected behaviour is to complete the issued tasks before proceeding further.


Part of this may be in the way you have chosen to implement your design.

Perhaps implement your design so that it does not take more that one second to complete each update to the waveform and thus allow the timing needed to update the status bar and timer.


Next steps will be

1)  attempt to implement the timings needed in your project.

2)  If this fails, recreate this in a simple single page project, and upload the HMI and compiled TFT.

3) I will take a look at your HMI and see what I can recommend

4) If there is no solution to be found, I will have it forwarded to the dev team.


Also, if v0.38 is not creating the issue and allows for your project to continue, I would recommend continuing to use v0.38 while the matter for 0.40 is being looked into.


Patrick

Hi Patrick, thanks for your answer. I will upload the hmi file today. I didn't use the addt command. I use the normal add command for adding Data to the waveform. I also test test if it makes a difference when I use a additional timer which increment a number in a number field and I also try to set timer to global. All is the same. When you send data to the waveform all timers on this page are stopped. I will use v0.38 but the problem is, I can't find this version any longer in the internet and I didn't have a copy :(. I someone can upload this v0.38 it will be very helpful. Thanks Sven

Unzip and run from a clean folder.

You can open the Build Folder (opens to bianyi)

Go up one level, should reveal a backup folder

If a v0.38 compatible version exists, it will be in this backup folder.


You will receive this reply be email before the zip file has propagated.

You may need to wait a bit before downloading to allow for this propagating.


Please continue on the path towards finding a solution and upload your HMI.

zip
Hi Patrick,

sorry for delay.
In Attachment you will find the HMI.
If you start sending Data to Waveform over the Serial Interface the Clock Stops Running, cause the timer seems to stop working.

Cheers

Sven

 

HMI
(1.69 MB)

Hi Electronix


That would be correct and the expected behaviour. 

While the Nextion has not completed tasks with the waveform, it wouldn't be updating other code

I haven't been able to get the timer to stop working, it resumes again when work is completed


How many samples as you attempting at what rate?

This type of information is not included in your HMI file


Hi Patrick,
i send max 3 Waveforms in time distance of 150 ms.
With the old SW 0.38 it is working as expected.
With v.040 i only can get the clock running again, if i stop send data
to waveform. Even add one data to waveform stops the clock.

 

I want you to try this:  issue a ref_stop before sending the 3 data points and a ref_star after sending the 3 data points.


This will not refresh your waveform while receiving the points, but after all three are received. So for each round

ref_stop

add 1,0,54

add 1,1,23

add 1,2,64

ref_stop


The issue here could be the size of the waveform (length), and the fact that scrolling takes a lot of time.

I have been playing with an oversized 800x480 and 320x480 6 channel gui created waveform replication


aVXlcalcdJ--navXLZyjQrBdMVMt18iIKQ.png


What I have been discovering is the additional length adds more scrolling time.

So much so that on 6 channels and 480 length, the time to refresh one set is near 1400ms.


I imagine what happens with a 150ms timer if it takes longer than 150ms to refresh is that you end up building a queued list of refreshes that have been requested but not performed.  Therefore, before the waveform is able to leave and do all these other events on your HMI design (such as update the time), it sees that it has another update and continues.  It should eventually end in a stack overflow.


So in my 6 channel example, setting it at a 50ms when it takes 1400ms, should be expected to cause problems much quicker.  But knowing it is 1400ms, if I then set it to 1500ms, I have almost 100ms for other maintenance.  It is better to only have 40 samples per minute and it keeps on working, then one that is problematic.  Or even at 2000ms and only 30 samples per minute with more confidence that I have created a wide enough margin to avoid errors.


Circle back up to the top, Your waveform component can take advantage of the ref_stop and ref_star that mine can not.  I would try it and see how it improves.  Your waveform is 737 pixels in length.  What you need to do is send at your 150ms and disregard the timer for now.  Time by hand just how long it takes from GO to when your data reaches the right side edge ... then divide by 737.  This will give you the time each data set is taking.  When you know this, you can adjust so that you have room for other code to happen between data points.


Hi Patrick, i try your suggestion in regards with ref stop and ref start. Now the timer runs randomly. Means every 3,4,5,6,7 seconds it will update the clock. Sometimes it jumps in the clock with 3 seconds sometimes 4 or 5 etc. It is very randomly. With v0.38 no problem. I use same update rate and clock runs smoothly. I think there is a bug. Something is changed in v0.40 which occurs that problem. Fro my side of view you can't use a timer component for refresh values with care displayed on same page. In my project it is the text label which shows the clock. But you will get also maybe in trouble if itead implement adding values from a variable and add them via a timer to the waveform. Cheers Sven

send me your timer code

Did you remember to use the command doevents in your loop?

Hi Patrick, what do you mean by timer code ? Timer is running at 1000ms. Cheers Sven

Hmmm, I was thinking about the timer event code

but within any loops .. you should be including doevents .. this will allow the timer to trigger, as well as update the screen with various other things being refreshed


If you aren't using doevents in your HMI code, then the default is to hijack processing till your loop is finished.

Hi Patrick, also when I send first ref_stop then doevents and than my three add datas for waveform and then send ref_star behavior is not changed. Timer jumps in randomly intervals. I have also no further idea. Maybe the itead developers can have a look what's going wrong ? Cheers Sven

Have you made changes to your HMI since, or is it still the same as you have posted.



Hi Patrick, It is still the same hmi. No changes where made. Cheers Sven
Login or Signup to post a comment