Skip to content

Extract duplicated knots-to-MPS conversion constant#31

Closed
Copilot wants to merge 3 commits intogtu7from
copilot/sub-pr-16-34229fec-bf2b-4cd8-86e4-46aa34a3056b
Closed

Extract duplicated knots-to-MPS conversion constant#31
Copilot wants to merge 3 commits intogtu7from
copilot/sub-pr-16-34229fec-bf2b-4cd8-86e4-46aa34a3056b

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 16, 2026

The conversion factor 0.514444 (knots to meters per second) was duplicated in two NMEA parsing functions, violating DRY and obscuring intent.

Changes:

  • Extracted knotsToMPS = 0.514444 as a package-level constant in sensors/gtu7.go
  • Updated parseGPRMC and parseGPVTG to use the named constant

Before:

fix.SpeedMPS = v * 0.514444  // Repeated in two functions

After:

const knotsToMPS = 0.514444

// In parseGPRMC and parseGPVTG:
fix.SpeedMPS = v * knotsToMPS

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 16, 2026 17:59
Co-authored-by: rustyeddy <2903425+rustyeddy@users.noreply.github.com>
Co-authored-by: rustyeddy <2903425+rustyeddy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Gtu7 sensor and serial drivers integration based on feedback Extract duplicated knots-to-MPS conversion constant Jan 16, 2026
Copilot AI requested a review from rustyeddy January 16, 2026 18:01
@rustyeddy rustyeddy closed this Jan 17, 2026
@rustyeddy rustyeddy deleted the copilot/sub-pr-16-34229fec-bf2b-4cd8-86e4-46aa34a3056b branch January 17, 2026 16:34
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.

2 participants