Start a new topic
Implemented

Data support for custom commands

Id like to be able to output unique strings from push buttons on my screen


like raw commands (without the FF ect in the headers)

I have a tow/plow light bar that uses serial to control its internal serial modules


example output from original control head over rs485:control wires:

The controllers send to the bar: 

64 02 01 01 01 10 2F F6 00 00 00 9E
The I/O board in the bar sees that and says: oh, I need to turn on all strobes with the cometflash pattern, sync'd.


I'd like to use the nextion to create a new touch screen for the needed commands to send using an image of the older mpc01 control head




the needed hardware support to program or send commands are

- 2-Wire RS-485 operation

-9600 baud.

-echo on.

-send data control.





Planning to sniff out the individual commands for each mode to use on the screen depending on what buttons pressed 

Already implemented using print and printh commands

Nextion Instruction Set - print and printh

ahh so the commands need to be in a txt file for each button or in the command output  box?

you don't need a txt file.


create a button and do an action to it in nextion editor.

Touch release:

print "123" //returns the ASCII of string "123":0x31 0x32 0x33

That will send 123


Thats exact what you want:

2. When use print command to obtain data, the device sends only the data content, no start identifier, nor end mark.



Probably what you need is to put your command in the button's Press Release Event.

So if your command is 64 02 01 01 01 10 2F F6 00 00 00 9E for cometflash strobes and you have a button in your HMI as b1 that is what the user pressed to send the command, then in the Press Release Event of the button b1 you would put:


printh 64 02 01 01 01 10 2F F6 00 00 00 9E


That will cause only 12 bytes being sent over the Rx/Tx wire - the 12 bytes of your command.  There may be some limit as to the number of bytes that can be sent in one command, though I am not currently aware of what that limit might be.

Ahh ok perfect ,so i could send what i need that way that makes sense now


I was working before on something else on an older version of the editor and couldn't get that to work , never tried again

NOTE: The output is done from the actual Nextion, and not from in the Editor Debug session.


As Alex pointed out print with text in quotes will send hex value of each char inside the quotes

but if your output requires char values below 32 (as per your example) and upper ASCII values that might be difficult to enter, I would definitely use the printh command - especially if you already know the hex values in advance.


I guess I will have to capture all commands and see what modes will work within the 32 value output

and just try a sample hmi to see what happens

32 value?  I am not certain what you are referring to.
Assuming your command is what you posted


printh 64 02 01 01 01 10 2F F6 00 00 00 9E


would accomplish sending those 12 bytes.


I was merely pointing out that the print "text" has limits as it would be difficult to have what you listed in a text string: 02, 01, 01, 01, 10 are below decimal value 32 and generally considered non printable - certainly no font support for those characters. 00 is a null character, not able to be represented in a text value, 9E and F6 are upper ascii and maybe interfered with by iso-8859 translation, leaving just 64 and 2F as characters with no issues in a text value for the print command


printh command for print-hex takes your hex pairs and outputs without any issues.  No translations, and no difficulty as long as you know what the hex values are.  Your string of 12 bytes should not present an issues that I can see at all ... using the printh


So I am not sure what you meant by within the 32 value output.


i meant in hopes all commands would be within the 32 bytes

Just wondering what is the number of commands/functions that your Whelen might have?


Just toying around with the idea in the Editor, you would need to put the command printh in a touch press or touch release event.  attempting to put the command string in a .txt value of a component or va0 variable does not give the desired output.  Inside the event though, I could achieve 128 bytes in the Editor with no reported errors.


Also note that as of v36 at least, printh is now being reported back in the Debug.




the config program might show outputs in the save files,, havent looked yet

here's the program and a saved file, not sure if notepad or an editor can see the output code


blk
(3.11 KB)
zip

Here's the data section from the BLK file for my config for the BL10000 model (i think anyway) have to upload to the controller and test if i set it up right


 

; Start of EEPROM Data Area
;
[EEPROM DATA]
;Addr    0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
 0000:  FF  FF  FF  01  01  09  01  01  0A  32  01  04  FF  64  01  FD  
 0010:  0C  00  FF  64  01  FD  30  00  FF  64  01  FE  C3  00  FF  64  
 0020:  01  3C  99  F1  FF  64  01  39  66  FE  FF  64  01  75  FF  FF  
 0030:  32  01  04  FF  FF  FF  FF  32  01  01  FF  FF  FF  FF  FF  FF  
 0040:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0050:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0060:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0070:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0080:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0090:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00A0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00B0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00C0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00D0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00E0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 00F0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0100:  0D  00  3F  0F  01  07  0C  07  01  07  0B  0B  01  07  3D  3D  
 0110:  02  07  17  17  03  07  18  18  04  07  07  07  01  02  03  01  
 0120:  02  03  2D  80  C0  00  4E  00  FF  FF  FF  FF  FF  FF  FF  FF  
 0130:  FF  FF  FF  FF  08  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0140:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0150:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0160:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0170:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0180:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 0190:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01A0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01B0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01C0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01D0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01E0:  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  FF  
 01F0:  FF  FF  FF  FF  FF  FF  FF  FF  FB  FF  03  05  FA  48  22  9C  
;
; MPC-01 End of Data

 I have to test to see what each mode actually is per line used above


but there's normally 

slider 0 = off

slider 1 = all back strobes (the strobe pattern is also defined)

slider 2 = all front strobes  (the strobe pattern is also defined)

slider 3 = 360 strobes   (the strobe pattern is also defined)


button 4 = front take down

button 5 = left alley

button 6 = right alley

button 7 = gun lock

button 8 = BLTA traffic advisor

button 9 = hi/lo

Login or Signup to post a comment