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

CleanFlight Serial Demo always selects the 1st device in the combo box. #23

Open
CartBlanche opened this issue Oct 16, 2021 · 2 comments

Comments

@CartBlanche
Copy link

I believe there is a slight bug on lines 20-21 in the ViewController here...
https://github.com/Arti3DPlayer/USBDeviceSwift/blob/master/CleanFlightSerialExample/CleanFlightSerialExample/ViewController.swift#L20-L21

Instead I think it should be

if (self.devices.count > 0 && self.devicesComboBox.indexOfSelectedItem > -1) {
                let device = self.devices[self.devicesComboBox.indexOfSelectedItem]

I'm new to Swift (and IOKit), so there may be a better way to do this.

@CartBlanche
Copy link
Author

@Arti3DPlayer In one of your SO posts about IOKit you mentioned using C#. I'm mainly a C# developer and due to another project requiring Serial Modem Detection, I created this project https://github.com/CartBlanche/IOKit-Sharp . Some of the ideas in that lib are based on (but not exactly like) your Swift lib, but made more C# friendly, obviously. I have Serial detection (adding and removing devices) working. The rest I'll probably leave to the community or will flesh it out myself, when needed. If you have any suggestions, let me know :)

@Arti3DPlayer
Copy link
Owner

@CartBlanche that's great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants