betaflight-configurator icon indicating copy to clipboard operation
betaflight-configurator copied to clipboard

Add manual connection option

Open haslinghuis opened this issue 1 year ago • 45 comments

  • Have observed users clicking the connect button without any connection available making manual connection an option would fix most Failed to open serial port events. During this process port_handler has been optimized.
  • manual optional is now optional - as most users would only use serial connection
  • removes brain overload after refactoring some code in porthandler
  • made currentPorts global simplifying code

image

image

haslinghuis avatar Dec 29 '23 00:12 haslinghuis

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 29 '23 00:12 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 29 '23 01:12 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 29 '23 01:12 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 29 '23 01:12 github-actions[bot]

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> PASS
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> FAIL
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

blckmn avatar Dec 29 '23 04:12 blckmn

I don't understand. What is the problem with JQuery? I understand is old technology and if we can get rid of it, great. But remove it to go with plain javascript, does not seem a good option to me. The idea was go to Vue (or any other technology that we decide and simplifies the code) but not to plain javascript.

McGiverGim avatar Dec 29 '23 07:12 McGiverGim

Agree Vue was adapted some time ago and thought this move was creating a path for further migration.

haslinghuis avatar Dec 29 '23 16:12 haslinghuis

@McGiverGim @chmelevskij please assist in getting this to use Vue as requested.

haslinghuis avatar Dec 30 '23 21:12 haslinghuis

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 30 '23 21:12 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 30 '23 21:12 github-actions[bot]

Unsure about this.

If users clicking too soon, enabling the buttons could be moved to after ports being populated similarly to https://github.com/emuflight/EmuConfigurator/pull/458/files However, this is only effective at first launch.

If port handler needs independent optimization, can it be a separate PR? or is it dependent on this new logic?

nerdCopter avatar Dec 31 '23 21:12 nerdCopter

Going to rewrite the PR so it only adds manual connection option - as far is possible as some changes were needed to make it work. Hiding manual mode would prevent connecting to a non-existent device.

EDIT: 2 hours later think you are right, some changes were needed to make it work as tested.

haslinghuis avatar Dec 31 '23 22:12 haslinghuis

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Dec 31 '23 22:12 github-actions[bot]

  • i don't feel this is needed, but i also do not know the statistics on the offending clicks.
  • it will also add another step to vtx-slayer's https://pr0p.dev/ , but such is an external issue.

nerdCopter avatar Jan 04 '24 16:01 nerdCopter

Agree but assume most users won't need manual connection as hiding this simplifies UI. That's all :)

haslinghuis avatar Jan 04 '24 17:01 haslinghuis

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Jan 04 '24 17:01 github-actions[bot]

Put a lot of work in this - required lot's of testing different scenario's - but it has some other fixes too:

image

2024-01-04 @17:31:10 -- Serial port successfully closed
2024-01-04 @17:31:10 -- Device - Rebooting
2024-01-04 @17:31:10 -- Using cached builds information for https://build.betaflight.com/api/targets.
2024-01-04 @17:31:10 -- Using cached builds information for https://build.betaflight.com/api/targets.
2024-01-04 @17:31:10 -- Using cached builds information for https://build.betaflight.com/api/configurator/sponsors/dark/landing.
2024-01-04 @17:31:10 -- Using cached builds information for https://build.betaflight.com/api/configurator/sponsors/dark/flash.
2024-01-04 @17:31:11 -- Using cached builds information for https://build.betaflight.com/api/targets.
2024-01-04 @17:31:11 -- Using cached builds information for https://build.betaflight.com/api/configurator/sponsors/dark/flash.
2024-01-04 @17:31:11 -- Using cached builds information for https://build.betaflight.com/api/targets.
2024-01-04 @17:31:15 -- Query board information to preselect right firmware
2024-01-04 @17:31:15 -- MultiWii API version: 1.46.0
2024-01-04 @17:31:15 -- Using cached builds information for https://build.betaflight.com/api/targets/FLYWOOF722PRO.
2024-01-04 @17:31:15 -- Using cached builds information for https://build.betaflight.com/api/builds/4.5.0-zulu/FLYWOOF722PRO.
2024-01-04 @17:31:15 -- Using cached builds information for https://build.betaflight.com/api/releases/4.5.0-zulu/commits.
2024-01-04 @17:31:15 -- Configurator has successfully detected and verified the board: FLYWOOF722PRO
2024-01-04 @17:31:21 -- Failed to open serial port

This PR:

2024-01-04 @18:33:21 -- OS: Linux
2024-01-04 @18:33:21 -- Configurator: 10.10.0-debug-27b1c354
2024-01-04 @18:33:24 -- Using cached builds information for https://build.betaflight.com/api/targets.
2024-01-04 @18:33:25 -- Query board information to preselect right firmware
2024-01-04 @18:33:25 -- MultiWii API version: 1.46.0
2024-01-04 @18:33:25 -- Configurator has successfully detected and verified the board: FLYWOOF722PRO
2024-01-04 @18:33:28 -- Success: https://build.betaflight.com/api/builds/740b520792e3ae53af940c9ab98a7633/status
2024-01-04 @18:33:29 -- Success: /api/builds/740b520792e3ae53af940c9ab98a7633/hex
2024-01-04 @18:33:34 -- MultiWii API version: 1.46.0
2024-01-04 @18:33:34 -- Device - Rebooting to ROM BOOTLOADER
2024-01-04 @18:33:35 -- USB device successfully opened with ID: 1
2024-01-04 @18:33:35 -- Detected device with total flash size 512 KiB
2024-01-04 @18:33:35 -- Chrome API Error: Transfer stalled..
2024-01-04 @18:33:35 -- Read protection not active
2024-01-04 @18:33:43 -- Erased 512 kB of flash successfully
2024-01-04 @18:34:08 -- USB device successfully closed
2024-01-04 @18:34:11 -- Query board information to preselect right firmware
2024-01-04 @18:34:11 -- MultiWii API version: 1.46.0
2024-01-04 @18:34:11 -- Configurator has successfully detected and verified the board: FLYWOOF722PRO

haslinghuis avatar Jan 04 '24 17:01 haslinghuis

request real world testing from multiple devs before merge.

nerdCopter avatar Jan 04 '24 17:01 nerdCopter

I'm all for improving port detection, but do not agree with changing to manual configuration if the user keeps pressing the 'connect' button.

A change that improves port detection could be considered a bugfix for inclusion in 4.5, if we get confirmation that it really does make a clear difference.

But changing to manual configuration if the user presses the connect button more than once obscures the 'bug fix' code and essentially adds a new feature.

Maybe this PR should be broken into two parts, one being a bug fix to improve connection detection, that we consider for 4.5; the other, ie swapping to manual mode, being a suggested new feature for 4.6.

On my mac, after some time of normal operation, a serial port stops opening when I connect a flight controller. I have looked into it, and it's because at system level, the Mac isn't seeing any connection for Betaflight to utilise. Switching to manual configuration - manually - has not been helpful on a single instance. A reboot will fix it. So I see no value in changing to manual configuration automatically. The user should decide to do that.

I've not had a single instance of a port being available that wasn't automatically loaded, or at least I didn't notice it.

ctzsnooze avatar Jan 05 '24 02:01 ctzsnooze

@blckmn the issue is intermittent and non-breaking so skipping to next release.

Tried to unravel the code before (splitting into 2 PR's but testing indicates code depends on both)

haslinghuis avatar Jan 05 '24 14:01 haslinghuis

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Jan 08 '24 18:01 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Jan 08 '24 21:01 github-actions[bot]

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

6 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 08 '24 22:01 sonarqubecloud[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Jan 08 '24 22:01 github-actions[bot]

@haslinghuis can we use bluetooth with this PR ?

HThuren avatar Jan 14 '24 20:01 HThuren

In theory it should already be possible using serial mode but did not look at it.

haslinghuis avatar Jan 14 '24 20:01 haslinghuis

Deploy Preview for origin-betaflight-app ready!

Name Link
Latest commit 3785b9f53128164065c507f23dc8bbfa68560c6a
Latest deploy log https://app.netlify.com/sites/origin-betaflight-app/deploys/663947f05c8e810008f708bf
Deploy Preview https://deploy-preview-3703--origin-betaflight-app.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 26 '24 16:03 netlify[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-macOS Betaflight-Configurator-Windows WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar Mar 26 '24 16:03 github-actions[bot]

Do you want to test this code? Here you have an automated build: Betaflight-Configurator-Android Betaflight-Configurator-Linux Betaflight-Configurator-Windows Betaflight-Configurator-macOS WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

github-actions[bot] avatar May 03 '24 11:05 github-actions[bot]