iotappstory / ESP-Library

Software Distribution and Management Over the Air
GNU Lesser General Public License v2.1
124 stars 35 forks source link

Feature request: Nextion Upload Support #86

Closed GitLer90 closed 5 years ago

GitLer90 commented 5 years ago

I am quite often using Nextion Displays in Projects with the ESP32. So when I want to update the firmware of the ESP, that often includes new firmware for the Touchscreen. It is already possible to upload the new compiled .tft-File to the Display via the ESP using the NexUpload.h from the official Nextion Arduino Library (When the file is already stored on the hardware/SD-Card in your system).

It would be an awesome feature for future releases, if you could not only upload a new .bin file to the ESP but also upload a new .tft file to the Nextion via your Webservice =)

Onno-Dirkzwager commented 5 years ago

@GitLer90 I think this is an awesome idea! Would you be willing to help? Testing, documenting etc.

GitLer90 commented 5 years ago

@Onno-Dirkzwager Sure I would like to contribute! =)

which version do you have?

What do you mean? Arduino IDE? Nextion Editor? Itead Arduino Lib?

do all versions support the nexipload.h?

Same thing^^

on average how large do you expect the .tft files to be?

That depends mostly on how many pages and background pics you have. Mine are around 1-5 MB.

Onno-Dirkzwager commented 5 years ago

@GitLer90 As I dont have one yet.....

GitLer90 commented 5 years ago

@Onno-Dirkzwager I currently use the 3.5" Basic Version (NX4832T035). But yeah, all Nextion Displays support the NexUpload, since the Itead Nextion Arduino Lib is the same for every model. =)

Onno-Dirkzwager commented 5 years ago

@GitLer90 ok thankyou for the suggestion and information. I think this is a great idea. Ill leave this issue open and contact you somewhere in the future for testing, further questions, etc

Onno-Dirkzwager commented 5 years ago

@GitLer90 Good news! I received my Nextion and proved to myself in a test sketch that we can update it OTA using IAS. It will take an other few weeks to implement it correctly in our library and web service. But it is coming!

Onno-Dirkzwager commented 5 years ago

@GitLer90 and to all other people who want to test ota updates to their Nextion Display

~~Comment your IAS username below And we will add a nextion upload field to your account so you can test ota updates to your screen.~~

All users now have access to this field!

GitLer90 commented 5 years ago

Wow, great news! My username: KIMETO

thank you!

Onno-Dirkzwager commented 5 years ago

@GitLer90 do you have an 8266? or only 32's

GitLer90 commented 5 years ago

@Onno-Dirkzwager Only ESP32's

Onno-Dirkzwager commented 5 years ago

@GitLer90 I hope to have the ESP32 version ready by friday

Onno-Dirkzwager commented 5 years ago

@GitLer90 Which nextupload library are you using on the esp32?

alighadyali commented 5 years ago

This would be awesome.

My username is alighadyali

Thanks!

Onno-Dirkzwager commented 5 years ago

I have run into some problems and out of time while developing the ESP32 version for OTA updates.

For those using the ESP8266: https://github.com/iotappstory/ESP-Library/tree/nextion-beta

GitLer90 commented 5 years ago

I have run into some problems and out of time while developing the ESP32 version for OTA updates.

For those using the ESP8266: https://github.com/iotappstory/ESP-Library/tree/nextion-beta

@Onno-Dirkzwager Hm, does that mean the ESP32 Version will take longer? I don't have ESP8266s to test it.

Onno-Dirkzwager commented 5 years ago

@GitLer90 @alighadyali I added the Nextion upload fields to the "My Apps" page. You can add .tft files below the sketch and spiffs files.

richardlong-code commented 5 years ago

Hi Onno, from testing the 8266 version (with the extra yield() just before initiating the connection to the display, I have seen a couple of issues:

1) Following multiple uploads, the SPIFFS is reported to be full, which causes an error in (I think) the ESP NexUpload lib (insufficient space) while transferring the file from IAS.

2) Sometimes the sketch crashes at the point of beginning upload to the display from the ESP. The cause seems to be 'Soft WDT' so I'm looking for a good place to insert another yield() at this point.

The yield() seems to improve the chances of being able to update the Nextion display multiple times, but when the sketch reboots, the display hangs as you observed (and needs power cycling). I seem to get to about 7 or 8 updates without physically touching the display before the crash occurs.

If it helps I will experiment with serial.print() debug messages to see how far it gets through the NexUpload lib and also display the free space at the beginning of each call.

I thought it might help if I share this here do that anyone else who may be looking at this might also see what is happening.

Really useful extension to IAS, hope this helps.

Onno-Dirkzwager commented 5 years ago

I updated the nextion-beta branch

richardlong-code commented 5 years ago

Thanks Onno, I've been testing again, just using the VirginSoil example and just effectively the update process.

By and large it seems to work pretty well now but I've seen a couple of instances where the display seems to have corrupted data, I'm not certain, but I think I can reproduce the cause.

Now that SPIFFS isn't used in the update process, the update upload to the display starts pretty much immediately (very welcome!).

I believe I caused corruption of the upload by uploading a new Nextion firmware onto the IAS control panel while the update was taking place. I thought I should raise this in case the process is used also in sketch upload, which would be less easy to recover?

I'll start playing with this in a real sketch now. :+1:

richardlong-code commented 5 years ago

Hi @Onno-Dirkzwager , I've been using this for a couple of weeks now and today seem to be getting some issues, which look more like IAS is getting confused than the sketch (I'm sure I'm wrong, but I'll try to explain what I do and how I end up fixing it).

I have one active project that uses Nextion and I've been developing it for a while, for the most part not touching the TFT file and just uploading new sketches. Today, when replacing the sketch .bin file on IAS, on the next reboot, I get the Nextion 'white screen' briefly showing it is being uploaded to, before a message saying the screen type doesn't match and a (screen) hang. The sketch then continued as usual, albeit with a non-working screen.

Any subsequent reboot (removal and reinstatement of power) of the target went back to the same state (i.e. trying to get the TFT file again) and all the time, the screen would power up with the existing TFT file still present.

The only way I could fix it was to delete the project and app and start again in IAS, I didn't delete the device.

Some observations your consideration:

  1. It isn't possible to delete a Nextion firmware once it is on IAS (while it disappears from the App pane, it returns when you reopen the app pane)
  2. IAS forgets that there is no Nextion firmware and defaults to a blank entry (requires the user to delete the entry every time a sketch is uploaded)
  3. When it was getting 'confused' IAS reported that the sketch either didn't exist or was incompatible.

I should add that I saw this twice with two different sets of app, project and hardware - the other wasn't a Nextion enabled sketch, but it seemed to become inaccessible in the same way.

Hopefully this all helps in some way. :-)

For now I've set up an app without the Nextion firmware included as that particular app controls our central heating, hehe.

Onno-Dirkzwager commented 5 years ago

@abs-zero-ian This nextion beta uses a different update address as the normal version. And I think your errors have something to do with me editing this file and adding md5 support for file verification (is an update necessary or not)

Onno-Dirkzwager commented 5 years ago

@GitLer90 @alighadyali @abs-zero-ian @msiebuhr @Nredor We finally released a new beta that supports both the ESP8266 and ESP32!

https://github.com/iotappstory/ESP-Library/tree/nextion-beta

It is no longer necessary to get on the test list. All IOTAppStory users can now use upload Nextion files in the Control Panel!

Onno-Dirkzwager commented 5 years ago

@GitLer90 @alighadyali @abs-zero-ian @msiebuhr @Nredor accepted my pull request. You can now find the ESPNexUpload in the Arduino library manager!

JustusW commented 5 years ago

Since there's no official repo for the page: I'd really appreciate if the Nextion upload thingy didn't require me to delete the superfluous upload field every time I change my app.

richardlong-code commented 5 years ago

I agree - I've raised this on the Discord channel and it is probably on the list somewhere.

Edit: it is in my list of points above, no2. It now seems possible to delete an existing Nextion firmware from IAS.

Strictly these are IAS website points but as you say I'm not aware of a place other than the Discord channel to discuss those. If you view Andreas's videos presenting IAS, you can get the invitation link and join us on Discord. :-)

On Wed, 9 Jan 2019, 08:21 Justus Wingert <notifications@github.com wrote:

Since there's no official repo for the page: I'd really appreciate if the Nextion upload thingy didn't require me to delete the superfluous upload field every time I change my app.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iotappstory/ESP-Library/issues/86#issuecomment-452610325, or mute the thread https://github.com/notifications/unsubscribe-auth/Acz5xdq5BZCA-nPRDJE3AXXVSpg1X2Hzks5vBaamgaJpZM4X0Cem .

Onno-Dirkzwager commented 5 years ago

Hi @JustusW, we fixed the version trash button (that forgot to delete on save)

Im not sure if this solves your issue let me know!?

JustusW commented 5 years ago

Hi @Onno-Dirkzwager,

It sort of did help, I still get the empty field and can't submit until I wrote something in there or deleted it, but it will at least stay filled in on subsequent submits. If you have any way of releasing your web code on Github I would happily assist you in evolving it forward.

Onno-Dirkzwager commented 5 years ago

@JustusW saw this last message a little late. But this is also fixed as I ran into it as wel.

This nextion field was for the beta testers. And this part of the page will be replaced in the future.

We would appriciate your help. But are not set up for this yet..... Are you on our discord channel? Would be nice to have a chat on this topic.

GitLer90 commented 5 years ago

Thank you! It works now! =)