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

Allow GPS serial port to be specified as argument to gps example #2969

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

linguini1
Copy link
Contributor

Summary

This PR adds the ability to specify the GPS's serial port in the gps example, instead of only being able to use /dev/ttyS1. It also marks the MINMEA library as a dependency for the gps example.

Impact

Now that MINMEA is marked as a dependency, the gps example is unfortunately not visible in the list of applications until MINMEA is available. However, I wanted to avoid the use of select in Kconfig since it will not recursively enable dependencies.

The user is now also able to run the gps example with a serial port for the GPS specified, supporting this example on boards where the serial port is different. I have left /dev/ttyS1 as the default when no port is specified to keep backward compatibility.

Closes #2966.

Testing

Tested this example with a board that has GPS on /dev/ttyS0 and it worked as expected. I also tried specifying a bad path and the program exited gracefully with the error.

NuttShell (NSH) NuttX-12.8.0
nsh> gps /dev/ttyS0
Fix quality....................: 0
Altitude.......................: 0
Tracked satellites.............: 0
Fixed-point Latitude...........: 0
Fixed-point Longitude..........: 0
Fixed-point Speed..............: 0
Floating point degree latitude.: *float*
Floating point degree longitude: *float*
Floating point speed...........: *float*
NuttShell (NSH) NuttX-12.8.0
nsh> gps /dev/ttyS2
Unable to open file /dev/ttyS2

@nuttxpr
Copy link

nuttxpr commented Jan 23, 2025

[Experimental Bot, please feedback here]

Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary.

Yes, this PR meets the NuttX requirements. The summary clearly explains the changes, the impact section addresses all the relevant points, and the testing section provides evidence of functionality and error handling. The referencing of issue #2966 is also helpful. The testing logs, while simple, demonstrate the intended behavior.

examples/gps/Kconfig Outdated Show resolved Hide resolved
examples/gps/Kconfig Outdated Show resolved Hide resolved
examples/gps/gps_main.c Outdated Show resolved Hide resolved
Copy link

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @linguini1 :-)

Lets just wait for the CI checks to complete :-)

@xiaoxiang781216 xiaoxiang781216 merged commit acc2b39 into apache:master Jan 23, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] GPS example autoselect MINMEA and configurable serial port
4 participants