-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
TFT Upload unreliable with ble_tracker enabled
#1946
Comments
The BLE engine takes quite a lot of memory from esp, leaving too few for the upload (which is also memory intensive). |
hmm but doesn't the working upload with 921600 baud show that there is enough memory? Don't want to offend you since you clearly have more knowledge here than I do. I am grateful for all the work you do for this project. |
It could be, but that requires reviewing not only the Nextion component on ESPHome, but also some of it's components, like web client, etc... It takes time. :( |
I'm looking a lot on all those possible memory leaks. We are much better now than in v4.2, but still a lot to do. |
I agree ― with each version, it keeps getting better!!! Keep up the great work @edwardtfn |
I ran some test uploading TFT in an almost clean system (only basic package, with TFT upload, but no BLE) and transferred files multiple times (alternating between US and US Land to force it starting from 0), always at 115kbps.
Still the difference from the maximum free heap to minimum free heap is around 12kb, and I think the memory available when BLE is active is not giving space for this fluctuation. But it's important to understand that BLE is leaving too few memory for other things, so this will probably postpone this issue, but not eliminating it. |
A service call still possible, but the services won't do anything. Helps with #1946
I'm looking for someone brave enough to run some tests with PSRAM. This is not solving the flash limitation related to using BLE, but may help with the Heap issue. We are having a discussion around this on #1983. If you wanna try it, just add this as a customization to your panel's yaml: esp32:
framework:
sdkconfig_options:
CONFIG_D0WD_PSRAM_CLK_IO: "5"
CONFIG_D0WD_PSRAM_CS_IO: "18"
psram: |
It may be to soon to ask this... But could this open the door to have thermostat and/or other expansions along WITH BL proxy running at the same time, not just making upload more stable with bluetooth? EDIT: just noticed, basically relevant discussion over here: #1815 |
I was looking at the Nextion component code and it has a queue of commands to be sent to Nextion. As nothing will be sent during the TFT upload (other than the TFT packages), this queue can grow indefinitely. I will take a look in our code to ensure nothing is send to the panel (adding to the queue) while uploading. |
You can have BLE and addon climate at the same time with the current version, but then you have to disable Upload TFT. You can see more about this on my comment here: #1815 (comment) Please let me know if you need further help with that. |
Yes, that is good suggestion, thanks!. (In fact, that was one reason I asked in some other thread about changes and version management of TFT, i.e. I'd know and could delay ("in good faith")updating the TFT if no major/breaking changes/incompatabilies for otherwise newer firmware/blueprint are made. ) |
Supports #1983 Supports #1946 Supports #1815 Could support esphome/feature-requests#2369
Anyone here have tried v4.3.3 (DEV) and Bluetooth recently? |
Sadly still doesn't fully work for me, it now at least starts the TFT upload, but crashes at about 15% to 25% and reboots. At least now it's booting again, if you remove bluetooth for updating the tft and adding it back the successful TFT update - so a workaround by disabling bluetooth for the tft-update works now! |
Could you please share the log of a TFT transfer while BT is installed? |
I have attached multiple tries (just after rebuilding) to this comment: tft_upload_after_rebuild.log |
Ok, I see the memory still going down during TFT transfer. It is showing the full memory, but the internal memory is probably getting full and all the buffer of this transfer is done with the internal memory. |
Thank you very much @edwardtfn ! |
If you wanna give it a try with transfer buffer (it is just a small chunk, but it's probably better than nothing), add this to your panel's yaml: external_components:
- source:
type: git
url: https://github.com/edwardtfn/esphome
ref: nextion-23
components:
- nextion
- psram
refresh: 1s Please let me know your results. |
I tried it and it still didn't manage to upload the tft for me with 115200 baud. |
With 921600 baud and the same code it starts at 75k dram free and finishes at 60k. So, with 115200 after 10% flashing, about 40k of ram are gone. |
Ok. Thanks! |
I agree and would love to help but I don't know how. memory management or troubleshooting on esp32 is a new topic behind an unknown land after a steep learning curve for me ;) |
Sadly it still crashes at about 20% with baud rate 921600 - at 4% with 115200, with this being the first & last log message:
|
how are you stoping the bt? See: #1983 (comment) You could try to disable any bluetooth device that is around or cover the nspanel with aluminum foil (to block some signals). I have a lot of BT devices and it goes down much faster... |
I have the recommended script from /docs/customization.md#ble-tracker:
Maybe you have something there #1983 (comment), I don't have time to test myself atm though. |
I've added that and a bit more to the main code (still in dev), so it should work without this |
With the new add-ons, I will close this as fixed (still in Thanks a lot for your support on this!!! |
TFT Version
4.3.1
ESPHome Version
4.3.1
Blueprint Version
4.3.1
Panel Model
EU
What is the bug?
I have ble_tracker configured on 9 panels and updating from 4.3.0 to 4.3.1 with ble config enabled works mostly. The momory leak fix in 4.3 didn't resolve this but made it consistant as the starting conditions are now always about 22k free heap.
When it doesn't work, it's always running out of heap memory while uploading with 115200 baud.
From the log you can see it tried with 115200 and failed at 10:02:11 and 10:04:51 and finally succeeded with 921600 baud at 11:23:15.
This was reliable on all panels, although about 50% updated correctly on the first try (with 921600).
The free heap is always going down during tft flash, but because the upload is just faster with 921600 it reaches 100% before out of memory.
Since we only need the last 15% of the tft in small updates this can finish. If we have bigger changes in the feature or during initial flashing this issue hits harder.
Steps to Reproduce
Your Panel's YAML
The text was updated successfully, but these errors were encountered: