summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_display.c19
-rw-r--r--apps/gui/skin_engine/skin_parser.c5
-rw-r--r--apps/gui/skin_engine/skin_render.c1
-rw-r--r--apps/gui/skin_engine/skin_tokens.c14
-rw-r--r--firmware/export/tuner.h17
-rw-r--r--lib/skin_parser/tag_table.c2
-rw-r--r--lib/skin_parser/tag_table.h1
-rw-r--r--uisimulator/common/fmradio.c26
8 files changed, 72 insertions, 13 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 78db4eb371..47de4638d8 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -162,9 +162,22 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
#if CONFIG_TUNER
else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
{
- int min = fm_region_data[global_settings.fm_region].freq_min;
- end = radio_current_frequency() - min;
- length = fm_region_data[global_settings.fm_region].freq_max - min;
+#ifdef HAVE_RADIO_RSSI
+ if (pb->type == SKIN_TOKEN_TUNER_RSSI_BAR)
+ {
+ int val = tuner_get(RADIO_RSSI);
+ int min = tuner_get(RADIO_RSSI_MIN);
+ int max = tuner_get(RADIO_RSSI_MAX);
+ end = val - min;
+ length = max - min;
+ }
+ else
+#endif
+ {
+ int min = fm_region_data[global_settings.fm_region].freq_min;
+ end = radio_current_frequency() - min;
+ length = fm_region_data[global_settings.fm_region].freq_max - min;
+ }
}
#endif
else if (id3 && id3->length)
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index c94ef4e5b5..818edfbd07 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -742,6 +742,8 @@ static int parse_progressbar_tag(struct skin_element* element,
token->type = SKIN_TOKEN_VOLUMEBAR;
else if (token->type == SKIN_TOKEN_BATTERY_PERCENT)
token->type = SKIN_TOKEN_BATTERY_PERCENTBAR;
+ else if (token->type == SKIN_TOKEN_TUNER_RSSI)
+ token->type = SKIN_TOKEN_TUNER_RSSI_BAR;
pb->type = token->type;
return 0;
@@ -1408,6 +1410,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
case SKIN_TOKEN_VOLUME:
case SKIN_TOKEN_BATTERY_PERCENT:
case SKIN_TOKEN_PLAYER_PROGRESSBAR:
+#ifdef HAVE_RADIO_RSSI
+ case SKIN_TOKEN_TUNER_RSSI:
+#endif
function = parse_progressbar_tag;
break;
case SKIN_TOKEN_SUBLINE_TIMEOUT:
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index a9e6319317..68a5433eb1 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -143,6 +143,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
case SKIN_TOKEN_BATTERY_PERCENTBAR:
#ifdef HAVE_LCD_BITMAP
case SKIN_TOKEN_PROGRESSBAR:
+ case SKIN_TOKEN_TUNER_RSSI_BAR:
{
struct progressbar *bar = (struct progressbar*)token->value.data;
if (do_refresh)
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index efe67a186e..c2ee7bf426 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -478,6 +478,20 @@ const char *get_radio_token(struct wps_token *token, int preset_offset,
#ifdef HAVE_RADIO_RSSI
case SKIN_TOKEN_TUNER_RSSI:
snprintf(buf, buf_size, "%d",tuner_get(RADIO_RSSI));
+ if (intval)
+ {
+ int val = tuner_get(RADIO_RSSI);
+ int min = tuner_get(RADIO_RSSI_MIN);
+ int max = tuner_get(RADIO_RSSI_MAX);
+ if (limit == TOKEN_VALUE_ONLY)
+ {
+ *intval = val;
+ }
+ else
+ {
+ *intval = 1+(limit-1)*(val-min)/(max-1-min);
+ }
+ }
return buf;
case SKIN_TOKEN_TUNER_RSSI_MIN:
snprintf(buf, buf_size, "%d",tuner_get(RADIO_RSSI_MIN));
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h
index c8bea86112..db6ee15844 100644
--- a/firmware/export/tuner.h
+++ b/firmware/export/tuner.h
@@ -94,14 +94,6 @@ extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
#if CONFIG_TUNER
-#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
-int tuner_set(int setting, int value);
-int tuner_get(int setting);
-#ifdef HAVE_RDS_CAP
-char* tuner_get_rds_info(int setting);
-#endif
-#else
-
#ifdef CONFIG_TUNER_MULTI
extern int tuner_detect_type(void);
extern int (*tuner_set)(int setting, int value);
@@ -146,7 +138,14 @@ extern int (*tuner_get)(int setting);
#include "ipod_remote_tuner.h"
#endif
-#endif /* PLATFORM_HOSTED */
+#ifdef SIMULATOR
+#undef tuner_set
+int tuner_set(int setting, int value);
+#undef tuner_get
+int tuner_get(int setting);
+#endif
+
+
/* Additional messages that get enumerated after tuner driver headers */
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
index b579ee2aaa..197963f2ac 100644
--- a/lib/skin_parser/tag_table.c
+++ b/lib/skin_parser/tag_table.c
@@ -153,7 +153,7 @@ static const struct tag_info legal_tags[] =
{ SKIN_TOKEN_TUNER_MINFREQ, "ta", "", SKIN_REFRESH_STATIC },
{ SKIN_TOKEN_TUNER_MAXFREQ, "tb", "", SKIN_REFRESH_STATIC },
{ SKIN_TOKEN_TUNER_CURFREQ, "tf", "", SKIN_REFRESH_DYNAMIC },
- { SKIN_TOKEN_TUNER_RSSI, "tr", "", SKIN_REFRESH_DYNAMIC },
+ { SKIN_TOKEN_TUNER_RSSI, "tr", BAR_PARAMS, SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_TUNER_RSSI_MIN, "tl", "", SKIN_REFRESH_STATIC },
{ SKIN_TOKEN_TUNER_RSSI_MAX, "th", "", SKIN_REFRESH_STATIC },
{ SKIN_TOKEN_PRESET_ID, "Ti", "", SKIN_REFRESH_STATIC },
diff --git a/lib/skin_parser/tag_table.h b/lib/skin_parser/tag_table.h
index ad72dab3d3..a39939d225 100644
--- a/lib/skin_parser/tag_table.h
+++ b/lib/skin_parser/tag_table.h
@@ -252,6 +252,7 @@ enum skin_token_type {
SKIN_TOKEN_TUNER_RSSI,
SKIN_TOKEN_TUNER_RSSI_MIN,
SKIN_TOKEN_TUNER_RSSI_MAX,
+ SKIN_TOKEN_TUNER_RSSI_BAR,
SKIN_TOKEN_PRESET_ID, /* "id" of this preset.. really the array element number */
SKIN_TOKEN_PRESET_NAME,
SKIN_TOKEN_PRESET_FREQ,
diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c
index cef9abf94e..6f6b0f914f 100644
--- a/uisimulator/common/fmradio.c
+++ b/uisimulator/common/fmradio.c
@@ -67,6 +67,9 @@ int tuner_set(int setting, int value)
int tuner_get(int setting)
{
int val = 0;
+#ifdef HAVE_RADIO_RSSI
+ static int rssi = 0, rssidiff = 2;
+#endif
switch(setting)
{
@@ -83,6 +86,29 @@ int tuner_get(int setting)
if(frequency == 99500000)
val = mono?0:1;
break;
+
+#ifdef HAVE_RADIO_RSSI
+ case RADIO_RSSI_MIN:
+ val = 5;
+ break;
+ case RADIO_RSSI_MAX:
+ val = 75;
+ break;
+ case RADIO_RSSI:
+ rssi += rssidiff;
+ if (rssi >= 75)
+ {
+ rssi = 75;
+ rssidiff = -2;
+ }
+ else if (rssi < 5)
+ {
+ rssi = 5;
+ rssidiff = 2;
+ }
+ val = rssi;
+ break;
+#endif
case RADIO_ALL: /* debug query */
break;