sstaub / NextionX2

Library for Nextion displays
MIT License
14 stars 5 forks source link

Write Gauge value to display not deleting prior value #10

Open VR-Architect opened 9 months ago

VR-Architect commented 9 months ago

Hello, Excellent library. I am enjoying it.

I have a gauge on the display with a value 90 as it's default value. I send an Arduino command to set it to 180 and the dial moves to 180. However, it is still showing the old 90 value dial hand. So basically I have two dial hands; one at 90 and the other at 180. Is there some clear command I should put in prior to changing the value?

I tried both these ways:

NextionComponent gauge0(nextion, 0, 2);

void loop(){
   //gauge0.value(180);
    gauge0.attribute("val", 180);
} 

thanks for the help.

InnuendoPi commented 9 months ago

Did you update your comport instance?

NextionComPort nextion; ... void loop(){ gauge0.attribute("val", 180); nextion.update(); }

VR-Architect commented 9 months ago

I tried the update but didn't work either. When debuging inside Nextion Editor the issue is the same. I found out that if the gauge is set for crop image and located ontop of a picture as a full background this happens. If I switch the gauge to "solid color" the gauge works correctly. So it is a refresh thing.

I found a refresh command "ref 0" where 0 is the id of the control to refresh. Page0 is ID 0. So by changing my guage values followed by sending a page refresh fixed the issue in the Nextion Editor.

How do I send a page refresh via this library?

Thanks again

sstaub commented 9 months ago

I think you must send the command "page x". See https://wiki.iteadstudio.com/Nextion_Instruction_Set

VR-Architect commented 9 months ago

Thanks, but how do I send a generic command via the library?

sstaub commented 9 months ago

Have a look to the documentation. e.g. nextion.command("cir 50,50,20,WHITE");