-
Notifications
You must be signed in to change notification settings - Fork 100
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
[Feature Request] enableGNSS - using combined constellations #188
Comments
Hi @hybridOL ,
SparkFun_u-blox_GNSS_Arduino_Library/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp Line 8289 in 3416a31
With v3 of the library, the enum is even more important as it controls which Configuration Interface Key is selected for each constellation. Again combined values are illegal. Best wishes, |
Yeah, you're right about the check - also the numbers are not yet combinable. Still, this command is quite large nad requires a 500ms pause after execution. So it would be desirable to have a multile system enable command. |
Good point about the execution time... For modules that support the Configuration Interface (F9, M10), this is easy:
But for the M8, we are stuck with CFG-GNSS... The
And then add a new method containing your code:
Another way could be: Add a terminator to the GNSS ID enum:
Then add a new method which walks through the gnssIDs until it reaches END:
The code would look something like:
Let me know if this would work for you. Best wishes, |
Yeah, I'm using M8. The two enums will probably have the problem that the new function would accept the consecutive values and would create horrible confusion. The array is a nice idea. The interface is unique and the enum stays backward compatible. The list is also nicely readable and statically configurable. I'd vote for that one, can come up with some code over the weekend. |
How about this: Add the enum terminator, but make it consecutive:
Define the configure method as the following. To make it memory-safe, don't provide a default for numGNSS:
The code would look like:
You could also then do things like:
The isGNSSenabled method could use the same array. To make it memory-safe, don't provide a default for numGNSS:
You could then use similar methods to set the |
I think the enum terminator is not necessary in this version, correct? Also, should the isEnabled function return an array with enable/disable being set for each GNSS, or should we test all GNSS which are set in the array and return a combined bool of it? I guess returning the array with updated values would be most versatile approach, but of course requires additional checks in user code. Will do some tests with the chip and provide the code later |
The terminator is not strictly necessary, but it makes it easy to define the correct size for the array. If you have time, please do submit another pull request. I am happy to write the new code but I am busy with another major project. It may be ~two weeks before I have time to work on it. |
Subject of the issue
The functions for getting/setting the GNSS enabling take a variable of type enum sfe_ublox_gnss_ids_e
However, the implementation indicates a little different use with combined values of this type. So if you want to enable GPS and Galileo you would send SFE_UBLOX_GNSS_ID_GPS | SFE_UBLOX_GNSS_ID_GALILEO but this will result in a warning as this combined value is not a member of the enum. So I'd suggest to change the type to int. As the functions check the actual values anyway, it would not matter if illegal combinations are sent.
However, the isGNSSenabled function does check for all values being set in the parameter, but the result only shows if at least one of those values is enabled. I guess that's not meant, as in that case the true value could immediately be returned. Instead, you should return false immediately if one of the values is not set. That way, all values are properly checked for all being activated.
There is no specific board or module required, it's just being based on code review.
Expected behavior
OR combined enum values should be accepted, as code already deals with it
check for being enabled should return true only if all OR combined GNSS types are activated
Actual behavior
compiler raises warning/error with OR combination
Check function returns true if at least one type is activated
The text was updated successfully, but these errors were encountered: