Open cohm opened 7 months ago
It seems that MacOS doesn't support setting text styles. Try commenting out this line to see if a different error shows up: https://github.com/libretiny-eu/ltchiptool/blob/master/ltchiptool/gui/colors.py#L128
Thanks - commenting out that line makes it work, and the GUI now pops up without any error messages! If it's helpful I'm happy to provide a fix for this for mac users (just protecting the problematic line behind something like platform.system() != 'Darwin'
).
I have a follow-up question: I installed the UPK2ESPHome plugin (through putting in this string and hitting "Download plugins..." button), and this works:
However, when I try to use it to grab the config for my device flashed with ESPHome-Kickstart, the program exits and I get a cryptic error message:
OhmBookPro13:~/Downloads > python3 -m ltchiptool gui
22:28:13: Debug: Adding duplicate image handler for 'Windows bitmap file'
22:28:13: Debug: Adding duplicate animation handler for '1' type
22:28:13: Debug: Adding duplicate animation handler for '2' type
I: Loaded settings from /Users/cohm/Library/Application Support/ltchiptool/gui.json
I: Found new device: cu.BLTH - n/a
I: Found new device: cu.Bluetooth-Incoming-Port - n/a
Illegal instruction: 4
OhmBookPro13:~/Downloads > /usr/local/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 3 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
The web interface for the device seems to work fine:
If this question is better asked in the upk2esphome repo I'm happy to ask there, of course!
Many thanks for your quick reply btw, @kuba2k2!
PS. I did upload generic-bk7231n-qfn32-tuya
to the device, but it's clearly not working, so this is why I want to grab the config through UPK2ESPHome. I guess this can be the cause of the problem, but I still have the web interface to the device where I can upload new firmware, so I was hoping the grabbing would still work..
I don't know what Illegal instruction: 4
might mean. However, the web interface is NOT esphome-kickstart, which upk2esphome requires. Flash kickstart to the device and try upk2esphome again - maybe it will work if it's able to connect (it should even detect the Kickstart device's IP automatically).
I'm glad it works, I haven't seen it run on MacOS before but honestly it looks fantastic.
I wonder why the text style crashed the app - you can clearly see text style being applied in the log window (green text).
It's also good to know that downloading plugins actually works. On Linux, for example, switching to the Plugins tab crashes the program right away... One can obviously install plugins with pip
. Oh and the "Download plugins..." button is actually there to search for plugins - it will display a list of all available :smile:
Wow - thanks for the lightning reply!
Ok, so my failed attempt is likely the reason, good to know. Should I just grab the .bin from here and upload via the web interface? https://github.com/tuya-cloudcutter/tuya-cloudcutter/blob/main/custom-firmware/ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin (I know my device has bk7231n)
I'm quite new to this, and only tried to upload a .uf2 file made by ESPhome - I don't want to brick the device by uploading a bad file..
About the text style, no idea - I did comment out that line (this was what allowed the gui to work on my mac), so I guess it's somehow not needed?
Interesting that the "Download plugins..." button should list available plugins - that's what I expected too, but I played around a bit since that actually didn't work for me. I got an error message saying "request
doesn't exist" or similar. Now when I tried again to reproduce it and provide a screen dump, it actually worked :)
That's the cool part here - you can't brick the device by uploading the wrong file, unless you intend to do so by creating a bad file (or the firmware has problems booting up). For LibreTiny, you only need UF2 files - they work nearly everywhere.
That line you commented was used for changing style of the log window (if you change the color scheme in menu). The line responsible for setting colors in the first place is still somewhere there.
Oh so I forgot to include "requests" in dependencies.. good to know, let's keep this issue open. It works now because installing upk2esphome probably added the missing package.
Great to hear about the brick protection! Sorry if I'm slow, but where do I get the kickstart uf2 file I should upload to see if I can get the grabbing via upk2esphome to work?
What you write about the text style and missing requests dependency makes perfect sense - happy to try to navigate through this on a Mac and hopefully provide some helpful feedback in the process :)
Get the kickstart file from esphome-kickstart repository. It's under the libretiny-eu organization on GitHub.
Ok, progress - I grabbed the uf2 file (for anyone as inexperienced as me landing here, it can be found in the assets of the release, but not in the repo itself where I first poked around). This uploaded just fine to the device via the web interface, and allowed the grabbing to start at least, even if it failed and killed the gui before it finished:
No obvious error in the web interface log there, but in the terminal:
OhmBookPro13:~/Downloads > python3 -m ltchiptool gui
23:22:03: Debug: Adding duplicate image handler for 'Windows bitmap file'
23:22:03: Debug: Adding duplicate animation handler for '1' type
23:22:03: Debug: Adding duplicate animation handler for '2' type
I: Loaded settings from /Users/cohm/Library/Application Support/ltchiptool/gui.json
I: Found new device: cu.BLTH - n/a
I: Found new device: cu.Bluetooth-Incoming-Port - n/a
Abort trap: 6
In case it's helpful, these were the last lines in the web interface log:
23:22:20 [D] [hub_api:037]
Reading flash: offset=1fd000, length=2048
23:22:20 [D] [hub_api:037]
Reading flash: offset=1fd800, length=2048
23:22:20 [D] [hub_api:037]
Reading flash: offset=1fe000, length=2048
23:22:20 [D] [hub_api:037]
Reading flash: offset=1fe800, length=2048
23:22:20 [D] [hub_api:037]
Reading flash: offset=1ff000, length=2048
23:22:20 [D] [hub_api:037]
Reading flash: offset=1ff800, length=2048
It seems to have finished reading at least. It's probably related to the way bk7231tools currently extracts that data - it uses some weird go-to magic. I'm currently in the middle of rewriting that.
Ok, I guess I'm stuck here for now then, but I'm not in a rush in any way. Thanks again for the incredible support and fast replies so far!
FWIW, I just tried this again after updating to ltchiptool 4.10.1, but I still get the same error as in my last message above. I guess I should look for a new release of bk7231tools before I should expect the suspected issue above to be resolved? I currently have 1.5.4.
Happy help test something if that's useful!
I also get this on Mac OS 11.7
/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 4 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
It happened when I connected CEN to GND so probably when the chip was seen. Also it happened when I clicked Grab from ESPHome-Kickstart
on another chip with ESPHome-Kickstart firmware flashed.
I'm trying to use
ltchiptool
as part of following this guide but I'm having trouble gettingltchiptool
to run on my Mac (I see it's "untested" according to the docs, so perhaps this is useful feedback). FWIW, I'm on macOS 13.6.1 (22G313), I have python 3.11.6 via homebrew, and I installedwxPython
andltchiptool
, but got this error when starting the gui. I tried both 4.2.3 as used in the guide, and then the current latest version (4.7.0), and got two different errors. The full output is below.Any ideas how to get the GUI to work under macOS?
Thanks a lot in advance!