Page 1 of 1

problem displaying on a Nextion screen

Posted: 06 Mar 2020, 13:47
by cyclone
Dear all;

I'm developing a small system control used to 'control' my garden shelter, this system is based on an ESP with Esp Easy R148 and a Nextion display screen (in fact the chinese version of the Nextion).

Two DS18B20 probes are connected to the ESP, and temperature is monitored without any problems,and send to domoticz again without any problem.

The problem occurs when I'm trying to send the Temperature value directly on the screen, inserting commands into the Line
nextion-line.JPG
nextion-line.JPG (18.23 KiB) Viewed 17896 times
, I tried different combinations like t1.txt="[DS18B20#Temperature]", without any success, the t0 text is displaying [DS18B20#Temperature] but not the right value...

After I tried to display some informations, using the command : nextion,t1.txt="%systime%" or nextion,t1.txt="%ip%" expecting to have on the display or the time or the ip address of the esp, as a result on the screen I've : %systime% or %ip% displayed....

has anyone ever had this problem? what are the right commands ?

I'm using right now the Release R148 for esp easy, do I've to switch to ESP mega ?

Many thanks for your help !

Re: problem displaying on a Nextion screen

Posted: 06 Mar 2020, 17:10
by Wiki
I am running two nextion with mega 20191208 development attached to wemos d1mini witbout problems, but I am sending the values out of rules like
Nextion,page0.t1.txt="[Sensor#value]"

Re: problem displaying on a Nextion screen

Posted: 06 Mar 2020, 17:44
by TD-er
Not sure if those system variables were present in the R148 build.

Re: problem displaying on a Nextion screen

Posted: 06 Mar 2020, 17:57
by ThomasB
Not sure if those system variables were present in the R148 build.
Good catch. R148 was released about the same time that the Titanic disaster occurred. Time to upgrade.

And besides upgrading to the latest Mega release, I HIGHLY recommend you use the plugin's new Hardware Serial feature. My opinion is that this is essential to achieving reliable touch screen entry. But if the ESPEasy application is only for displaying/updating text (no touch entry) then soft serial is OK. See the wiki for details to using hardware serial.

- Thomas

Re: problem displaying on a Nextion screen

Posted: 08 Mar 2020, 22:10
by cyclone
Dears ;

many thanks for your answer, I'm trying to installa this version 20191208, and it's OK right now, but the "display Nextion" is not in the device list... so

my stupid question is now how to install this ' device' into the ESP ?

Many thanks

Re: problem displaying on a Nextion screen

Posted: 08 Mar 2020, 22:31
by TD-er
Have you tried the "testing" builds?
See: https://espeasy.readthedocs.io/en/lates ... al-plugins

Re: problem displaying on a Nextion screen

Posted: 08 Mar 2020, 23:41
by cyclone
many thanks ! now I've to setup the ESP !

Re: problem displaying on a Nextion screen

Posted: 10 Mar 2020, 23:42
by cyclone
OK, now it's possible to send the temperature on the main screen, this part is OK, but a new problem occurs, it's impossible to receive the Idx - identification number - when a button is pressed on the display.

This was working with R148 but with the new version, using the same pins (D2 & D4), I cannot succeed to have this feedback.

Is with this new version mandatory to use specific pins ? or make a setup particular ?

Re: problem displaying on a Nextion screen

Posted: 11 Mar 2020, 00:40
by ThomasB
The Nextion plugin has changed. So please review the wiki.
https://www.letscontrolit.com/wiki/inde ... le=Nextion

You can use the serial log and see the touch data received from the Nextion. Check the values to confirm they are being received (and are correct).

BTW, you're using SoftSerial to communicate with the Nextion. In the Mega release the SoftSerial does not work well for decoding touch actions due to interrupt latency corrupting the serial byte decoding. This can be resolved by using the Hardware Serial feature that is available in the Nextion Plugin. See the wiki for the requirements.

- Thomas

Re: problem displaying on a Nextion screen

Posted: 18 Apr 2020, 15:13
by Wiki
Sending "°C" to Nextion display results in displaying "°C". Sending "{D}C" Same result.

Any ideas?

Re: problem displaying on a Nextion screen

Posted: 18 Apr 2020, 15:38
by TD-er
That sounds like missing that unicode entry in the font.
ESPEasy does replace both to the unicode value of the degree symbol.
For the LCD and OLED plugin we have a wrapper to replace those special characters to the ones supported by the font definition on those devices (or library in case of the OLED)

If the Nextion has a degree sign in its font and you can supply me with the proper code of that character, then I can make a wrapper for the Nextion plugin to patch that character.

Re: problem displaying on a Nextion screen

Posted: 18 Apr 2020, 19:05
by Wiki
Thanks for the fast reply.

Part of the Nextion editor is a font generator, with which I am able to generate fixed fonts. The codec of the fonts I am working with is iso-8859-1. So the code should be B0 I think.

List of the supported codecs:
NextionFonts.jpg
NextionFonts.jpg (36.35 KiB) Viewed 15086 times

Re: problem displaying on a Nextion screen

Posted: 18 Apr 2020, 19:22
by TD-er
Hmm I begin to think we may need a replacement feature to just enter hexadecimal values which will then be replaced by its binary byte value.

Re: problem displaying on a Nextion screen

Posted: 18 Apr 2020, 20:14
by ThomasB
Ordinarily you would use \xB0 in the Nextion text string. But the \ escape char breaks the rules parser.

- Thomas

Re: problem displaying on a Nextion screen

Posted: 19 Apr 2020, 02:08
by Wiki
Due to the fact that some of the sending devices are pimped SONOFFs with added BMP280 which are not updateable without a lot of pain for flashing them I took the risc to update the Nextion editor from 0.53 to 1.60.1. Why risc? Itead states clearly that if your project was developed with 0.53 or earlier you should stay with the old version due to being partly incompatible.

I tried to install the version in parallel, no success.

But: The font editor of the new version is able to generate in UTF-8. And that made the deal: sent "°C" is displayed as "°C". And all the rest seems to run perfectly.

Caution: The compiled .tft file explodes. Under 0.53 the project took roughly 3MB, under 1.6.0.1 around 12(!)MB. And the generated font looks different between the two versions (same font source), upper line 1.60.1, lower line 0.53:
Font 1.60.1 0.53.JPG
Font 1.60.1 0.53.JPG (11.29 KiB) Viewed 15065 times
If interested I colud summaize the observed differences in another thread, but it will take time....

Re: problem displaying on a Nextion screen

Posted: 19 Apr 2020, 02:24
by Wiki
Eehm, the code size explosion is relative. At first I generated the complete font set in UTF-8. The font generator allows to choose the characters to be included in the generated font. I have done this and the code size is almost back to the old one.

Re: problem displaying on a Nextion screen

Posted: 19 Apr 2020, 09:41
by TD-er
Yep, the Unicode character set is "a bit" larger than ASCII (or even extended ASCII).

The screenshot you showed looks like it is using anti-aliasing.
That may also increase the font size as it uses more than 1 bit per pixel then.

Is the render speed comparable? (hard to compare from memory if you don't have a 2nd display to compare it with)

Re: problem displaying on a Nextion screen

Posted: 19 Apr 2020, 12:49
by Wiki
Yep, this time I have set the option of anti aliasing just for cuiosity. But nevertheless the characters are different, to be seen better with the zroe (I have posted the wrong example, was too early in the morning): the new zero is slashed, the old one not. Up to now I didn't have had a look at the zero of the source font, I will do this later today.

I cannot notice any speed difference. The Nextion is too fast, it is a nice device. Changing text happens instantly, even ie in the phone call list where I am rolling over the complete list to place an incoming call in the top line.

[edit]
the old fonts have been complete sets of iso-8859-1 code sets, no plain ascii. Thats why I am so astonished about the explosion, I expected twice the size, not more than four times.
[/edit]