Skip to content

Conversation

@wbrannon
Copy link
Contributor

New Features

  • Added new GNSSSignalType enum definition, as well as additional signal name enums and other helper functions
    • C++ and Python definitions are auto-generated from the constants defined in the Python signal_defs.py file
  • Added new GNSSSignalsMessage message

Changes

  • GNSSSatelliteMessage is now deprecated in favor of GNSSSignalsMessagev

@wbrannon wbrannon requested a review from adamshapiro0 January 14, 2026 18:33
@wbrannon wbrannon self-assigned this Jan 14, 2026
* @return The corresponding string name.
*/
P1_CONSTEXPR_FUNC const char* to_string(SatelliteType type) {
P1_CONSTEXPR_FUNC const char* to_string(GNSSSignalType type) {

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 178 lines.

Copilot Autofix

AI 3 days ago

In general, to fix a “poorly documented large function” warning, you increase meaningful documentation density: add a more detailed function‑level comment describing behavior, invariants, edge cases, and maintenance expectations, and, if useful, a small number of inline comments to highlight non-obvious logic. You avoid redundant comments that simply restate what each line of code already expresses.

For this function, the best fix without altering functionality is:

  • Expand the existing Doxygen block above to_string(GNSSSignalType type) to describe:
    • That the function maps each GNSSSignalType to a stable, human‑readable identifier.
    • That it must be kept in sync with the GNSSSignalType enum definition.
    • What happens for unknown or unsupported values (returns "INVALID").
    • Any usage notes (e.g., suitable for logging, not for user‑facing localization).
  • Add a brief inline comment near the switch and/or the default return explaining that "INVALID" is a fallback for values not covered in the switch and that the mapping is intentionally exhaustive.

All changes are confined to src/point_one/fusion_engine/messages/signal_defs.h around lines 1324–1508. No new methods, imports, or definitions are needed; only comments are added.

Suggested changeset 1
src/point_one/fusion_engine/messages/signal_defs.h

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/point_one/fusion_engine/messages/signal_defs.h b/src/point_one/fusion_engine/messages/signal_defs.h
--- a/src/point_one/fusion_engine/messages/signal_defs.h
+++ b/src/point_one/fusion_engine/messages/signal_defs.h
@@ -1324,11 +1324,26 @@
 /**
  * @brief Get a string representation of the @ref GNSSSignalType enum value.
  *
+ * This function converts a @ref GNSSSignalType value to a stable, human-readable
+ * identifier string intended for logging, debugging, and serialization of
+ * signal types. The returned strings are meant to closely match the enum
+ * identifiers and are not localized.
+ *
+ * @note When new values are added to @ref GNSSSignalType, this function must
+ *       be updated to keep the mapping exhaustive. Callers should not rely on
+ *       any implicit ordering, only on the string labels documented here.
+ *
+ * Any value not explicitly handled by the switch statement below will result
+ * in the fallback string "INVALID", which indicates an unknown or unsupported
+ * signal type.
+ *
  * @param type The enum to get the string name for.
  *
- * @return The corresponding string name.
+ * @return The corresponding string name, or "INVALID" if @p type is not
+ *         recognized.
  */
 P1_CONSTEXPR_FUNC const char* to_string(GNSSSignalType type) {
+  // Maintain this switch in sync with the GNSSSignalType enum definition.
   switch (type) {
     case GNSSSignalType::GPS_L1CA:
       return "GPS_L1CA";
@@ -1504,6 +1515,7 @@
     case GNSSSignalType::UNKNOWN:
       return "UNKNOWN";
   }
+  // Fallback for unknown or unsupported GNSSSignalType values.
   return "INVALID";
 }
 
EOF
@@ -1324,11 +1324,26 @@
/**
* @brief Get a string representation of the @ref GNSSSignalType enum value.
*
* This function converts a @ref GNSSSignalType value to a stable, human-readable
* identifier string intended for logging, debugging, and serialization of
* signal types. The returned strings are meant to closely match the enum
* identifiers and are not localized.
*
* @note When new values are added to @ref GNSSSignalType, this function must
* be updated to keep the mapping exhaustive. Callers should not rely on
* any implicit ordering, only on the string labels documented here.
*
* Any value not explicitly handled by the switch statement below will result
* in the fallback string "INVALID", which indicates an unknown or unsupported
* signal type.
*
* @param type The enum to get the string name for.
*
* @return The corresponding string name.
* @return The corresponding string name, or "INVALID" if @p type is not
* recognized.
*/
P1_CONSTEXPR_FUNC const char* to_string(GNSSSignalType type) {
// Maintain this switch in sync with the GNSSSignalType enum definition.
switch (type) {
case GNSSSignalType::GPS_L1CA:
return "GPS_L1CA";
@@ -1504,6 +1515,7 @@
case GNSSSignalType::UNKNOWN:
return "UNKNOWN";
}
// Fallback for unknown or unsupported GNSSSignalType values.
return "INVALID";
}

Copilot is powered by AI and may make mistakes. Always verify output.
*
* @return The corresponding string.
*/
P1_CONSTEXPR_FUNC const char* ToPrettyString(GNSSSignalType type) {

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 178 lines.

Copilot Autofix

AI 3 days ago

In general, to fix this type of issue, you increase the amount and quality of comments in the large function so that its intent, structure, and any non-obvious design choices are clear. The goal is not to comment every line, but to provide enough documentation that a maintainer can quickly understand how the function is organized and how to safely add or modify cases.

For ToPrettyString(GNSSSignalType type) in src/point_one/fusion_engine/messages/signal_defs.h, the best fix without changing functionality is:

  • Keep the existing brief Doxygen comment as-is.
  • Add a short, high-level comment at the top of the function body explaining that it maps each GNSSSignalType to a concise, human-friendly label suitable for logs/UI, and that the mapping must stay in sync with the enum definition.
  • Within the switch, add block comments to delineate logical groups of signals (e.g., GPS, GLONASS, Galileo, BeiDou, SBAS, etc.), assuming the cases are already grouped that way. This improves readability and makes it clearer where to add new cases for a given constellation.
  • Optionally add a brief comment near the return "Invalid"; line explaining when that fallback is used (i.e., unknown/unhandled enum values).

These changes are all within the shown snippet, require no new imports or definitions, and preserve existing behavior. Only the lines inside the ToPrettyString function need to be updated to insert comments; no signatures, types, or logic are altered.

Suggested changeset 1
src/point_one/fusion_engine/messages/signal_defs.h

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/point_one/fusion_engine/messages/signal_defs.h b/src/point_one/fusion_engine/messages/signal_defs.h
--- a/src/point_one/fusion_engine/messages/signal_defs.h
+++ b/src/point_one/fusion_engine/messages/signal_defs.h
@@ -1528,7 +1528,16 @@
  * @return The corresponding string.
  */
 P1_CONSTEXPR_FUNC const char* ToPrettyString(GNSSSignalType type) {
+  // NOTE:
+  // - This function maps each GNSSSignalType enum value to a concise,
+  //   human-readable label for logs, debugging output, and user interfaces.
+  // - The mappings here should be kept in sync with the GNSSSignalType
+  //   definition above. When adding a new signal type, add a corresponding
+  //   pretty-print string in the appropriate constellation section below.
   switch (type) {
+    //
+    // GPS signals.
+    //
     case GNSSSignalType::GPS_L1CA:
       return "GPS C/A";
 
@@ -1703,6 +1711,7 @@
     case GNSSSignalType::UNKNOWN:
       return "Unknown";
   }
+  // Fallback for unknown or unsupported GNSSSignalType values.
   return "Invalid";
 }
 
EOF
@@ -1528,7 +1528,16 @@
* @return The corresponding string.
*/
P1_CONSTEXPR_FUNC const char* ToPrettyString(GNSSSignalType type) {
// NOTE:
// - This function maps each GNSSSignalType enum value to a concise,
// human-readable label for logs, debugging output, and user interfaces.
// - The mappings here should be kept in sync with the GNSSSignalType
// definition above. When adding a new signal type, add a corresponding
// pretty-print string in the appropriate constellation section below.
switch (type) {
//
// GPS signals.
//
case GNSSSignalType::GPS_L1CA:
return "GPS C/A";

@@ -1703,6 +1711,7 @@
case GNSSSignalType::UNKNOWN:
return "Unknown";
}
// Fallback for unknown or unsupported GNSSSignalType values.
return "Invalid";
}

Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Collaborator

@adamshapiro0 adamshapiro0 left a comment

Choose a reason for hiding this comment

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

Looks good.

@wbrannon wbrannon merged commit 6cee57f into master Jan 14, 2026
17 checks passed
@wbrannon wbrannon deleted the update-signal-msg branch January 14, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants