Skip to content

Commit

Permalink
Code enhancements after linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
itschleemilch committed Jul 18, 2018
1 parent 2caf196 commit a4960ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion v1/vfdio/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

// vfdio contains the Huanyango library. It can control a Huanyang VFD via RS485.
// Package vfdio contains the Huanyango library. It can control a Huanyang VFD via RS485.
package vfdio
8 changes: 4 additions & 4 deletions v1/vfdio/inverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewVfd() *HyInverter {
return &HyInverter{}
}

// Inits a serial port handle and creates all required goroutines.
// Open inits a serial port handle and creates all required goroutines.
// Param portName: OS specific refence to a serial port (examples - Windows: COM3, Linux: /dev/ttyUSB0).
// Param maxRpm: Maximum allowed and outputed rpm - for instance 11520 /min.
// Param rpmToHertz: This constant is used to calculate the set frequency for the VFD. If unknown, set
Expand Down Expand Up @@ -78,6 +78,7 @@ func (o *HyInverter) Open(portName string, maxRpm uint16, rpmToHertz float64, rp

// GCode is the external control input. It accepts string messages in the standard G-Code format.
// Accepted commands: M2, M3, M4, M5, Sxxx. Aliases for M5: M0, M1, M30, M60.
// Returns true if the command stack has space for the new input.
func (o *HyInverter) GCode(cmd string) (ok bool) {
subCmds := strings.Fields(cmd) // splits by whitespace
for _, subCmd := range subCmds {
Expand Down Expand Up @@ -136,7 +137,7 @@ func outFrequencyRequester(handle *HyInverter, pollInterval int64) {
}

func parser(handle *HyInverter) {
modbusRtu := make([]byte, 0)
var modbusRtu []byte = make([]byte, 0)
lastRead := time.Now()
rxBuf := make([]byte, 10)
for !handle.stop {
Expand Down Expand Up @@ -188,9 +189,8 @@ func (o *HyInverter) Online() bool {
rxDiff := time.Now().Sub(o.lastReceived)
if rxDiff.Seconds() < 2*o.pollIntervalSec {
return true
} else {
return false
}
return false
}

func (o *HyInverter) initCRC() {
Expand Down

0 comments on commit a4960ee

Please sign in to comment.