Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] FlashNextion fails #972

Closed
2 tasks
jacekowski opened this issue Sep 3, 2023 · 11 comments
Closed
2 tasks

[BUG] FlashNextion fails #972

jacekowski opened this issue Sep 3, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@jacekowski
Copy link
Contributor

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

NextionFlash fails with berry errors

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Provide your apps.yaml (or your config):
  apps.yaml here:


  • Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:
  Log output here:

Tasmota console log here:

19:33:45.491 MQT: tele/NSPanel_C4C398/RESULT = {"Flashing":{"complete": 92, "time_elapsed": 16}}
19:33:45.683 stack traceback:
19:33:45.685 	<native>: in native function
19:33:45.687 	<unknown source>: in function `crc16`
19:33:45.689 	<unknown source>: in function `encode`
19:33:45.691 	<unknown source>: in function `send`
19:33:45.703 	<unknown source>: in function `send_cmd2`
19:33:45.704 	<unknown source>: in function `exec_cmd`
19:33:45.706 	<unknown source>: in function `event`
19:33:45.718 BRY: stack[1] = type='instance' (Tasmota)
19:33:45.720 BRY: stack[2] = type='function' ()
19:33:45.721 BRY: stack[3] = type='instance' (Tasmota)
19:33:45.723 BRY: stack[4] = type='string' (every_100ms)
19:33:45.735 BRY: stack[5] = type='string' ()
19:33:45.736 BRY: stack[6] = type='int' ()
19:33:45.737 BRY: stack[7] = type='string' ()

TO REPRODUCE

Steps to reproduce the behavior:

Run FlashNextion from local http server.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

I expect flashing to work.

SCREENSHOTS

If applicable, add screenshots/pictures to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.
Please note here in case you are using ioBroker

It seems like changing

self.flash_buff += self.tcp.readbytes()

to

self.flash_buff += self.tcp.readbytes(4096)

fixes the issue (i'm assuming it stops tasmota/berry from running out of memory when http server can send things quickly as memory usage is ~10kB lower with this change).

PANEL / FIRMWARE VERION

Please add the Panel/Firmware Version you are using (EU, US-L or US-P)

EU - latest

@jacekowski jacekowski added the bug Something isn't working label Sep 3, 2023
@joBr99
Copy link
Owner

joBr99 commented Sep 3, 2023

Which webserver are you using and what tasmota version are you on? I've used this with the integrated webserver in Homeassistent many many times before.

@jacekowski
Copy link
Contributor Author

Apache 2.4.
Tasmota 13.1.0 (but i had it fail with previous versions as well).

Adding 4096 byte limit to

self.flash_buff += self.tcp.readbytes()
fixes the issue

@FRAMELIFTER
Copy link

I have the same Problem, but i am stuck with a flashstatus-Display staying at 10%.
I am using Program Version | 13.1.0(nspanel) and the Panel is connected via IoBroker.

The console output is:
16:19:51.113 FLH: host: nspanel.pky.eu, port: 80, get: /lovelace-ui/github/nspanel-v4.3.1.tft
16:19:51.590 FLH: Something has gone wrong flashing display firmware [bytes('1AFFFFFF')]
16:19:51.764 FLH: Send (High Speed) flash start
16:19:52.209 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 0, "time_elapsed": 0}}
16:19:58.139 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 1, "time_elapsed": 6}}
16:19:59.819 MQT: SmartHome/NSPanel_1/stat/RESULT = {"CustomSend":"Done"}
16:20:01.164 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 2, "time_elapsed": 9}}
16:20:04.018 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 3, "time_elapsed": 12}}
16:20:07.273 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 4, "time_elapsed": 15}}
16:20:10.144 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 5, "time_elapsed": 18}}
16:20:12.638 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 6, "time_elapsed": 20}}
16:20:15.774 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 7, "time_elapsed": 23}}
16:20:18.670 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 8, "time_elapsed": 26}}
16:20:21.501 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 9, "time_elapsed": 29}}
16:20:24.418 MQT: SmartHome/NSPanel_1/tele/RESULT = {"Flashing":{"complete": 10, "time_elapsed": 32}}
16:20:25.826 stack traceback:
16:20:25.828 : in native function
16:20:25.830 : in function crc16
16:20:25.832 : in function encode
16:20:25.834 : in function send
16:20:25.847 : in function send_cmd2
16:20:25.849 : in function exec_cmd
16:20:25.851 : in function event
16:20:25.852 BRY: stack[1] = type='instance' (Tasmota)
16:20:25.864 BRY: stack[2] = type='function' ()
16:20:25.866 BRY: stack[3] = type='instance' (Tasmota)
16:20:25.867 BRY: stack[4] = type='string' (every_100ms)
16:20:25.879 BRY: stack[5] = type='string' ()
16:20:25.880 BRY: stack[6] = type='int' ()
16:20:25.882 BRY: stack[7] = type='string' ()

@joBr99
Copy link
Owner

joBr99 commented Sep 18, 2023

does the suggested change fix your issue?

@FRAMELIFTER
Copy link

how do i fix or change it? How can i add a 4096 byte limit?

@joBr99
Copy link
Owner

joBr99 commented Sep 18, 2023

change

 self.flash_buff += self.tcp.readbytes() 

to

 self.flash_buff += self.tcp.readbytes(4096) 

in the berry driver (autoexec.be) and restart tasmota

@FRAMELIFTER
Copy link

oh, i wasn't sure if it is that simple! ;)

but yeah this change fixed it. You are my hero.

joBr99 added a commit that referenced this issue Sep 18, 2023
@joBr99 joBr99 closed this as completed Sep 18, 2023
@jacekowski
Copy link
Contributor Author

jacekowski commented Sep 18, 2023

I've actually found that even with 4096 byte limit i could still make it crash. and further reducing buffer size seems to have helped.

        var read_limit
        read_limit = self.flash_block_size-size(self.flash_buff)+1
        while size(self.flash_buff)<self.flash_block_size && self.tcp.connected()
            if self.tcp.available()>0
                self.flash_buff += self.tcp.readbytes(read_limit)
            else
                tasmota.delay(50)
                log("FLH: Wait for available...",3)
            end
        end

@joBr99
Copy link
Owner

joBr99 commented Sep 18, 2023

do you have anything special on tasmota that could cause higher memory usage, is matter enabled? (not sure if this a default if you have fresh tasmota version)

@jacekowski
Copy link
Contributor Author

Matter is enabled. Nothing "special" otherwise.

@joBr99
Copy link
Owner

joBr99 commented Sep 18, 2023

It's disabled on all my panels, as I flashed them before tasmota supported matter. Maybe this is indeed the difference, but I've also no clue what the benefit of matter on tasmota for home assistant users should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants