-
Notifications
You must be signed in to change notification settings - Fork 202
Created GUI for bootloader #518
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
Conversation
Moved GUI from Flash boot speedup branch to develop branch.
themarpe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:
-
Combine files into single file and move to
utilities/device_manager.py -
Somewhere in the GUI or in "About", print current version & commit if available (& maybe branch, by a lookup) of the depthai library. (Accessible using:
dai.__version__&dai.__commit__) -
Add capability to flash depthai application package (dap), created by
createDepthaiApplicationPackageand flashed byflashDepthaiApplicationPackage -
... (in the future, we'd have to expose the capability to Python) Add SBR viewer (like: https://github.com/luxonis/SBR/blob/main/examples/sbr-util/README.md), to view .dap files (and or read out existing on device flashed apps...)
examples/bootloader/guiFunctions.py
Outdated
| def getDevices(window, devices): | ||
| listedDevices = [] | ||
| devices.clear() | ||
| deviceInfos = dai.Device.getAllAvailableDevices() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dai.XLinkConnection.getAllConnectedDevices() and print the state along them, just so this also serves as listing all devices (no matter the state)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE:
- renamed file and moved to
ustilities/device_manager.py(everything is now in 1 file) - GUI now has 2 pages (
AboutandConfiguration settings) - GUI also informs dai.version and dai.commmit
- Added button
Flash DAPthat runsflashDepthaiApplicationPackagefunction - Changed device finding from
dai.Device.getAllAvailableDevices()todai.XLinkConnection.getAllConnectedDevices()
That is everything?
- renamed file and moved to ```ustilities/device_manager.py``` (everything is now in 1 file) - GUI now has 2 pages (```About``` and ```Configuration settings```) - GUI also informs dai.__version__ and dai.__commmit__ - Added button ```Flash DAP``` that runs ```flashDepthaiApplicationPackage``` function - Changed device finding from ```dai.Device.getAllAvailableDevices()``` to ```dai.XLinkConnection.getAllConnectedDevices()```
Moved buttons for moving between pages to menu bar.
Added pressed animation to menu buttons.
Changed button "About" to "Device select" to not confuse users
|
@ZigiMigi Have some tweaks to be added. As for the rest - I don't seem to see the whole GUI - missing The GUI is Current version & commit are library level information - move those to another tab Please update #517 to add upon this changes |
|
|
Thanks @ZigiMigi - I've pushed my changes.
Thats fine for now.
Just rebase the changes on top of current work (eg. so one can merge them into this branch later) - basically to bring that branch up to date, be a single file, as well as changes we are discussing and ones I've just pushed... Not needed immediately, I though I'd need it sooner, so it can wait until this PR gets merged first... (but will be required then, to be able to merge) |
|
@themarpe This was the idea in the first place to use just Above modification is also "needed", if As for issue #517, I'll bring it up to date today. |
Sounds like a bug - I'll take a look later today...
Problem is that devices can also not have flash storage, to be able to even flash the config... (eg. OAK-D). So try testing with those devices as well. Not a lot of functionality to test there, but should still work.
Thanks! |
|
|
OAK-D-IOT does have flash. You should properly handle a "null" config as its a valid state. Config can be either:
|
|
Small correction, when i was playing around with IOT I flashed it like you would an POE device and i somehow deleted it's configs to None. |
|
Please add the following capability as well: Should fit under first tab as a button |
Added new button "Flash from usb"
|
New button added |
themarpe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All functions like getConfigs, flashBootloader, flashConfig, ... could use same "device" after its "Selected".
(As it otherwise causes long delays in booting up for each operation)
utilities/device_manager.py
Outdated
| window['Factory reset'].update(disabled=False) | ||
| # window['Reset configuration'].update(disabled=False) | ||
| window['Flash DAP'].update(disabled=False) | ||
| window['Boot from USB'].update(disabled=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to Boot into USB Recovery mode
utilities/device_manager.py
Outdated
|
|
||
|
|
||
| def getConfigs(window, device, devType): | ||
| bl = dai.DeviceBootloader(device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only connect/disconnect to a device when needed
Rarely a bad idea, especially in ambiguous situations |
Changed program so that you connect to the device only once
|
|
@Erol444 Please test this out on your end as well and comment if any additional changes are required (as you see fit) |
|
@ZigiMigi Add a try catch for importing packages and issue a meaningful message that tells to install the |
Added install_requirements.py and requirements.txt
|
| import subprocess | ||
| import sys | ||
|
|
||
|
|
||
| in_venv = getattr(sys, "real_prefix", getattr(sys, "base_prefix", sys.prefix)) != sys.prefix | ||
| pip_call = [sys.executable, "-m", "pip"] | ||
| pip_install = pip_call + ["install"] | ||
|
|
||
| if not in_venv: | ||
| pip_install.append("--user") | ||
|
|
||
| subprocess.check_call([*pip_install, "pip", "-U"]) | ||
| subprocess.check_call([*pip_call, "uninstall", "depthai", "--yes"]) | ||
| subprocess.check_call([*pip_install, "-r", "requirements.txt"]) | ||
| try: | ||
| subprocess.check_call([*pip_install, "-r", "requirements-optional.txt"]) | ||
| if sys.platform == "linux": | ||
| print(f'$ sudo apt install python3-tk') | ||
| except subprocess.CalledProcessError as ex: | ||
| print(f"Optional dependencies were not installed (exit code {ex.returncode})") No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd install python3-tk in this case...
Have you tested this. This seems like it just uninstalls the depthai as of right now...
Also requirements-optional.txt aren't available...
Anyway, in this case I think best thing would be moving the examples/install_requirements.py down to /install_requirements.py and adding an argument IFF only specific requirements are needed (eg docs/utilities/examples, although that can be added later). Otherwise same principle applies - installs depthai, dependencies, etc...
CC: @Erol444 @szabi-luxonis on above
Erol444
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- When you open up the app, it should automatically perform
Searchand auto-select the first device it sees. - When you select a device with drop-down, it should automatically select it, without the need to click
Selectbutton (so remove that button) - Yellow/White color scheme for buttons at the bottom has to be improved, as text can't be read easily.
- Using latest depthai version (2.15), I get an error when flashing bootloader
line 185, in flashBootloader
bl.flashBootloader(progress)
ValueError: DeviceBootloader wasn't initialized to allow flashing bootloader. Set 'allowFlashingBootloader' in constructor
- Why is depthai
versiontext underlined?Current __version__: - When flashing bootlaoder/app, maybe indicate the callback
- Under
Current bootloader version, there's an issue as it's always statedNone, even after flashing the new bootloader and restarting the app - Background could be a bit lighter, so the black text is easier to read
- When you click on
Config, it should be written which device are you setting the Config for. It should also throw an error if you try to set network related configs to the USB device (not sure if implemented).
Fixed requested changes and also made GUI flashing to work so that you may flash only wanted configs and not all.
|
Addressed needed changes:
|
Buttons select removed, GUI works with combo' events now( clicking in the combo box triggers same event as select did).
Changed window size and added device name to config tab.
Fixed values error
Erol444
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, we should merge into master branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left my reviews & fixme notes in the commit I've pushed.
Overview of TODO
- Bootloader type as an entry in about (USB/NETWORK)
- Search for devices upon starting the program (reduces 1 click for UX reasons - and its a non-destrcutrive operation and doesn't require to be explicit)
- Allow flashing of different type of bootloaders (maybe under a separate tab as "advanced")
- Initially allowFlashingBootloader = False & later when BL wants to be flashed reconnect (reason: if that option is set the device is automatically booted with latest BL in library, also it takes much longer to connect)
- Test with a device flashed with an older bootloader
- Also connecting to a "BOOTED" devices doesn't error out properly AFAIK (eg one device running some example already, etc...)
Fixed addressed changes.
|
Addressed above changes and requested fixes:
ALSO:
|
|
Flashing different types of bootloads should give you an option to flash either USB or NETWORK bootloader. By default, it flashes the one that matches the type of connection to the device. |
|
But isn't that already achived with the combobox |
|
@ZigiMigi rechecked - looks good. Didn't saw that you've added it in. Retested with unflashed device, seems like there is still no differentiation between no flashed bootloader and flashed bootloader The "isEmbeddedVersion" tells you whether BL had to be booted, or we connected to an already flashed Bootloader. |
|
Also, does default still do the expected (if no Bootloader Type is selected)? (Eg. does it flash the USB if its USB and ETHERNET if its a PoE device)? It might also make sense to move potentially bricking operations to a separate tab, and issue a warning upon entering of that menu, that changing this could soft-brick a device... |
|
Added a default option which will auto select bootloader type based on device type
Addressed requested changes.
|
New PR: #579 |

Moved GUI from
Flash boot speedupbranch toDevelopbranch.