-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
TFT Update Fails if Bluetooth Proxy is enabled Bug
#1815
Comments
I cannot try this right now, but this should stop the BLE scan before starting the upload: bluetooth_proxy:
id: ble_proxy
esp32_ble_tracker:
id: ble_tracker
script:
- id: !extend upload_tft
then:
- lambda: |-
static const char *const TAG = "CUSTOM.script.upload_tft";
ble_tracker->dump_config();
ESP_LOGD(TAG, "Stopping BLE Tracker scan...");
ble_tracker->stop_scan();
ESP_LOGD(TAG, "Disabling BLE Tracker scan...");
ble_tracker->set_scan_active(false);
ESP_LOGD(TAG, "State: %s", id(ble_proxy)->has_active() ? "Active" : "Passive");
while (ble_proxy->get_bluetooth_connections_limit() != ble_proxy->get_bluetooth_connections_free()) {
ESP_LOGD(TAG, "Connections: %i of %i", int(ble_proxy->get_bluetooth_connections_limit() - ble_proxy->get_bluetooth_connections_free()), int(ble_proxy->get_bluetooth_connections_limit()));
if (id(ble_proxy)->has_active()) {
ESP_LOGD(TAG, "Setting passive mode...");
ble_proxy->set_active(false);
}
vTaskDelay(pdMS_TO_TICKS(1000));
App.feed_wdt();
} Could you please let me know if that helps (and please provide logs)? |
This sounds like lack of memory. Could you please see the |
It was only after i made this post that i saw the comments around the "Bluetooth Proxy Customization" in the documentation. I have 2 new panels to install in the next days... i'll flash one with bluetooth proxy enabled and see how it will work when updating the tft... and i'll collect the logs. |
Which one was that? |
I've improved docs to suggest stopping the BLE scan before upload TFT, but we also solved a memory leak that could be affecting this: I will close this for now to make the backlog a bit more clear, but please feel free to continue the comments here and reopen if the problem persists after updating to the new version (to be released). |
Status update on this issue with v4.3 With the new version it got to 24.54% at max speed and the panel rebooted by itself. [20:13:33][D][nextion.upload.idf:238]: Uploaded 24.38 %, remaining 5667532 bytes, free heap: 3568 bytes The other panels i have with bluetooth proxy off all had free heap around 140000 bytes and no problems uploading the tft file. Here i go.. disabling proxy.. uploading tft.. enabling proxy.. :) |
But do you have that code that stops the BLE when the upload TFT is called as shown here? |
Not yet... i was trying to see if with the new version has is if it would upload :) |
I think we still have some space to save some RAM, but it is getting hard to find those bytes. |
I've just added the script part to my yaml customization area [22:26:17][D][addon_upload_tft.script.nextion_upload:129]: Starting TFT upload... Am i doing something wrong? |
Did you reflash the panel with cable to install esp-idf. If you did, it will likely reboot a couple of times when you upload the tft file to the panel |
it was already on esp-idf.. i have changed to esp-idf sometime ago.. and flashed via cable when i did it... has it is recommended.. the problem was available memory with bluetooth proxy on. the problem now with the script to disable proxy while uploading is: [22:26:22][E][nextion.upload.idf:474]: Preparation for TFT upload failed 0 "" |
|
I didn't pasted the log because it's the same behaviour.. |
Looks like the new ESPHome will be even worse: v2024.2.2:
v2024.3.0b1:
|
Let's forget this problem... just disable bluetooth proxy.. upload.. enable again. |
But this is my main concern. You mentioned 20000 before upload, which is quite a few. If we keep loosing 320 on each ESPHome update it won't take long until this stops working. |
Yes.. When uploading without bluetooth proxy the heap is very stable... and always around 140000 during all the process. Am i missing something concerning the script !extend on upload_tft ? |
That was a try to stop BLE before starting the upload, but looks like that was not effective. |
I thought this is the way from the psram discussion. Maybe I'm wrong. But it seems to be effective... |
Why not! 😃 v4.3.2d1 without PSRAM:
v4.3.2d1 with PSRAM:
v4.3.2d1 with PSRAM and CONFIG_ESP32_REV_MIN_3:
|
OK, I've tried all combinations I could think of. I give up. ble + psram wont startup 100% I get different results with every boot. Resets during startup "loading bar" and sometimes I see the homescreen with clock and temperature but without everything else. HA icon is red, wireless logs cannot be fetched (again, once I could actually get a sneak peak) but ping always works. I doubt it's flash or ram, since it actually uses less on both than my working image. and think it's some kind of load dependant. Why? firmware with all but psram: (booting fine)
firmware with nothing but psram and ble: (not making it)
VID_20240326_173053.mov |
Looks like it is connecting to WiFi, but not to API. Can you get ESPHome log in that state? I'm asking, but as it isn't connecting to API, probably log isn't working also. I will investigate this further. But not now. 💤 |
I was trying to get a log but could barely make a connection.: To me this looks like something is destroying the performance so bad that wifi is not working reliably anymore. ICMP is continuous but anything that needs a TCP connection is barely even making a three-way-handshake. Maybe I could get bettler logs via serial. But... well.... not now. 💤 ;) |
When I remove Upload TFT, it works fine with PSRAM:
|
Soo.... I've been reading about these CONFIG_ "cheatcodes" (mostly here) and it works now. What did I do:
And now I'm from
to
I have enabled I've also freed quite some heap ram: I'll longterm test now. |
All seems great. Only issue so far: the "free heap" log lines during tft upload seems to be psram+heap (?). it's to high for sure...
|
That's right! |
I will enable that on my |
So, I've enabled basic (core + upload TFT), climate dual and advanced packages. Everything looks fine so far, but I can see the I will play later with psram mode and speed... |
Another approach to make the TFT Update more stable could be to release the resources blocked by the BT features. There is a discussion about it here: (freeing 50kb - 70 kb of heap).
and
Could this help in any way? |
Yet another aproach is using NimBLE instead of Bluedroid as written here I can say that the logs of my 9 nspanels with psram and ble enabled are pretty. Sometimes I get
But then I can't say if it's more often than before. I am happy to finally have ble AND tft upload capability. |
Yes, this is a good idea to do that from what I read. We have V3 chips so any stuff that is about the bugs of V1/2 isn't needet. |
Supports #1983 Supports #1946 Supports #1815 Could support esphome/feature-requests#2369
Anyone here have tried v4.3.3 (DEV) and Bluetooth recently? |
No.. my panels are all in walls.. and i don't like dev versions on "in production" hardware. :) |
I have my office panel on dev and it has ble_tracker enabled. I've now disabled all (manually added) psram and sdkconfig parameters and build "clean" from dev. It boots up fine. Looks fine. Maybe also worth mentioning: I run all my 9 panels with bluetooth and psram on @main just fine. |
Ok. I will work on the TFT transfer to take advantage of PSRAM, but that will be for v4.4. 😉 |
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. |
See: #1983 (comment) |
With the new add-ons, I will close this as fixed (still in Thanks a lot for your support on this!!! |
TFT Version
4.2.6
ESPHome Version
4.2.6
Blueprint Version
4.2.6
Panel Model
EU
What is the bug?
TFT Upload Fails when Bluetooth proxy is enabled
Steps to Reproduce
Updated to 4.2.6 (Blueprint and ESP32) when trying to update TFT it fails.
At max speed gets to around 19% and panel reboots
At 115200 gets to around 3% and panel reboots
Removed
bluetooth_proxy:
Reflashed ESP32 with v4.2.6.
No problems uploading TFT at max speed... gets to 100% without any errors or rebooting.
Your Panel's YAML
ESPHome Logs
No response
Home Assistant Logs
No response
The text was updated successfully, but these errors were encountered: