diff --git a/cmd/gqgmc/main.go b/cmd/gqgmc/main.go index 626c58a7db47dc0b46e6bea474f23ae83a9cd68c..3f0f70078988d246f0f9166c6d27f2cc28ae3660 100644 --- a/cmd/gqgmc/main.go +++ b/cmd/gqgmc/main.go @@ -54,7 +54,6 @@ func main() { fmt.Printf("CPS: %d\n", cps) fmt.Printf("Version: %s\n", gc.Version()) - fmt.Printf("Short Version: %s\n", gc.Ver()) fmt.Printf("Model: %s\n", gc.Model()) ser, err = gc.SerialNum() diff --git a/devices/geiger/geiger.go b/devices/geiger/geiger.go index 9c2d73165196a4714cc2fd02d05e5a76a066841e..8dcc5c847f7f41bf12386aab74c0fd12cd7f1754 100644 --- a/devices/geiger/geiger.go +++ b/devices/geiger/geiger.go @@ -23,7 +23,6 @@ type Counter interface { Clear() error Model() string Version() string - Ver() string SerialNum() (string, error) GetCPM() (uint16, error) GetCPS() (uint16, error) @@ -35,7 +34,6 @@ type Counter interface { TurnOffPower() GetConfiguration() SetConfiguration() - ResetConfiguration() SetTime(time.Time) GetTime() (time.Time, error) FactoryReset() diff --git a/devices/geiger/gqgmc.go b/devices/geiger/gqgmc.go index 1058bdaf82232773b9fc18c2671f1f372bd57808..4fc3b13649afa0fbfba09b3deafc335f55cf7442 100644 --- a/devices/geiger/gqgmc.go +++ b/devices/geiger/gqgmc.go @@ -22,84 +22,6 @@ const ( VoltageTooLow = 75 ) -const ( - powerOnOff = 0 - alarmOnOff = 1 - speakerOnOff = 2 - graphicModeOnOff = 3 - backlightTimeoutSeconds = 4 - idleTitleDisplayMode = 5 - alarmCPMValue = 6 - calibrationCPM0 = 8 - calibrationSvUc0 = 10 - calibrationCPM1 = 14 - calibrationSvUc1 = 16 - calibrationCPM2 = 20 - calibrationSvUc2 = 22 - idleDisplayMode = 26 - alarmValueuSvUc = 27 - alarmType = 31 - saveDataType = 32 - swivelDisplay = 33 - zoom = 34 - dataSaveAddress = 38 - dataReadAddress = 41 - nPowerSavingMode = 44 - nSensitivityMode = 45 - nCounterDelay = 46 - nVoltageOffset = 48 - maxCPM = 49 - nSensitivityAutoModeThreshold = 51 - saveDate = 52 - saveTime = 55 - maxBytes = 58 -) - -var configBytes = map[int]int{ - powerOnOff: 1, - alarmOnOff: 1, - speakerOnOff: 1, - graphicModeOnOff: 1, - backlightTimeoutSeconds: 1, - idleTitleDisplayMode: 1, - alarmCPMValue: 2, - calibrationCPM0: 2, - calibrationSvUc0: 4, - calibrationCPM1: 2, - calibrationSvUc1: 4, - calibrationCPM2: 2, - calibrationSvUc2: 4, - idleDisplayMode: 1, - alarmValueuSvUc: 4, - alarmType: 1, - saveDataType: 1, - swivelDisplay: 1, - zoom: 4, - dataSaveAddress: 3, - dataReadAddress: 3, - nPowerSavingMode: 1, - nSensitivityMode: 1, - nCounterDelay: 2, - nVoltageOffset: 1, - maxCPM: 2, - nSensitivityAutoModeThreshold: 1, - saveDate: 3, - saveTime: 3, - maxBytes: 1, -} - -const ( - saveOff = iota - saveCPS - saveCPM - saveCPH - saveMax -) - -const ( - nvmSize = 256 -) - const ( cmdGetSerial = "<GETSERIAL>>" // GMC-280, GMC-300 Re.2.11 cmdGetVersion = "<GETVER>>" // GMC-280, GMC-300 Re.2.0x, Re.2.10 @@ -109,7 +31,7 @@ const ( cmdGetCfg = "<GETCFG>>" // GMC-280, GMC-300 Re.2.10 cmdEraseCfg = "<ECFG>>" // GMC-280, GMC-300 Re.2.10 cmdUpdateCfg = "<CFGUPDATE>>" // GMC-280, GMC-300 Re.2.20 - cmdTurnOnCPS = "<HEARTBEAT1>>" // GMC-280, GMC-300 Re.2.10 + cmdTurnOnCPS = "<HEARTBEAT1>>" // GMC-280, GMC-300 Re.2.10 cmdTurnOffCPS = "<HEARTBEAT0>>" // Re.2.10 cmdTurnOffPwr = "<POWEROFF>>" // GMC-280, GMC-300 Re.2.11 cmdTurnOnPwr = "<POWERON>>" // GMC-280, GMC-300 Re.3.10 @@ -125,7 +47,6 @@ type GQGMCCounter struct { port *serial.Port config *serial.Config version, - shortVer, model string } @@ -147,7 +68,6 @@ func NewGQGMC(c Config) (*GQGMCCounter, error) { v, err = gc.communicate(cmdGetVersion, 14) gc.model = string(v[:7]) gc.version = string(v[7:]) - gc.shortVer = string(v[10:]) //getConfigurationData() return &gc, nil } @@ -169,11 +89,6 @@ func (gc *GQGMCCounter) Version() string { return gc.version } -// Ver gets the short version of the device -func (gc *GQGMCCounter) Ver() string { - return gc.shortVer -} - // Model gets the model of the device func (gc *GQGMCCounter) Model() string { return gc.model @@ -238,19 +153,6 @@ func (gc *GQGMCCounter) GetHistoryData() { // TurnOnCPS turns on CPS collection func (gc *GQGMCCounter) TurnOnCPS() error { - // turnOnCPS is public method to enable automatic reporting of the - // count per second (CPS) value. First, I would say don't use this - // command. Since the returned data has no protocol, that is, there - // is no start/stop marker, no identification, no nothing but a - // sequence of bytes, any other command issued while CPS is turned on - // will take extraordinary effort not to confuse its returned data - // with the CPS data. To handle it correctly, you would have to - // wait for the CPS data to be returned, and then issue the command. - // This would be most safely done by creating a new thread to - // read the CPS and using a mutex to signal opportunity to issue a - // separate command. The command is turn_on_cps_cmd - // (see GQ GMC COMMANDS above). The returned data is always two - // bytes so that samples > 255 can be reported (even though unlikely). gc.sendCmd(cmdTurnOnCPS) return nil } @@ -287,8 +189,11 @@ func (gc *GQGMCCounter) TurnOffPower() { // GetConfiguration reads configuration data func (gc *GQGMCCounter) GetConfiguration() { - // Issue command to get configuration and read returned data. - // communicate(get_cfg_cmd, reinterpret_cast<char *>(&mCFG_Data), + cfg, err := gc.communicate(cmdGetCfg, 256) + if err != nil { + return + } + fmt.Printf("%+v\n", cfg) } // SetConfiguration writes configuration data @@ -296,13 +201,6 @@ func (gc *GQGMCCounter) SetConfiguration() { // See the ConfigurationData functions in gqgmc.cc } -// ResetConfiguration resets to factory default -func (gc *GQGMCCounter) ResetConfiguration() { - //uint32_t retsize = 1; - //char ret_char[retsize+1]; - //communicate(erase_cfg_cmd, ret_char, retsize); -} - // SetTime sets the time func (gc *GQGMCCounter) SetTime(t time.Time) { //command: <SETDATETIME[YYMMDDHHMMSS]>>