-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Display heading on GPS Tab #3355
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
6156a2e to
2298f4b
Compare
This comment has been minimized.
This comment has been minimized.
|
AUTOMERGE: (FAIL)
|
haslinghuis
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.
Good idea !!!
src/js/VirtualFC.js
Outdated
| }, | ||
| }; | ||
|
|
||
| const SampleGpsData = { |
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.
| const SampleGpsData = { | |
| const sampleGpsData = { |
src/js/VirtualFC.js
Outdated
| "speed": 0, | ||
| "ground_course": 1337, | ||
| "distanceToHome": 0, | ||
| "ditectionToHome": 0, |
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.
| "ditectionToHome": 0, | |
| "directionToHome": 0, |
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.
This is interesting, because I copied the object from memory to clipboard using copy(FC.GPS_DATA) in the console. I have to double check this, I think the typo is fundamentally somewhere else...
src/js/tabs/gps.js
Outdated
| const heading = hasMag | ||
| ? Math.atan2(FC.SENSOR_DATA.magnetometer[1], FC.SENSOR_DATA.magnetometer[0]) | ||
| : undefined; |
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 would prefer one line:
| const heading = hasMag | |
| ? Math.atan2(FC.SENSOR_DATA.magnetometer[1], FC.SENSOR_DATA.magnetometer[0]) | |
| : undefined; | |
| const heading = hasMag ? Math.atan2(FC.SENSOR_DATA.magnetometer[1],FC.SENSOR_DATA.magnetometer[0]) | |
| : undefined; |
| console.log(`Map error ${err}`); | ||
| } | ||
| } catch (err) { | ||
| console.error('Map error', err); |
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.
Why remove string interpolation?
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.
So that we let the browser format the error object as it wishes and not force it to be a string manually.
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.
Plus, it won't really show since the map is running in its own webview with its own console. You have to have the console of the inner webview open to see the message anyway. It's bad, but I didn't take the time to look deeper into the issue
src/js/VirtualFC.js
Outdated
| ublox_use_galileo: 1, | ||
| }; | ||
|
|
||
| virtualFC.GPS_DATA = SampleGpsData; |
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.
| virtualFC.GPS_DATA = SampleGpsData; | |
| virtualFC.GPS_DATA = sampleGpsData; |
haslinghuis
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.
This comment has been minimized.
This comment has been minimized.
4411146 to
c7d7964
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
Do you want to test this code? Here you have an automated build: |
|
nerdCopter
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.
nice! approving. watched demo video









Use data from magnetometer (when enabled) to display heading in degrees and rotate the map accordingly. Can be used to verify correct mag alignment or for testing in general. This PR also adds Virtual FC support for GPS Tab so when connected to VFC pre-defined sample data and thus the map as well will show up.