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
409c760c
There was a problem fetching the pipeline summary.
Commit
409c760c
authored
Jan 31, 2017
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Add time setting function.
parent
7a6589b4
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/geiger/geiger.go
+3
-2
3 additions, 2 deletions
devices/geiger/geiger.go
devices/geiger/gqgmc.go
+21
-34
21 additions, 34 deletions
devices/geiger/gqgmc.go
with
24 additions
and
36 deletions
devices/geiger/geiger.go
+
3
−
2
View file @
409c760c
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
package
geiger
package
geiger
import
"time"
// New creates a new Counter instance
// New creates a new Counter instance
func
New
(
c
Config
)
(
Counter
,
error
)
{
func
New
(
c
Config
)
(
Counter
,
error
)
{
switch
c
.
Model
{
switch
c
.
Model
{
...
@@ -32,8 +34,7 @@ type Counter interface {
...
@@ -32,8 +34,7 @@ type Counter interface {
GetConfiguration
()
GetConfiguration
()
SetConfiguration
()
SetConfiguration
()
ResetConfiguration
()
ResetConfiguration
()
SetDate
(
date
string
)
SetTime
(
t
time
.
Time
)
SetTime
(
time
string
)
}
}
// Config contain the configuration for a Geiger Counter
// Config contain the configuration for a Geiger Counter
...
...
This diff is collapsed.
Click to expand it.
devices/geiger/gqgmc.go
+
21
−
34
View file @
409c760c
...
@@ -268,41 +268,28 @@ func (gc *GQGMCCounter) ResetConfiguration() {
...
@@ -268,41 +268,28 @@ func (gc *GQGMCCounter) ResetConfiguration() {
//communicate(erase_cfg_cmd, ret_char, retsize);
//communicate(erase_cfg_cmd, ret_char, retsize);
}
}
// SetDate sets the date - format of YYYYMMDD
// SetTime sets the time
func
(
gc
*
GQGMCCounter
)
SetDate
(
date
string
)
{
func
(
gc
*
GQGMCCounter
)
SetTime
(
t
time
.
Time
)
{
//setMonthCmd = "<SETDATEMM";
cmd
:=
make
([]
byte
,
13
)
//setMonthCmd += uint8_t(month);
var
timeCmds
=
[]
struct
{
//setMonthCmd += ">>";
cmd
string
//communicate(setMonthCmd, ret_char, retsize);
unit
int
}{
//setDayCmd = "<SETDATEDD";
{
"<SETDATEYY"
,
t
.
Year
()},
//setDayCmd += uint8_t(day);
{
"<SETDATEMM"
,
int
(
t
.
Month
())},
//setDayCmd += ">>";
{
"<SETDATEDD"
,
t
.
Day
()},
//communicate(setDayCmd, ret_char, retsize);
{
"<SETTIMEHH"
,
t
.
Hour
()},
{
"<SETTIMEMM"
,
t
.
Minute
()},
// year - last two digits
{
"<SETTIMESS"
,
t
.
Second
()},
//setYearCmd = "<SETDATEYY";
}
//setYearCmd += uint8_t(year);
//setYearCmd += ">>";
for
_
,
c
:=
range
timeCmds
{
//communicate(setYearCmd, ret_char, retsize);
copy
(
cmd
[
:
],
c
.
cmd
)
}
cmd
[
10
]
=
uint8
(
c
.
unit
)
copy
(
cmd
[
11
:
],
">>"
)
// SetTime sets the time (HH:MM:SS)
gc
.
port
.
Write
(
cmd
)
func
(
gc
*
GQGMCCounter
)
SetTime
(
time
string
)
{
gc
.
readCmd
(
1
)
//setHourCmd = "<SETTIMEHH";
}
//setHourCmd += uint8_t(hour);
//setHourCmd += ">>";
//communicate(setHourCmd, ret_char, retsize);
//setMinuteCmd = "<SETTIMEMM";
//setMinuteCmd += uint8_t(minute);
//setMinuteCmd += ">>";
//communicate(setMinuteCmd, ret_char, retsize);
//setSecondCmd = "<SETTIMESS";
//setSecondCmd += uint8_t(second);
//setSecondCmd += ">>";
//communicate(setSecondCmd, ret_char, retsize);
}
}
func
(
gc
*
GQGMCCounter
)
communicate
(
cmd
string
,
length
uint32
)
([]
byte
,
error
)
{
func
(
gc
*
GQGMCCounter
)
communicate
(
cmd
string
,
length
uint32
)
([]
byte
,
error
)
{
...
...
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