feat: add U-BLOX GPS support#4689
Conversation
32dd77e to
20ef41e
Compare
|
Tested this PR with TX16S and Holybro Pixhawk 4 GPS set to NMEA 9600 baud to check compatibility with the previous working state of EdgeTX radio side GPS support. Using TxGPStest widget for testing. |
|
Next tested with Matek M10Q-5883 GPS, also with TX16S and TxGPStest widget. Also here, other values than altitude are fine. Although, with UBX GPS, I do not see incremental downwards counting of altitude, just fully wrong (negative) value. All tests were carried out outside with 10+ satellites in view. |
Right, a remaining debug data. It's removed. |
|
Re-tested with M8Q and M10Q GPS, both work. Well done! |
|
Fixed the UBX altitude that was 10 x to high. |
|
Hmm... TxGPStest widget showed correct altitude for M8Q and M10Q GPSs for me before 4c76f16 commit though? |
|
I tested with the same GPS with NMEA and UBX I had different altitudes. And looking at where I am on google earth it shows something more like the NMEA altitude. I'm a few km form the ocean, so 500m altitude is not right. |
| if (get_tmr10ms() - time > 20) { | ||
| changeBaudrate(); | ||
| time = get_tmr10ms(); | ||
| } |
There was a problem hiding this comment.
I think it might make sense to couple this timeout to the official ACK/NAK timeout of 1s, page 179 in this receiver spec. My experience says that this lower timeout is not an issue, but it is not according to the spec
There was a problem hiding this comment.
Yes, it's a bit aggressive 1s seems a lot though.
|
The autodetection detects my UBX GPS as NMEA. My assumption is that this is because some GPS modules are preconfigured to output certain NMEA messages by default. In my case, the GPS outputs GGA, GSA, GSV, RMC, VTG and GLL messages in the NMEA format, thus |
|
That of itself isn't that big of a problem IMO... the primary goal of the autodetection is to allow you to plug in a GPS, and it just work... so if it is configures as both NMEA/UBX, it still "just works". This is where there is potential scope for UI options - i.e. where you can set it to NMEA, UBX, Auto perhaps? |
|
Yeah, it'll just work. But on the other hand, afaik all UBlox GPS modules can speak NMEA. I think UBX should be the encouraged protocol, regardless of the default of that module. UBX uses less computation (binary instead of decimal), the satellite count is more accurate and it is configurable. A toggle would resolve this problem, but it is yet another option the user has to change. I am currently making myself familiar with the codebase, cause I have not done any EdgeTX development yet and I am not familiar with it. Is there any interest for Open Location Codes / Plus Codes? I have a pretty easy to implement function to generate one in my FC, but I can't think of a use case for it in EdgeTX. |
|
Yes, AFAIK, that it is the case (uBlox GPSs able to talk NMEA). However, there are GPSs now that are configured with UBX out of the box, hence why the contest for UBX support to be added to ETX, and the autodetection makes it so the user wouldn't even know. Plus codes are already possible with https://github.com/kristjanbjarni/opentx-widgets?tab=readme-ov-file#gps-widget-widgetsgpsmainlua |
|
I wrote some code to prefer UBX over NMEA. For details check the PR. I also increased the timeout to 500ms. You can test it by unplugging the GPS RX/handset TX wire when your GPS is preconfigured with NMEA. My GPS is recognized as a NMEA in that case. When I plug the wire back in, I get UBX 👍🏻 |
|
I think it's the way to go: prefer UBX if we can and fallback to NMEA. No need for a user input, no need to save the configuration to the GPS unit. |
|
GPS broken in v2.11. Do several test and getting issues with Beitian BN200 in v2.11. EdgeTx still sending commands to GPS all the time |
Add U-BLOX GPS support.
Summary of changes:
Demonstration Video: https://youtu.be/i5LhTFyInUY
To debug RS232 with the simulator, pass
-DSIMU_COM_PORT=2where 2 is the third COM port on the machine as listed in the port selection of betaflight for example.Only one PORT is available to the simulator AUX1 or AUX2.
The protocol and baud rate are automatically detected with 200 ms hops. The first protocol that generates a valid frame is selected. If the GPS stops sending data for any reasons, the auto-detection is restarted.