Skip to content

Make GTU7 output channel buffer size configurable#19

Merged
rustyeddy merged 3 commits intogtu7from
copilot/sub-pr-16-another-one
Jan 16, 2026
Merged

Make GTU7 output channel buffer size configurable#19
rustyeddy merged 3 commits intogtu7from
copilot/sub-pr-16-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 16, 2026

The GTU7 sensor hardcoded its output channel buffer to 4, which is insufficient for GPS modules outputting at 1-10 Hz when consumers are slow.

Changes

  • Added Buf int field to GTU7Config with default of 16
  • Updated NewGTU7 to use configurable buffer size
  • Added tests verifying default and custom buffer behavior

Follows the existing pattern from VH400Config:

type GTU7Config struct {
    Name    string
    Serial  drivers.SerialConfig
    Factory drivers.SerialFactory
    
    // Buf sizes the out channel. Default 16.
    Buf int
    
    // Test injection
    Reader io.Reader
}

Usage:

// Use default buffer of 16
gps := NewGTU7(GTU7Config{Serial: cfg})

// Or customize for high-rate GPS
gps := NewGTU7(GTU7Config{Serial: cfg, Buf: 32})

✨ 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:40
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 implementation for Gtu7 sensor and serial drivers Make GTU7 output channel buffer size configurable Jan 16, 2026
Copilot AI requested a review from rustyeddy January 16, 2026 17:42
@rustyeddy rustyeddy marked this pull request as ready for review January 16, 2026 17:53
Copilot AI review requested due to automatic review settings January 16, 2026 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the GTU7 GPS sensor output channel buffer size configurable, replacing the hardcoded 4-element buffer with a configurable Buf field that defaults to 16. This addresses GPS data loss issues when modules output at 1-10 Hz with slow consumers.

Changes:

  • Added configurable Buf field to GTU7Config with default value of 16
  • Removed unused dependencies (maciej/bme280, nfnt/resize, golang.org/x/image) that are only referenced in archived code
  • Added comprehensive tests for buffer size configuration

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
sensors/gtu7.go Added Buf field to config and logic to default to 16 when value is ≤ 0
sensors/gtu7_test.go Added comprehensive tests for default, custom, zero, and negative buffer sizes
go.mod Removed unused direct dependencies and promoted golang.org/x/sys from indirect to direct
go.sum Removed checksums for unused dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rustyeddy rustyeddy merged commit 57d355b into gtu7 Jan 16, 2026
6 checks passed
@rustyeddy rustyeddy deleted the copilot/sub-pr-16-another-one branch January 16, 2026 17:59
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