Skip to content
Snippets Groups Projects
Commit da2b152e authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Flesh it out more.

parent 85158cc3
Branches
No related tags found
No related merge requests found
Pipeline #
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package geiger package geiger
import ( import (
"errors"
"fmt" "fmt"
"time" "time"
...@@ -356,17 +357,13 @@ func (gc *GQGMCCounter) sendCmd(cmd []byte) { ...@@ -356,17 +357,13 @@ func (gc *GQGMCCounter) sendCmd(cmd []byte) {
} }
func (gc *GQGMCCounter) readCmdReturn(length uint32) ([]byte, error) { func (gc *GQGMCCounter) readCmdReturn(length uint32) ([]byte, error) {
// Now read the returned raw byte string. Do this by reading one byte buf := make([]byte, length)
// at a time until the requested number of bytes are attained. However, n, err := gc.port.Read(buf)
// the serial port has been setup to timeout each read attempt. So if if err != nil {
// after N calls to read, we haven't yet read all N bytes, declare return nil, err
// a failure. The read is done this way to avoid an indefinite blocking }
// situation when 0 bytes are returned by the GQ GMC. The only good thing if uint32(n) != length {
// about this methodology is that the largest possible read is only 4K return nil, errors.New("Short read")
// for the history data. So the read never really takes that much time. }
//for(uint32_t i=0; i<retbytes; i++) return buf, nil
// rcvd += read(mUSB_serial, inp, 1);
// inp = &retdata[rcvd];
// if (rcvd >= retbytes) break;
return nil, nil
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment