Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gqgmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
gqgmc
Commits
24382813
There was a problem fetching the pipeline summary.
Commit
24382813
authored
Jan 31, 2017
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Rework version.
parent
b5e0ca3f
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmd/gqgmc/main.go
+3
-7
3 additions, 7 deletions
cmd/gqgmc/main.go
devices/geiger/geiger.go
+3
-1
3 additions, 1 deletion
devices/geiger/geiger.go
devices/geiger/gqgmc.go
+26
-6
26 additions, 6 deletions
devices/geiger/gqgmc.go
with
32 additions
and
14 deletions
cmd/gqgmc/main.go
+
3
−
7
View file @
24382813
...
@@ -20,7 +20,6 @@ func main() {
...
@@ -20,7 +20,6 @@ func main() {
volts
int16
volts
int16
ser
string
ser
string
err
error
err
error
ver
string
t
time
.
Time
t
time
.
Time
)
)
...
@@ -54,12 +53,9 @@ func main() {
...
@@ -54,12 +53,9 @@ func main() {
}
}
fmt
.
Printf
(
"CPS: %d
\n
"
,
cps
)
fmt
.
Printf
(
"CPS: %d
\n
"
,
cps
)
ver
,
err
=
gc
.
Version
()
fmt
.
Printf
(
"Version: %s
\n
"
,
gc
.
Version
())
if
err
!=
nil
{
fmt
.
Printf
(
"Short Version: %s
\n
"
,
gc
.
Ver
())
fmt
.
Printf
(
"Failed: '%s'
\n
"
,
err
)
fmt
.
Printf
(
"Model: %s
\n
"
,
gc
.
Model
())
return
}
fmt
.
Printf
(
"Version: %s
\n
"
,
ver
)
ser
,
err
=
gc
.
SerialNum
()
ser
,
err
=
gc
.
SerialNum
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
devices/geiger/geiger.go
+
3
−
1
View file @
24382813
...
@@ -21,7 +21,9 @@ func New(c Config) (Counter, error) {
...
@@ -21,7 +21,9 @@ func New(c Config) (Counter, error) {
// Counter is an interface for Geiger Counters
// Counter is an interface for Geiger Counters
type
Counter
interface
{
type
Counter
interface
{
Clear
()
error
Clear
()
error
Version
()
(
string
,
error
)
Model
()
string
Version
()
string
Ver
()
string
SerialNum
()
(
string
,
error
)
SerialNum
()
(
string
,
error
)
GetCPM
()
(
uint16
,
error
)
GetCPM
()
(
uint16
,
error
)
GetCPS
()
(
uint16
,
error
)
GetCPS
()
(
uint16
,
error
)
...
...
This diff is collapsed.
Click to expand it.
devices/geiger/gqgmc.go
+
26
−
6
View file @
24382813
...
@@ -123,21 +123,32 @@ const (
...
@@ -123,21 +123,32 @@ const (
type
GQGMCCounter
struct
{
type
GQGMCCounter
struct
{
port
*
serial
.
Port
port
*
serial
.
Port
config
*
serial
.
Config
config
*
serial
.
Config
version
,
shortVer
,
model
string
}
}
// NewGQGMC creates a new GQGMC Counter instance
// NewGQGMC creates a new GQGMC Counter instance
func
NewGQGMC
(
c
Config
)
(
*
GQGMCCounter
,
error
)
{
func
NewGQGMC
(
c
Config
)
(
*
GQGMCCounter
,
error
)
{
cfg
:=
serial
.
Config
{
var
gc
GQGMCCounter
var
v
[]
byte
gc
.
config
=
&
serial
.
Config
{
Name
:
c
.
Device
,
Name
:
c
.
Device
,
Baud
:
57600
,
Baud
:
57600
,
ReadTimeout
:
500
*
time
.
Millisecond
,
ReadTimeout
:
500
*
time
.
Millisecond
,
}
}
p
,
err
:=
serial
.
OpenPort
(
&
cf
g
)
p
,
err
:=
serial
.
OpenPort
(
gc
.
confi
g
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
gc
.
port
=
p
v
,
err
=
gc
.
communicate
(
cmdGetVersion
,
14
)
gc
.
model
=
string
(
v
[
:
6
])
gc
.
version
=
string
(
v
[
7
:
])
gc
.
shortVer
=
string
(
v
[
10
:
])
//getConfigurationData()
//getConfigurationData()
return
&
GQGMCCounter
{
port
:
p
,
config
:
&
cfg
}
,
nil
return
&
gc
,
nil
}
}
// Clear clears out any remaining data
// Clear clears out any remaining data
...
@@ -153,9 +164,18 @@ func (gc *GQGMCCounter) Clear() error {
...
@@ -153,9 +164,18 @@ func (gc *GQGMCCounter) Clear() error {
}
}
// Version gets the version of the device
// Version gets the version of the device
func
(
gc
*
GQGMCCounter
)
Version
()
(
string
,
error
)
{
func
(
gc
*
GQGMCCounter
)
Version
()
string
{
ver
,
err
:=
gc
.
communicate
(
cmdGetVersion
,
14
)
return
gc
.
version
return
string
(
ver
),
err
}
// 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
}
}
// SerialNum gets the serial number of the device
// SerialNum gets the serial number of the device
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment