-
Notifications
You must be signed in to change notification settings - Fork 98
Nextion Display
Unfair sellers sells a chenese version of the nextion, these are branded TJCxxxxx, they are not supported by the nextion editor and would be useless with SimHub, make sure to buy a real nextion (model starting with NXxxxx)
Parts needed :
- Nextion display
- Wires
- Usb TTL
Connect USB TTL following these wirings
GND => GND
5V => 5V
RX => TX
TX => RX
Warning ! Trap inside ! Take care, TX goes to RX
Always make sure Simhub is closed before uploading.
MICRO => Nextion
GND => GND
VCC => 5V
RX1 => TX
TX0 => RX
Upload the sketch found in C:\Program Files (x86)\SimHub\_Addons\NextionMicroBridge
It offers the structure to add gamepad support, please not that it's just a sample with a single button and you must add your own logic.
Upload to nextion will not work using the Itead nextion editor but Simhub offers an alternative uploader.
- Build your template using the editor using the "compile" button :
- Open build folder :
- double click on your template file :
- Choose your arduino serial port and click on upload, you're ready !
Nextion template is made of three parts :
-
Nextion template
(.hmi
file) which is made with Nextion editor and uploaded to Nextion display -
Nextion structure
(.hmistruct
file) which describe Nextion display components and used by SimHub -
Mapping file
(.ini
file) which is a "mapping" file to describe how SimHub must use the nextion display
The files must be place inside NextionTemplate
folder
A complete sample for 2.8" display is provided with SimHub
SimHub is bundled with a custom nextion editor, which can be found in SimHubNextionEditor
folder inside archive
Nextion editor documentation is available here : http://wiki.iteadstudio.com/Nextion_HMI_Solution
To connect SimHub to Nextion Editor Emulator you need to bridge two com ports on the same computer.
Always check debug
option of nextion plugin when trying to connect to emulator.
http://www.eltima.com/fr/products/vspdxp/
Connect two USB TTL (RX
=> TX
, TX
=> RX
)
After each nextion display modification you have to update Nextion structure file.
In nextion editor click on Create mapping file
in main toolbar
Structure file will be created alongside HMI
file
In nextion editor All pages must have in Preinitialize event
the sendme
instruction
You can set the role of each page by adding the pagesroles section
- skip means that simhub won't cycle on it (when using cycling actions)
- ingame means that simhub will cycle on the page when in game
- idle means that simhub will cycle on the page when idle
Syntax :
[pagesroles]
{pagename}={role1}[,{role2}]
Exemple
[pagesroles]
idle=idle
printer=idle
system=idle,skip
homealt=ingame
laphistory=ingame
telemetry=ingame
You can create virtual pages based on a real Nextion page allowing you to display easily varoius data using the same nextion spage.
Add to the page virtualpages
section
Syntax :
[virtualpages]
{virtualpagename}={realpagename}
Exemple :
[virtualpages]
gamevolumechanged=virtmessage
rpmalerttriggerchanged=virtmessage
sessionstarted=virtmessage
newlap=virtmessage
Always set vscope
to global
, components and pages names must be in lower case
Only the green properties can be mapped inside SimHub
You can update properties in simhub using mapping file, all the values except when specified are Ncalc functions ( NCalc-scripting)
Syntax :
[{pagename}.{componenentname}]
{propertyname}={ncalc expression}
Exemples :
[laphistory.l1]
txt=format([PersistantTrackerPlugin.PreviousLap_00],'m\\:ss\\:fff')
Add forcerefresh=1
to the mapping section
Exemple :
[{pagename}.{componenentname}]
....
forcerefresh={ncalc expression}
[home.rpmbar]
val=min(100,max(0,isnull([serialdashplugin.computedrpmpercent],0)))
ppic=if(blink('rpm',200,[serialdashplugin.computedrpmpercent]>[serialdashplugin.blinktriggerratio]),8,7)
bpic=if(blink('rpm2',250,isnull([DataCorePlugin.GameRawData.Graphics.isInPitLane],false)),8,6)
FORCEREFRESH=1
Set vis
property :
Syntax:
[{pagename}.{componenentname}]
vis={ncalc expression}
Exemple :
[sessionstarted.icon]
pic=13
vis=1
Use global
as page name in mapping section
Exemple :
[global.rpm]
txt=format(max(0,isnull([datacoreplugin.gamedata.newdata.rpms],0)),'0')