Skip to content

Commit

Permalink
Disable HW handshaking by default
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrankin committed Apr 22, 2024
1 parent 301a75c commit 36d0462
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 11 additions & 7 deletions asrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (

// Device models a serial device and implements the ivi.Driver interface.
type Device struct {
EndMark byte
DelayTime time.Duration
port serial.Port
EndMark byte
HWHandshaking bool
DelayTime time.Duration
port serial.Port
}

// NewDevice opens a serial Device using the given VISA address resource string.
Expand All @@ -45,9 +46,10 @@ func NewDevice(address string) (*Device, error) {
}

return &Device{
port: port,
EndMark: '\n',
DelayTime: 70 * time.Millisecond,
port: port,
HWHandshaking: false,
EndMark: '\n',
DelayTime: 70 * time.Millisecond,
}, nil
}

Expand All @@ -74,7 +76,9 @@ func (d *Device) WriteString(s string) (n int, err error) {
// Command sends the SCPI/ASCII command to the underlying network connection. A
// newline character is automatically added to the end of the string.
func (d *Device) Command(format string, a ...any) error {
d.napIfDataSetNotReady()
if d.HWHandshaking {
d.napIfDataSetNotReady()
}
cmd := format
if a != nil {
cmd = fmt.Sprintf(format, a...)
Expand Down
2 changes: 2 additions & 0 deletions examples/keysight/e3631a/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func main() {
}
defer dev.Close()

dev.HWHandshaking = true

// Query the identification of the function generator.
idn, err := dev.Query("*IDN?\r\n")
if err != nil && err != io.EOF {
Expand Down

0 comments on commit 36d0462

Please sign in to comment.