Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
7fe7780c
Commit
7fe7780c
authored
Jan 09, 2015
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restarting work on GPS tracking
parent
2fdff57b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
gpsbkgnd_task.c
sw/freewatch/src/gpsbkgnd_task.c
+31
-22
No files found.
sw/freewatch/src/gpsbkgnd_task.c
View file @
7fe7780c
...
...
@@ -50,12 +50,13 @@ static int firstrun, firstfix;
static
int
gpson
,
pgpson
;
static
int
track
,
ptrack
;
static
void
gps_set_time
();
static
void
gps_track
();
static
void
gpsbkgnd_task
(
void
*
params
)
{
(
void
)
params
;
struct
event
e
;
struct
tm
time
;
struct
gps_utc
gpstime
;
/* Previous and current state of GPS ON setting */
pgpson
=
gpson
;
...
...
@@ -74,26 +75,10 @@ static void gpsbkgnd_task(void *params)
return
;
}
/* Set time from GPS at first fix or midday */
if
(
setting_get
(
&
setting_gps_sets_time
)
&&
gps_fixed
())
{
time
=
clock_get_time
();
if
(
firstfix
||
((
time
.
tm_hour
==
12
)
&&
(
time
.
tm_min
==
0
)))
{
gps_get_utc
(
&
gpstime
);
time
.
tm_year
=
gpstime
.
yr
;
time
.
tm_mon
=
gpstime
.
mon
;
time
.
tm_mday
=
gpstime
.
day
;
time
.
tm_hour
=
gpstime
.
hr
+
setting_get
(
&
setting_gmt_ofs_hr
);
time
.
tm_min
=
gpstime
.
min
+
setting_get
(
&
setting_gmt_ofs_min
);
time
.
tm_sec
=
gpstime
.
sec
;
time
.
tm_isdst
=
0
;
clock_set_time
(
&
time
);
}
if
(
firstfix
)
firstfix
=
0
;
/* Set time and track according to setting */
if
(
gps_fixed
())
{
if
(
setting_get
(
&
setting_gps_sets_time
))
gps_set_time
();
}
if
(
firstrun
)
...
...
@@ -114,3 +99,27 @@ void gpsbkgnd_init()
xTimerStart
(
timerGps
,
0
);
}
static
void
gps_set_time
()
{
struct
tm
time
;
struct
gps_utc
gpstime
;
time
=
clock_get_time
();
if
(
firstfix
||
((
time
.
tm_hour
==
12
)
&&
(
time
.
tm_min
==
0
)))
{
gps_get_utc
(
&
gpstime
);
time
.
tm_year
=
gpstime
.
yr
;
time
.
tm_mon
=
gpstime
.
mon
;
time
.
tm_mday
=
gpstime
.
day
;
time
.
tm_hour
=
gpstime
.
hr
+
setting_get
(
&
setting_gmt_ofs_hr
);
time
.
tm_min
=
gpstime
.
min
+
setting_get
(
&
setting_gmt_ofs_min
);
time
.
tm_sec
=
gpstime
.
sec
;
time
.
tm_isdst
=
0
;
clock_set_time
(
&
time
);
}
if
(
firstfix
)
firstfix
=
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment