tinkeringtech / CircuitPython_rda5807

MIT License
4 stars 3 forks source link

radio.check_rds producing gibberish #3

Open githubguy007 opened 1 year ago

githubguy007 commented 1 year ago

I'm getting garbage characters randomly displayed on the serial port when radio.check_rds() is called in the main loop when running this example code.

Eventually this results in Feather crashes when running this example on Adafruit Feather ESP32-S2 and Feather ESP32-S2 TFT with "Adafruit CircuitPython 7.3.3 on 2022-08-29."

Traceback (most recent call last):
File "code.py", line 162, in <module>
File "tinkeringtech_rda5807m.py", line 385, in check_rds
File "tinkeringtech_rda5807m.py", line 478, in read16
OSError: [Errno 19] No such device

Code done running.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.
Screenshot 2023-01-08 at 4 05 31 PM
tinkeringtech commented 1 year ago

Hi, do you get audio from the headphones? When the signal strength for the tuned station is weak, you would typically see garbage on the serial monitor. Does RDS work when tuned to other stations. I have not seen that timeout before.

githubguy007 commented 1 year ago

Yup, getting audio.

And, I'm seeing semblances of human readable text on some stations. I'll work on my antenna, and perhaps relocate the receiver to see if I can make it cleaner.

Screenshot 2023-01-09 at 8 33 29 AM

Thanks!

githubguy007 commented 1 year ago

Still experiencing the timeout issue....

Screenshot 2023-01-09 at 10 36 19 AM
tinkeringtech commented 1 year ago

I tried to reproduce this on a Adafruit Metro ESP32-S2 express, but no luck. Must be something specific to memory allocation on a ESP32-S2 since your error happens on the RDS data. Will see if I can hit the error.

lambtor commented 1 year ago

Still experiencing the timeout issue....

Screenshot 2023-01-09 at 10 36 19 AM

Like the screenshot here, I run into a similar issue. RDS data seems to update text, but longer strings don't get the ends removed when new data is shorter than older data.

image

tinkeringtech commented 1 year ago

@lambtor apologies, we don't have a fix for this at this time. When the library was initially created, it was for short RDS strings, so you must be hitting the limits of what the RDS buffer can handle.

HilmarSt commented 1 month ago

In tinkeringtech_rda5807m.py , in def replace_element(index, text, newchar) replace `

    # this used to be an AND but that would make no sense. Changed to OR
    if newchar < 127 or newchar > 31:
        newlist[index] = chr(newchar)

´ with `

    if (newchar < 127) and (newchar > 31):
        newlist[index] = chr(newchar)
    else:
        newlist[index] = '_' # or any character you like

´