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

scanning for elrs network devices with crsf msp frame capability

Open freasy opened this issue 2 years ago • 21 comments

In future ELRS there is CRSF MSP support.

This contains 2 parts because a elrs rx can connect to home wifi or start a access point mode

  1. home wifi in this mode the elrs rx responds to mdns requests and sends 3 responses (A, TXT, SRV), with those i can make a valid tcp port
  2. ap mode in the latest ELRS master - the mdns is fixed, so i rely on that there too

To check if the connection is still valid we have a "down" event from the mdns browser, but thats not realy reliable, so i poll if a http connection can be made every 5 seconds, this check is skipped, when the GUI is connected to a device.

freasy avatar May 13 '22 11:05 freasy

I've mentioned this in Discord but I'll drop it here for the Betaflight folks' info. This should not be using the hostname as the key (which can change). It should use the mDNS TXT records returned from the query vendor = elrs and type = rx to determine if the target is suitable.

CapnBry avatar May 13 '22 14:05 CapnBry

I've mentioned this in Discord but I'll drop it here for the Betaflight folks' info. This should not be using the hostname as the key (which can change). It should use the mDNS TXT records returned from the query vendor = elrs and type = rx to determine if the target is suitable.

Yes, I will implement that once we sorted AP mode out 👍

freasy avatar May 14 '22 08:05 freasy

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 -> PASS
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

blckmn avatar May 15 '22 01:05 blckmn

While I can't vouch for anything regarding the appropriateness of how this fits into the configurator's scanning pattern, I can say that the ELRS detection from the mDNS responses gets my full approval. This old incorrect comment should be removed though since it no longer does this

// check if any of the answers on the response have a name that starts with
// 'elrs_', which indicates that it is an elers device

CapnBry avatar May 15 '22 11:05 CapnBry

i refactored to another package which is now event based, so no timer anymore.

With the current ELRS master, the need of pinging a constant is obsolete.

freasy avatar May 16 '22 07:05 freasy

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 May 17 '22 01:05 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 May 17 '22 09:05 github-actions[bot]

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar May 19 '22 12:05 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 May 19 '22 13:05 github-actions[bot]

expressLRS v3 RC is approaching rapidly, would be good to get this included in BF configurator so WiFi connection can be tested easily.

howels avatar Jun 25 '22 23:06 howels

@freasy please rebase and squash

haslinghuis avatar Jun 26 '22 01:06 haslinghuis

package-lock.json probably should not be added to the PR? Please also make sure you have only 1 commit per PR (squash, amend etc)

i removed the lock file

@freasy please rebase and squash

i rebased current master and squashed to 1 commit

the android part still needs testing - i couldnt do the test, because remote chrome debug wasnt catching the bf app's chromium

freasy avatar Jun 27 '22 06:06 freasy

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 Jun 27 '22 09:06 github-actions[bot]

@KarateBrot @daleckystepan wana has a look at this

sugaarK avatar Jun 27 '22 13:06 sugaarK

Checked out the branch but it's not working (Hangs at loading as PortHandler can't be initialized) Second just running in development it produces changes to yarn.lock which should be included in the PR.

haslinghuis avatar Jun 27 '22 14:06 haslinghuis

Trying to build I get:

$ rm -rf cache
$ rm -rf dist
$ rm -rf debug
$ rm -rf node_modules
$ yarn && yarn start
yarn install v1.22.17
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://[email protected]/adam-lynch/node-temp.git
Directory: /home/mark/dev/betaflight/betaflight-configurator
Output:
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

haslinghuis avatar Jun 27 '22 22:06 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 Jul 02 '22 10:07 github-actions[bot]

Tested - Linux is working but Android isn't detecting anything, sits at "Loading"

howels avatar Jul 04 '22 15:07 howels

@freasy by moving some initialization from global scope to modules initialization function with this diff you can use GUI.isCordova() diff.txt

haslinghuis avatar Jul 04 '22 20:07 haslinghuis

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Jul 05 '22 13:07 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 Jul 09 '22 10:07 github-actions[bot]

@freasy would like to continue working on this (need a rebase).

haslinghuis avatar Aug 27 '22 22:08 haslinghuis

@freasy would like to continue working on this (need a rebase).

Yes of course! I will rebase it, what is missing so far, I think Android got tested and verified working right?

freasy avatar Aug 28 '22 08:08 freasy

@freasy would like to continue working on this (need a rebase).

Yes of course! I will rebase it, what is missing so far, I think Android got tested and verified working right?

Last time I tested Android this was not working. I'll try the latest code.

howels avatar Aug 28 '22 19:08 howels

@freasy would like to continue working on this (need a rebase).

Yes of course! I will rebase it, what is missing so far, I think Android got tested and verified working right?

Last time I tested Android this was not working. I'll try the latest code.

For me is working really, fine, but first we need to solve some not related issues in android.

asizon avatar Aug 30 '22 08:08 asizon

@freasy please rebase so people are able to test.

haslinghuis avatar Aug 30 '22 22:08 haslinghuis

@freasy please rebase so people are able to test.

@haslinghuis i rebased the current this branch onto the current master, i cant test it right now, i can do that later.

freasy avatar Aug 31 '22 06:08 freasy

@freasy please can you review this now eLRS v3 is released?

howels avatar Sep 09 '22 11:09 howels

@freasy please can you review this now eLRS v3 is released?

i am currently on it

freasy avatar Sep 09 '22 13:09 freasy

@howels @haslinghuis @chmelevskij

i removed helper.js, it seems like its not needed anymore. And i changed some bonjour code, because the "update" call was not functioning anymore (dont know why) but now its fine again.

freasy avatar Sep 09 '22 13:09 freasy