on7lds / NextionDriver

Driver program to connect MMDVMhost with Nextion Displays, adding extra functionality
33 stars 33 forks source link

Python script to update display does not work when driver is active #7

Closed JeffHochberg closed 5 years ago

JeffHochberg commented 5 years ago

There's a Python script that one can use to upload a TFT display file to the Nextion so you don't have to disassemble whatever case/enclosure your device is stored within every time you want to update the screen. Details of the Python script are available here:

https://github.com/g4klx/MMDVMHost/blob/master/Nextion_G4KLX/nextion.py

The script does not work at all when NextionDriver is set to 'modem'. In fact, I can't seem to get the script to work at all if the NextionDriver is enabled.

Does the NextionDriver use serial I/O? Should it be possible to use this script?

on7lds commented 5 years ago

The Nextiondriver is written to use the 'normal' Nextion communication protocol to talk to the display and the 'modem' setting uses a MMDVMHost protocol to talk to the display. The TFT upload script needs a serial port directly to the Nextion which uses a simple, not very robuust protocol. So no, at this moment it will not work via the NextionDriver and surely not when the display is connected to the modem.

on7lds commented 5 years ago

I have a version of the NextionDriver running which is able to update the display when connected to a serial port of the Pi. You will have to put a .tft file for the display in the DataFilesPath directory and start the process by touching a button on the display itsself. At this moment, it is working, but does not yet switch to 115200bd when you use layout < 4. Will be in the repository one of the following days.

on7lds commented 5 years ago

Code to load .tft file in display is added.

lmamakos commented 4 years ago

It would be awesome if the display update mechanism would work through the "modem" connection. I don't know if the channel is sufficiently transparent to accomplish that or not.

The goal is to avoid having to disassemble the multi-layer laser-cut case to swap in a microsd card to do the upgrade..

on7lds commented 4 years ago

The update protocol for the Nextion is not very robust. You need rather good controlled timing and the ability to send 4k bytes blocks. Even if this were possible and it is possible to flush it through the communication channel to the modem, it is imperative that the modem has a serial return channel from the display back to NextionDriver to receive all display answers. I think most modems do not have this return channel at this time.