forked from len0rd/rockbox
rds: make programme identification (pi) decoding safer, show pi in the debug screen
Change-Id: I8b547400f4a28ee387157848b9640a3361df937f
This commit is contained in:
parent
d2f97da668
commit
565a4b5baa
2 changed files with 22 additions and 15 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue