Start a new topic

Draw, delete and re-draw a line in Nextion HMI

Hi,


I'm trying to create an HMI page as the Fotoperiod configurator for my Arduino Acuario Controlled project.


The page looks like this:

image


Inside the graph part, there are 24 sliders to program the Light Power for each hour.


I want to draw over it, a line joining all the sliders positions, in that way I can see graphically how will behave the light power during the day.


I already know how to draw the line between each slider actual position:


For example, in the case of Touch Release of slider corresponding to 02 hour, to draw the line you can use the code:


sys0=230-Hora01.val

sys1=230-Hora02.val

sys2=230-Hora03.val

line 117,sys0,127,sys1,31

line 127,sys1,137,sys2,31


image



But I want to delete the previous lines, in order to keep the graph updated.

I tried picq with no success.


Any Ideas?


picq is the right command to use.

 

So am I to understand

 - this you want to draw for a visual representation of 

   how the power will behave (according to your setting)


Such that

     0100h power of 70%, 0110h power of 60%, 0120h power of 50%

     0150h power of 20%, 0200h power of 10%, 0210h power of 20%

If at 02:52:18 is not intended and automatically changed to 62.3% power

   then line is not really visually representing your power at all.


You may want a visual representation that will fit your actual

- when you know your actual,

    then it will be more defined steps to accomplish visual of actual.


picq works as per the Nextion Instruction Set.



   


1 person likes this

Thanks for your help Patrick.

This HMI page will work with an Arduino program. In this stage of the project I'm just programming the HMI.


Arduino will be in charge of set the right PWM output to dimm the led for the right power, just making the proportion calculation.


A straight line between the Power setting for 01h and the power setting for 02h will be a good realistic representation of what the arduino will set for led dimm.


The problem with picq is that it deletes the slidder buttom too (see pic attached)

image


This is the code I used for Touch Release of slider Hora02

sys0=230-Hora01.val

sys1=230-Hora02.val

sys2=230-Hora03.val

picq 110,40,30,150,8

line 117,sys0,127,sys1,31

line 127,sys1,137,sys2,31


I'd add three additional lines to draw three sliders.


1 person likes this

I was thinking on that workaround Maze. Thanks!

But, to make it work, I have to move the picq instruction to Touch Press Event.


I'll try that when arriving home in a few hours.


Thanks for the help.

I wouldn't call it a work around


Is it not the steps required to achieve the task?

 - then is that not just programming?

Your opinion is respectable Patrick.


Thanks for the help.

Login or Signup to post a comment