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
21c04678
Commit
21c04678
authored
Oct 04, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add locally configurable settings to settings menu
Tested with the GPS coordinate style in gpscoord.c
parent
833bddc8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
7 deletions
+27
-7
gpscoord.c
sw/freertos/src/apps/gpscoord.c
+5
-1
menu.c
sw/freertos/src/apps/menu.c
+9
-2
menu_struct.c
sw/freertos/src/apps/menu_struct.c
+6
-3
settings.c
sw/freertos/src/apps/settings/settings.c
+3
-1
settings.h
sw/freertos/src/apps/settings/settings.h
+4
-0
No files found.
sw/freertos/src/apps/gpscoord.c
View file @
21c04678
...
...
@@ -36,8 +36,10 @@
#include "application.h"
#include "settings/settings.h"
static
struct
gps_coord
coord
;
static
int
coord_format
=
1
;
static
int
coord_format
;
static
int
gpsscreen
=
0
;
static
void
gps_redraw
(
struct
ui_widget
*
w
)
...
...
@@ -50,6 +52,8 @@ static void gps_redraw(struct ui_widget *w)
float
lonmin
;
float
lonsec
;
coord_format
=
setting_coord_style
.
val
;
if
(
gps_fixed
())
gps_get_coord
(
&
coord
,
coord_format
);
...
...
sw/freertos/src/apps/menu.c
View file @
21c04678
...
...
@@ -28,6 +28,9 @@
#include "app_list.h"
#include "menu_struct.h"
#include "widgets/status_bar.h"
#include "settings/settings.h"
#include <stdio.h>
static
int
selected_item
=
0
;
static
int
offset
=
0
;
...
...
@@ -80,9 +83,13 @@ static void menu_screen_redraw(struct ui_widget *w)
gfx_text
(
&
w
->
dc
,
&
font_helv17
,
LEFT_MARGIN
,
i
*
LINE_HEIGHT
,
l
->
name
,
i
!=
selected_item
);
}
else
if
(
ent
->
type
==
SETTING
)
{
setting_t
*
s
=
ent
->
data
.
setting
;
char
s
[
16
];
setting_t
*
set
=
ent
->
data
.
setting
;
sprintf
(
s
,
"%s: %d"
,
set
->
name
,
set
->
val
);
// strcat(s, ": ")
// strcat(s, set->val);
gfx_text
(
&
w
->
dc
,
&
font_helv17
,
LEFT_MARGIN
,
i
*
LINE_HEIGHT
,
s
->
name
,
i
!=
selected_item
);
i
*
LINE_HEIGHT
,
s
,
i
!=
selected_item
);
}
}
}
...
...
sw/freertos/src/apps/menu_struct.c
View file @
21c04678
...
...
@@ -26,6 +26,7 @@
#include "menu_struct.h"
#include "app_list.h"
#include "settings/settings.h"
int
get_menu_size
(
const
menu_list
*
menu
)
{
int
len
=
0
;
...
...
@@ -40,9 +41,11 @@ int get_menu_size(const menu_list *menu) {
menu_list
settings_menu
=
{
"Settings"
,
{
{
APP
,
&
clock_icon
,
{
.
app
=
&
set_time
}
},
{
APP
,
&
date_icon
,
{
.
app
=
&
set_date
}
},
{
END
,
NULL
,
{
NULL
}
}
{
APP
,
&
clock_icon
,
{
.
app
=
&
set_time
}
},
{
APP
,
&
date_icon
,
{
.
app
=
&
set_date
}
},
{
SETTING
,
NULL
,
{
.
setting
=
&
setting_gps_on
}
},
{
SETTING
,
NULL
,
{
.
setting
=
&
setting_coord_style
}
},
{
END
,
NULL
,
{
NULL
}
}
}
};
...
...
sw/freertos/src/apps/settings/settings.c
View file @
21c04678
...
...
@@ -25,6 +25,9 @@
#include <stdio.h>
#include <string.h>
setting_t
setting_gps_on
=
{
"GPS on"
,
0
,
2
};
setting_t
setting_coord_style
=
{
"Coord style"
,
1
,
3
};
void
setting_change
(
setting_t
*
setting
)
{
uint32_t
v
=
setting
->
val
;
...
...
@@ -36,5 +39,4 @@ void setting_change(setting_t *setting)
sprintf
(
s
,
": %d"
,
v
);
setting
->
val
=
v
;
strcat
(
setting
->
name
,
s
);
}
sw/freertos/src/apps/settings/settings.h
View file @
21c04678
/*
* Copyright (C) 2014 Julian Lewis
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Theodor Stana <theodor.stana@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
...
...
@@ -35,6 +36,9 @@ extern application set_date;
void
setting_change
(
setting_t
*
setting
);
extern
setting_t
setting_gps_on
;
extern
setting_t
setting_coord_style
;
#endif
/* SETTINGS_H */
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