miegl / PiFmAdv

Advanced Raspberry Pi FM transmitter with RDS encoding
GNU General Public License v3.0
487 stars 82 forks source link

RT A/B flag does not work #48

Closed Anthony96922 closed 5 years ago

Anthony96922 commented 5 years ago

The RT A/B flag does not seem to work no matter how many times I try. I tried the following command and nothing seems to happen on the RT display in SDRsharp.

echo -e "AB ON\nRT some text"

Doing the commands one at a time makes no difference and RDS Spy does not show the bit changing.

miegl commented 5 years ago

Does the fifo pipo work at all? Try setting different PS to see if other commands work.

Anthony96922 commented 5 years ago

The control pipe works. I have a script that updates the RT with the currently playing song and does dynamic PS as well. The problem here is the RT display does not clear out when using the AB command.

My script pseudocode:

echo "RT Here's one song" > /tmp/rds
while songIsPlaying
  echo "PS Here's" > /tmp/rds
  sleep 4
  echo "PS one song" > /tmp/rds
  sleep 4
  ...
// when a new song comes up, update the RT.
echo "AB abState" > /tmp/rds
echo "RT Here's another song" > /tmp/rds
...

The script keeps track of the AB flag and flips between the ON and OFF states on every RT update.

Anthony96922 commented 5 years ago

I fixed the problem. The issue is the AB flag toggles the first bit in the 2nd block rather than the 5th bit. Here is the edit that needs to be done:

In src/rds.c, replace blocks[1] = 0x2000 | rds_params.tp << 10 | rds_params.pty << 5 | rds_params.ab | rt_state; with blocks[1] = 0x2000 | rds_params.tp << 10 | rds_params.pty << 5 | rds_params.ab << 4 | rt_state;

This toggles bit 5 and now RT clears out as expected.

miegl commented 5 years ago

Thank you! I guess I never tested the AB functionality :smile: Fixed in https://github.com/miegl/PiFmAdv/commit/fa28a04667490da1b04cc8e90ee4bbc01c10bde4