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
5f40efa3
Commit
5f40efa3
authored
Oct 07, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work towards track file naming, no particular progress
parent
87a0e9ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
gpsbkgnd_task.c
sw/freertos/src/gpsbkgnd_task.c
+25
-12
No files found.
sw/freertos/src/gpsbkgnd_task.c
View file @
5f40efa3
...
...
@@ -51,8 +51,9 @@ static xTimerHandle timerGps;
extern
xSemaphoreHandle
mutexSdCardAccess
;
static
int
firstrun
,
firstfix
;
static
int
cgpson
,
pgpson
;
static
int
ctrack
,
ptrack
;
static
int
gpson
,
pgpson
;
static
int
track
,
ptrack
;
static
int
open
=
0
;
static
FIL
f
;
static
FATFS
fatfs
;
...
...
@@ -72,14 +73,14 @@ static void gpsbkgnd_task(void *params)
char
buf
[
80
];
/* Previous and current state of settings */
pgpson
=
c
gpson
;
c
gpson
=
setting_get
(
&
setting_gps_on
);
pgpson
=
gpson
;
gpson
=
setting_get
(
&
setting_gps_on
);
/* Pulse GPS ON_OFF pin if setting changed */
if
((
pgpson
!=
c
gpson
)
&&
!
firstrun
)
if
((
pgpson
!=
gpson
)
&&
!
firstrun
)
gps_on_off_pulse
();
if
(
!
c
gpson
)
{
if
(
!
gpson
)
{
/* Turn off status bar icon if GPS turns off */
if
(
pgpson
)
{
e
.
type
=
GPS_OFF
;
...
...
@@ -111,34 +112,46 @@ static void gpsbkgnd_task(void *params)
}
/* Track GPS position if setting tells us to */
ptrack
=
c
track
;
c
track
=
setting_get
(
&
setting_tracking
);
if
(
c
track
)
{
ptrack
=
track
;
track
=
setting_get
(
&
setting_tracking
);
if
(
track
)
{
/* Init stuff
, open file
& take semaphore so that only we write to SD */
/* Init stuff & take semaphore so that only we write to SD */
if
(
firstrun
||
!
ptrack
)
{
xSemaphoreTake
(
mutexSdCardAccess
,
0
);
MICROSD_Init
();
disk_initialize
(
0
);
f_mount
(
0
,
&
fatfs
);
f_open
(
&
f
,
"
yellow
"
,
FA_CREATE_ALWAYS
|
FA_WRITE
);
f_open
(
&
f
,
"
blah
"
,
FA_CREATE_ALWAYS
|
FA_WRITE
);
f_lseek
(
&
f
,
0
);
open
=
1
;
}
/* Write to file if gps is fixed */
if
(
gps_fixed
())
{
// if (open) {
// open = 0;
// gps_get_utc(&gpstime);
// sprintf(buf, "track_%d-%d-%d_%dh%dm", 1900 + gpstime.yr,
// 1 + gpstime.mon, gpstime.day,
// gpstime.hr + setting_get(&setting_gmt_ofs_hr),
// gpstime.min + setting_get(&setting_gmt_ofs_min));
// f_open(&f, buf, FA_CREATE_ALWAYS | FA_WRITE);
// f_lseek(&f, 0);
// }
gps_get_coord
(
&
gpscoord
,
2
);
sprintf
(
buf
,
"%3.7f,%3.7f
\n
"
,
gpscoord
.
lat
,
gpscoord
.
lon
);
f_write
(
&
f
,
buf
,
strlen
(
buf
),
NULL
);
}
}
else
if
(
!
c
track
&&
ptrack
)
{
}
else
if
(
!
track
&&
ptrack
)
{
/*
* Turned off tracking setting => close file, deinit microsd driver and
* give mutex so that other tasks can use the SD card
*/
f_close
(
&
f
);
MICROSD_Deinit
();
open
=
1
;
xSemaphoreGive
(
mutexSdCardAccess
);
}
...
...
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