diff options
-rw-r--r-- | apps/debug_menu.c | 21 | ||||
-rw-r--r-- | firmware/drivers/rds.c | 16 |
2 files changed, 22 insertions, 15 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index a249a9be9a..28f36edeb7 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -124,6 +124,10 @@ #include "iap.h" #endif +#ifdef HAVE_RDS_CAP +#include "rds.h" +#endif + /*---------------------------------------------------*/ /* SPECIAL DEBUG STUFF */ /*---------------------------------------------------*/ @@ -1851,15 +1855,6 @@ static int radio_callback(int btn, struct gui_synclist *lists) simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X", i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); } -#ifdef HAVE_RDS_CAP - simplelist_addline(SIMPLELIST_ADD_LINE, ""); - simplelist_addline(SIMPLELIST_ADD_LINE, "RDS Info:"); - simplelist_addline(SIMPLELIST_ADD_LINE, - si4700_get_rds_info(RADIO_RDS_NAME)); - - simplelist_addline(SIMPLELIST_ADD_LINE, - si4700_get_rds_info(RADIO_RDS_TEXT)); -#endif } #endif /* SI4700 */ #if (CONFIG_TUNER & RDA5802) @@ -1874,6 +1869,14 @@ static int radio_callback(int btn, struct gui_synclist *lists) } } #endif /* RDA55802 */ + +#ifdef HAVE_RDS_CAP + simplelist_addline(SIMPLELIST_ADD_LINE, "RDS Info:"); + simplelist_addline(SIMPLELIST_ADD_LINE, "PI:%04X PS:'%8s'", + rds_get_pi(), rds_get_ps()); + simplelist_addline(SIMPLELIST_ADD_LINE, "RT:%s", + rds_get_rt()); +#endif return ACTION_REDRAW; } static bool dbg_fm_radio(void) diff --git a/firmware/drivers/rds.c b/firmware/drivers/rds.c index 05b17aba12..73118b4c37 100644 --- a/firmware/drivers/rds.c +++ b/firmware/drivers/rds.c @@ -25,7 +25,8 @@ #include "rds.h" /* programme identification */ -static uint16_t pi; +static uint16_t pi_code; +static uint16_t pi_last; /* program service name */ static char ps_data[9]; static char ps_copy[9]; @@ -69,11 +70,12 @@ void rds_reset(void) { int oldlevel = rds_disable_irq_save(); + pi_code = 0; + pi_last = 0; ps_copy[0] = '\0'; ps_segment = 0; rt_copy[0] = '\0'; rt_segment = 0; - pi = 0; rds_restore_irq(oldlevel); } @@ -180,10 +182,12 @@ bool rds_process(uint16_t data[4]) { int group; - /* get programme identification */ - if (pi == 0) { - pi = data[0]; + /* process programme identification (PI) code */ + uint16_t pi = data[0]; + if (pi == pi_last) { + pi_code = pi; } + pi_last = pi; /* handle rds data based on group */ group = (data[1] >> 11) & 0x1F; @@ -210,7 +214,7 @@ bool rds_process(uint16_t data[4]) /* returns the programme identification code */ uint16_t rds_get_pi(void) { - return pi; + return pi_code; } /* returns the most recent valid programme service name */ |