Unofficial Nextion/TJC User Forum

Flash memory stores code?

Nextion, great displays with a terrible ide.
The only problem seems to be the antialias fonts or jpg.
No, i thing the major problems are these:
Weird C/basic language in which line code termination character is carriage return (insted of “;”).
Not so terrible.
Debug ridiculous. After all is only a tft.
Not so terrible.
The code is writeble only in singular separated windows of event handling,
this is terrible when you need, for example,
a search and replace all over the whole code, or if you need to have a global view of code.
No possibility to create a custom function.
Terrible.
No possibility to create variables in code, yes you can use the “visual” variables but theyare very limitated as number.
Terrible.
No possibility to create ARRAYS, the only alternative is to use the b[componentId] arrays, very confusing, 'cause you are chained to the component id.

But something sounds me weird.
Flash memory is intended only for fonts and pictures?
I do not think at all.
When i use, to provide for lack of arrays, a huge amount of “if blocks”, no memory overflow occurs.
Also, i figure out that the if blocks are compiled as an array where index is the condition.
I tried and see that a code of THOUSANDS of if blocks are parsed incredibly fast.

Yes, i think code is stored in flash memory, while the “visual” variables in the sram (very tiny).

The problem to write a so enormous block of code is solved writing code by an external program (it is sufficient excel vba!) capable to generate thousands of if blocks, to copy in the event handler window.

What’s your expeerience with coding this way, that is, to use the large 16 MB of flash instead of the minuscule sRam?

i think i found something interesstingUnbenannt

The flash memory stores the whole firmware, that is the tft file which comprises code, picture and font resources. The components and variables declared in the code will use their part of the RAM each, at runtime.

I have difficulties in understanding that huge rant from @postagb. A HMI is just not only a TFT, it’s a “smart” TFT which you need not longer to address pixel by pixel as you would with a normal TFT (eating up most of your Arduino resources), but it gives you pre-built components which you can display and to which you can add code in their specific event handlers. This simplifies the code on Arduino side and it reduces amount of data to transfer between Arduino and Nextion. That is perhaps not perfect but for many use cases, a great simplification, especially at that low price (compared to Siemens or 4D systems). One gets what one pays for. Other HMIs are much more expensive and offer more functionality, but they are also more difficult to develop for.

In ever case, a HMI (be it Nextion, TJC, Siemens, 4D systems) is almost never a replacement for a micro controller. And it’s the latter who should handle an optimized logic, so that the HMI does what it is intended to do: Collecting user input and displaying information to the user.

It’s like Lego bricks: there are bricks with 2, 4, 6 or 8 buttons (for example). It’s up to the child to be creative and to build his castle with the available bricks. Nobody would blame Lego for not producing bricks with 3.75 or 8.2 buttons…

@Fjodor,
imagine a midi device, that, while yuo’re playing a synth or a midi piano,suggests you the right chord, not only, correct it using a AND and XOR mask, so yo learn but in the while your chord is right, imagine that you can also use it playing in a pub, you got no need to stay bent over the keyboard while executing some Freddie Mercury’s song, requiring you stay with your neck well elongated 'cause you need a stretched throat to reach highest pitches, not paying attention to your piano performance for that while that need so much effort on your voice, imagine that for some reason in those performances you don’t want a book of lyrics but rather prefer a display showing the right words, and the right chords at the right time and the right image in picture of the chord(the keys that you have to play), and the right time, and the right beat seek of the song, and the image of that portion of partiture, and the songs are 100, and the project already exists, but make some problems to your arduino and the reading time of a connected sd card containing all that and you find a tft that contains all without need for a so problematic sd card. And it’s fast,

That’s why you need a lot of variables, strings and numeric. And you need an arduino nano instead of a mega.
Tha’t’s why Nextion displays are not only smart tft, but much much more, with some kind of creativity.

Thanks a lot, @bl00dh0und4

@postagb , Right, what you describe is a very complex and dynamic use case. But I would say that this is a use case not for a Nextion HMI (nor TJC, nor Siemens, nur 4D systems), but that’s something which can much easier and better be realized as an app for a tablet like an iPad.
Engineering is first about listing the required specifications, then choosing the appropriate hardware before you waist time inserting screws with a hammer instead of a screwdriver…

@Fjodor: i appreciate yor words.
I make all that for work.
And it’s indispensable to have a meaning difference between cost and benefit.
This kind of device permits musicians to perfom musical shows at low prices, that actually is the rule in Itally at this moment,
beacuse of the presence of karaoke, much more expensive thant a musician, by the side of a pub owner.

So now they pay musicians 30Euros per night,
and the musician must be one, unfortunately.
This device is a big help, but must be cheap.
If id make it following the main directive i’d need an Industrial arduino that costs 170 euros.
Too much.
I sell it for 100. And the quality apperars excellent(made a trial between musicians).
So, why ask for more?
My intention is directly to connect nextion, tha after all have significant volatile memory and mgu,
by serial to the midi cable connected to a digital piano. Without Arduino or Raspberry.
That means the device should cost 80 Eur.
Midi protocol is old, but incredibly powerful not only for some musical device, but for controlling complex authomatisms. Initially i made it for an eepc, but musicians disapproved, too things to do,
and the risk that the public think “he plays nothing, it’s the pc that play”.
Same thing with a tablet.
They were very satisfied by a bversion on a smart phone, but it proposes different problems.

Interesting point of view… Most musicians which I know would definitively not play for only 30 Euros per night, even not in Russia. After many costly years of conservatory and music university, it is impossible to perform at such bad rates and people definitively should better stay at home than go out and perform for 30 Euros. If nobody played at such low rates, the concert organizers would be forced to pay better. So, every musician who plays for 30 Euros makes harmful action for others.

And you know that there is free software by Apple, called “Garageband” which does exactly what your project intends to do, generate (and fix) chords and not only output midi, but directly audio, so no digital piano needed, only iPad

Oh, i know Garage Band, nothing to see with my device.
First of all, it’s a software, not a device, that menas a lot.
After, it’s a simple sequencer, can use arpeggiators, but i’ts not live correcting, absolutely.
There is a plugin for cubase (and all vst based softwares) that correct while playing, but you need to make a phantom track charging that plugin, make the filters, and until this it’s all right, but it exists, it costs something, it need a pc, it’s not “invisible” , it does not show the correct chord, the partiture, yes the lyrics you can obtain them live, And it costs a lot, cubase + plugin.
And last but not least, ii’s not something that i can’t sell. Right?

Of course, all the musicians that tried my device use home cubase, nuendo, acid, guitar pro, fruity loops etc, at home, i repeat.
Mee too, but i don’t take charge of my pc for a nite at for 30 eur, i have not all the lincences,
and when i play on a track of these sequencers i have a delay of midi messages reponse very frustrating, with mine the latency is 0. Guaranted.

Boy this keyboard metaphor really took on a life of its own…

Anyway, Nextion is what it is. Reasonably low cost, reasonably decent functionality, reasonably easy-to-use editor. Tradeoffs have been made, but that’s part of engineering any solution. If the tradeoffs are clearly communicated, and understood by the engineer selecting the product, then it’s on the engineer to select the right HMI solution for their use case. It might be Nextion for some users, it might be something else for others.

I fully agree here. Engineering is describing the specifications and needs first, designing an abstract solution, and then only choosing and buying the best hard and software to realize this specific project.

It’s for sure not “Oh, I have a beautiful Nextion or TJC here, what could I do with it? I could try to make a solar powered HD video player from it… ouch, I don’t get it working… I will blame Nextion/TJC for that!” :joy::joy::joy:

Is Nextion midi projects intented?
No no no, it’s not the right question.
Midi signals are command/data bytes intended for a serial communication, with Nextion we got a serial port, an input output elaboration possibility, and a big steak of memory,
So the right question is
Does it works?
My answer is “YES”. It’s enough.
My first post was: “is there a possibility to bypass the editor simplyfing my coding directly on nextion and letting to arduino only some finale elaboration?”
“no, you can’t bypass/have an alternative to nextion editor”.
It’s ooook, i make it all the same. More work? It does’nt matter.
Almost all 'cause that work i’ve already made:)